summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-12 23:11:05 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-12 23:12:52 +0000
commit5c2c6474efd4dbc5a0fc9c68ef4e5b5e5cfee415 (patch)
treef240275f41865d5ac97219407a764682f821a603
parent59b79e5952fdc40f8c50f74a72a19363cb426140 (diff)
sna/dri: Hook up a compile option to switch colour buffers to Y-tiling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 3beaee19..7334dfbd 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -56,6 +56,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DBG(x) ErrorF x
#endif
+#define COLOR_PREFER_TILING_Y 0
+
enum frame_event_type {
DRI2_SWAP,
DRI2_SWAP_THROTTLE,
@@ -122,6 +124,18 @@ static inline struct kgem_bo *ref(struct kgem_bo *bo)
return bo;
}
+/* Prefer to enable TILING_Y if this buffer will never be a
+ * candidate for pageflipping
+ */
+static bool color_use_tiling_y(struct sna *sna, DrawablePtr drawable)
+{
+ if (!COLOR_PREFER_TILING_Y)
+ return false;
+
+ return (drawable->width != sna->front->drawable.width ||
+ drawable->height != sna->front->drawable.height);
+}
+
static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
PixmapPtr pixmap)
{
@@ -134,8 +148,9 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
if (priv->flush)
return ref(priv->gpu_bo);
- if (priv->cpu_damage)
- list_add(&priv->list, &sna->dirty_pixmaps);
+ if (priv->gpu_bo->tiling != I915_TILING_Y &&
+ color_use_tiling_y(sna, &pixmap->drawable))
+ sna_pixmap_change_tiling(pixmap, I915_TILING_Y);
/* We need to submit any modifications to and reads from this
* buffer before we send any reply to the Client.
@@ -194,7 +209,8 @@ sna_dri_create_buffer(DrawablePtr drawable,
drawable->width,
drawable->height,
drawable->bitsPerPixel,
- I915_TILING_X, CREATE_EXACT);
+ color_use_tiling_y(sna, drawable) ? I915_TILING_Y : I915_TILING_X,
+ CREATE_EXACT);
break;
case DRI2BufferStencil: