intel: Use tiling for dri2AllocateBuffer implementation
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 25 Apr 2011 13:53:22 +0000 (09:53 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 26 Apr 2011 17:26:34 +0000 (13:26 -0400)
src/mesa/drivers/dri/intel/intel_screen.c

index bfbfec5f93ebca482c409a83f839957e72b1e906..7de0d12bebac842d81eee0463c8baf984bb714bf 100644 (file)
@@ -672,12 +672,21 @@ intelAllocateBuffer(__DRIscreen *screen,
 {
    struct intel_buffer *intelBuffer;
    struct intel_screen *intelScreen = screen->private;
+   uint32_t tiling;
 
    intelBuffer = CALLOC(sizeof *intelBuffer);
    if (intelBuffer == NULL)
       return NULL;
 
-   intelBuffer->region = intel_region_alloc(intelScreen, I915_TILING_NONE,
+   if ((attachment == __DRI_BUFFER_DEPTH ||
+       attachment == __DRI_BUFFER_STENCIL ||
+       attachment == __DRI_BUFFER_DEPTH_STENCIL) &&
+       intelScreen->gen >= 4)
+      tiling = I915_TILING_Y;
+   else
+      tiling = I915_TILING_X;
+
+   intelBuffer->region = intel_region_alloc(intelScreen, tiling,
                                            format / 8, width, height, GL_TRUE);
    
    if (intelBuffer->region == NULL) {