summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad@chad-versace.us>2011-06-08 18:34:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-06-08 19:27:33 +0100
commit68755bc5ff830dc5ed6a34b18a1217b7d1003ce4 (patch)
tree01c1b6d408ae5d95627edd6992f3cc6c31fed230
parent0030c3aab6172cdb83ca8f1b7b07c7db5915990d (diff)
sna/dri: Add support for DRI2BufferStencil and DRI2BufferHiz
Based on Chad's commits 2662db5b and 3daba7e6: Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index a4dd524b..3b085b40 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -186,7 +186,32 @@ sna_dri_create_buffer(DrawablePtr drawable, unsigned int attachment,
bpp = pixmap->drawable.bitsPerPixel;
break;
- default:
+ case DRI2BufferStencil:
+ /*
+ * The stencil buffer has quirky pitch requirements. From Vol
+ * 2a, 11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface
+ * Pitch":
+ * The pitch must be set to 2x the value computed based on
+ * width, as the stencil buffer is stored with two rows
+ * interleaved.
+ * To accomplish this, we resort to the nasty hack of doubling
+ * the drm region's cpp and halving its height.
+ *
+ * If we neglect to double the pitch, then
+ * drm_intel_gem_bo_map_gtt() maps the memory incorrectly.
+ */
+ bpp = format ? format : drawable->bitsPerPixel;
+ bo = kgem_create_2d(&sna->kgem,
+ drawable->width,
+ drawable->height/2, 2*bpp,
+ I915_TILING_Y,
+ CREATE_EXACT);
+ break;
+
+ case DRI2BufferDepth:
+ case DRI2BufferDepthStencil:
+ case DRI2BufferHiz:
+ case DRI2BufferAccum:
bpp = format ? format : drawable->bitsPerPixel,
bo = kgem_create_2d(&sna->kgem,
drawable->width, drawable->height, bpp,
@@ -194,6 +219,9 @@ sna_dri_create_buffer(DrawablePtr drawable, unsigned int attachment,
I915_TILING_Y,
CREATE_EXACT);
break;
+
+ default:
+ break;
}
if (bo == NULL)
goto err;