⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intel_ioctl.c

📁 mesa-6.5-minigui源码
💻 C
📖 第 1 页 / 共 2 页
字号:
   if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {      intelScreenPrivate *screen = intel->intelScreen;      if (screen->current_rotation != 0) {         __DRIdrawablePrivate *dPriv = intel->driDrawable;         intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);      }   }}/** * NOT directly called via glFlush. */void intelFlush( GLcontext *ctx ){   intelContextPtr intel = INTEL_CONTEXT( ctx );   if (intel->Fallback)      _swrast_flush( ctx );   INTEL_FIREVERTICES( intel );   if (intel->batch.size != intel->batch.space)      intelFlushBatch( intel, GL_FALSE );}/** * Called via glFlush. */void intelglFlush( GLcontext *ctx ){   intelFlush(ctx);   intelCheckFrontRotate(ctx);}void intelFinish( GLcontext *ctx  ) {   intelContextPtr intel = INTEL_CONTEXT( ctx );   intelFlush( ctx );   intelWaitForIdle( intel );   intelCheckFrontRotate(ctx);}void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,		GLint cx, GLint cy, GLint cw, GLint ch){   intelContextPtr intel = INTEL_CONTEXT( ctx );   const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);   GLbitfield tri_mask = 0;   GLbitfield blit_mask = 0;   GLbitfield swrast_mask = 0;   if (0)      fprintf(stderr, "%s\n", __FUNCTION__);   /* Take care of cliprects, which are handled differently for    * clears, etc.    */   intelFlush( &intel->ctx );   if (mask & BUFFER_BIT_FRONT_LEFT) {      if (colorMask == ~0) {	 blit_mask |= BUFFER_BIT_FRONT_LEFT;      }       else {	 tri_mask |= BUFFER_BIT_FRONT_LEFT;      }   }   if (mask & BUFFER_BIT_BACK_LEFT) {      if (colorMask == ~0) {	 blit_mask |= BUFFER_BIT_BACK_LEFT;      }       else {	 tri_mask |= BUFFER_BIT_BACK_LEFT;      }   }   if (mask & BUFFER_BIT_DEPTH) {      blit_mask |= BUFFER_BIT_DEPTH;   }   if (mask & BUFFER_BIT_STENCIL) {      if (!intel->hw_stencil) {	 swrast_mask |= BUFFER_BIT_STENCIL;      }      else if (ctx->Stencil.WriteMask[0] != 0xff) {	 tri_mask |= BUFFER_BIT_STENCIL;      }       else {	 blit_mask |= BUFFER_BIT_STENCIL;      }   }   swrast_mask |= (mask & BUFFER_BIT_ACCUM);   if (blit_mask)       intelClearWithBlit( ctx, blit_mask, all, cx, cy, cw, ch );   if (tri_mask)       intel->vtbl.clear_with_tris( intel, tri_mask, all, cx, cy, cw, ch);   if (swrast_mask)      _swrast_Clear( ctx, swrast_mask, all, cx, cy, cw, ch );}voidintelRotateWindow(intelContextPtr intel, __DRIdrawablePrivate *dPriv,                  GLuint srcBuffer){   if (intel->vtbl.rotate_window) {      intel->vtbl.rotate_window(intel, dPriv, srcBuffer);   }}void *intelAllocateAGP( intelContextPtr intel, GLsizei size ){   int region_offset;   drmI830MemAlloc alloc;   int ret;   if (0)      fprintf(stderr, "%s: %d bytes\n", __FUNCTION__, size);   alloc.region = I830_MEM_REGION_AGP;   alloc.alignment = 0;   alloc.size = size;   alloc.region_offset = &region_offset;   LOCK_HARDWARE(intel);   /* Make sure the global heap is initialized    */   if (intel->texture_heaps[0])      driAgeTextures( intel->texture_heaps[0] );   ret = drmCommandWriteRead( intel->driFd,			      DRM_I830_ALLOC,			      &alloc, sizeof(alloc));      if (ret) {      fprintf(stderr, "%s: DRM_I830_ALLOC ret %d\n", __FUNCTION__, ret);      UNLOCK_HARDWARE(intel);      return NULL;   }      if (0)      fprintf(stderr, "%s: allocated %d bytes\n", __FUNCTION__, size);   /* Need to propogate this information (agp memory in use) to our    * local texture lru.  The kernel has already updated the global    * lru.  An alternative would have been to allocate memory the    * usual way and then notify the kernel to pin the allocation.    */   if (intel->texture_heaps[0])      driAgeTextures( intel->texture_heaps[0] );   UNLOCK_HARDWARE(intel);      return (void *)((char *)intel->intelScreen->tex.map + region_offset);}void intelFreeAGP( intelContextPtr intel, void *pointer ){   int region_offset;   drmI830MemFree memfree;   int ret;   region_offset = (char *)pointer - (char *)intel->intelScreen->tex.map;   if (region_offset < 0 ||        region_offset > intel->intelScreen->tex.size) {      fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,	      intel->intelScreen->tex.size);      return;   }   memfree.region = I830_MEM_REGION_AGP;   memfree.region_offset = region_offset;      ret = drmCommandWrite( intel->driFd,			  DRM_I830_FREE,			  &memfree, sizeof(memfree));      if (ret)       fprintf(stderr, "%s: DRM_I830_FREE ret %d\n", __FUNCTION__, ret);}/* This version of AllocateMemoryMESA allocates only agp memory, and * only does so after the point at which the driver has been * initialized. * * Theoretically a valid context isn't required.  However, in this * implementation, it is, as I'm using the hardware lock to protect * the kernel data structures, and the current context to get the * device fd. */void *intelAllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn,			      GLsizei size, GLfloat readfreq,			      GLfloat writefreq, GLfloat priority){   GET_CURRENT_CONTEXT(ctx);   if (INTEL_DEBUG & DEBUG_IOCTL)      fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq, 	      writefreq, priority);   if (getenv("INTEL_NO_ALLOC"))      return NULL;      if (!ctx || INTEL_CONTEXT(ctx) == 0)       return NULL;      return intelAllocateAGP( INTEL_CONTEXT(ctx), size );}/* Called via glXFreeMemoryMESA() */void intelFreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer){   GET_CURRENT_CONTEXT(ctx);   if (INTEL_DEBUG & DEBUG_IOCTL)       fprintf(stderr, "%s %p\n", __FUNCTION__, pointer);   if (!ctx || INTEL_CONTEXT(ctx) == 0) {      fprintf(stderr, "%s: no context\n", __FUNCTION__);      return;   }   intelFreeAGP( INTEL_CONTEXT(ctx), pointer );}/* Called via glXGetMemoryOffsetMESA()  * * Returns offset of pointer from the start of agp aperture. */GLuint intelGetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn, 				const GLvoid *pointer){   GET_CURRENT_CONTEXT(ctx);   intelContextPtr intel;   if (!ctx || !(intel = INTEL_CONTEXT(ctx)) ) {      fprintf(stderr, "%s: no context\n", __FUNCTION__);      return ~0;   }   if (!intelIsAgpMemory( intel, pointer, 0 ))      return ~0;   return intelAgpOffsetFromVirtual( intel, pointer );}GLboolean intelIsAgpMemory( intelContextPtr intel, const GLvoid *pointer,			   GLint size ){   int offset = (char *)pointer - (char *)intel->intelScreen->tex.map;   int valid = (size >= 0 &&		offset >= 0 &&		offset + size < intel->intelScreen->tex.size);   if (INTEL_DEBUG & DEBUG_IOCTL)      fprintf(stderr, "intelIsAgpMemory( %p ) : %d\n", pointer, valid );      return valid;}GLuint intelAgpOffsetFromVirtual( intelContextPtr intel, const GLvoid *pointer ){   int offset = (char *)pointer - (char *)intel->intelScreen->tex.map;   if (offset < 0 || offset > intel->intelScreen->tex.size)      return ~0;   else      return intel->intelScreen->tex.offset + offset;}/* Flip the front & back buffes */void intelPageFlip( const __DRIdrawablePrivate *dPriv ){#if 0   intelContextPtr intel;   int tmp, ret;   if (INTEL_DEBUG & DEBUG_IOCTL)      fprintf(stderr, "%s\n", __FUNCTION__);   assert(dPriv);   assert(dPriv->driContextPriv);   assert(dPriv->driContextPriv->driverPrivate);   intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;   intelFlush( &intel->ctx );   LOCK_HARDWARE( intel );   if (dPriv->pClipRects) {      *(drm_clip_rect_t *)intel->sarea->boxes = dPriv->pClipRects[0];      intel->sarea->nbox = 1;   }   ret = drmCommandNone(intel->driFd, DRM_I830_FLIP);    if (ret) {      fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);      UNLOCK_HARDWARE( intel );      exit(1);   }   tmp = intel->sarea->last_enqueue;   intelRefillBatchLocked( intel );   UNLOCK_HARDWARE( intel );   intelSetDrawBuffer( &intel->ctx, intel->ctx.Color.DriverDrawBuffer );#endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -