summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-10 21:04:08 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-10 23:34:51 +0000
commitece7fc8afeb8eefcf0ad1a054f02e7fac8db6327 (patch)
tree96d1fdb44efc7c17fb5b8904af8431cb8b8784a7
parentb3816cf3a99d23d0c3ab4cd716b24ea544a07283 (diff)
sna: Only use the 64-byte pitch alignment for scanout
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c24
-rw-r--r--src/sna/kgem.h1
-rw-r--r--src/sna/sna_accel.c2
3 files changed, 16 insertions, 11 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f5ad1118..973afcbf 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -433,6 +433,7 @@ static uint32_t kgem_get_unique_id(struct kgem *kgem)
static uint32_t kgem_surface_size(struct kgem *kgem,
bool relaxed_fencing,
+ bool scanout,
uint32_t width,
uint32_t height,
uint32_t bpp,
@@ -447,13 +448,13 @@ static uint32_t kgem_surface_size(struct kgem *kgem,
tile_width = 512;
tile_height = 16;
} else {
- tile_width = bpp > 8 ? 64 : 4;
+ tile_width = scanout ? 64 : 4;
tile_height = 2;
}
} else switch (tiling) {
default:
case I915_TILING_NONE:
- tile_width = bpp > 8 ? 64 : 4;
+ tile_width = scanout ? 64 : 4;
tile_height = 2;
break;
case I915_TILING_X:
@@ -1373,7 +1374,7 @@ int kgem_choose_tiling(struct kgem *kgem, int tiling, int width, int height, int
/* First check that we can fence the whole object */
if (tiling &&
- kgem_surface_size(kgem, false,
+ kgem_surface_size(kgem, false, false,
width, height, bpp, tiling,
&pitch) > kgem->max_object_size) {
DBG(("%s: too large (%dx%d) to be fenced, discarding tiling\n",
@@ -1405,8 +1406,8 @@ int kgem_choose_tiling(struct kgem *kgem, int tiling, int width, int height, int
}
if (tiling == I915_TILING_X && width * bpp < 8*512/2) {
- DBG(("%s: too thin [%d] for TILING_X\n",
- __FUNCTION__, width));
+ DBG(("%s: too thin [width %d, %d bpp] for TILING_X\n",
+ __FUNCTION__, width, bpp));
tiling = I915_TILING_NONE;
goto done;
}
@@ -1444,10 +1445,10 @@ static bool _kgem_can_create_2d(struct kgem *kgem,
if (tiling < 0)
tiling = -tiling;
- size = kgem_surface_size(kgem, false,
+ size = kgem_surface_size(kgem, false, false,
width, height, bpp, tiling, &pitch);
if (size == 0 || size > kgem->max_object_size)
- size = kgem_surface_size(kgem, false,
+ size = kgem_surface_size(kgem, false, false,
width, height, bpp,
I915_TILING_NONE, &pitch);
return size > 0 && size <= kgem->max_object_size;
@@ -1504,11 +1505,14 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
if (tiling < 0)
tiling = -tiling, exact = 1;
- DBG(("%s(%dx%d, bpp=%d, tiling=%d, exact=%d, inactive=%d)\n", __FUNCTION__,
- width, height, bpp, tiling, !!exact, !!(flags & CREATE_INACTIVE)));
+ DBG(("%s(%dx%d, bpp=%d, tiling=%d, exact=%d, inactive=%d, scanout?=%d)\n", __FUNCTION__,
+ width, height, bpp, tiling,
+ !!exact, !!(flags & CREATE_INACTIVE), !!(flags & CREATE_SCANOUT)));
assert(_kgem_can_create_2d(kgem, width, height, bpp, exact ? -tiling : tiling));
- size = kgem_surface_size(kgem, kgem->has_relaxed_fencing,
+ size = kgem_surface_size(kgem,
+ kgem->has_relaxed_fencing,
+ flags & CREATE_SCANOUT,
width, height, bpp, tiling, &pitch);
assert(size && size <= kgem->max_object_size);
if (flags & CREATE_INACTIVE)
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 8649512e..e9e7cdcb 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -181,6 +181,7 @@ kgem_replace_bo(struct kgem *kgem,
enum {
CREATE_EXACT = 0x1,
CREATE_INACTIVE = 0x2,
+ CREATE_SCANOUT = 0x4,
};
struct kgem_bo *kgem_create_2d(struct kgem *kgem,
int width,
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index db225079..09e8a0c5 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1037,7 +1037,7 @@ sna_pixmap_force_to_gpu(PixmapPtr pixmap)
if (priv->cpu_damage)
flags |= CREATE_INACTIVE;
if (pixmap->usage_hint == SNA_CREATE_FB)
- flags |= CREATE_EXACT;
+ flags |= CREATE_EXACT | CREATE_SCANOUT;
priv->gpu_bo = kgem_create_2d(&sna->kgem,
pixmap->drawable.width,