summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-08-14 21:09:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-08-14 21:15:26 +0100
commit72ed21c694aecba1e91089479b2cb5f957548fec (patch)
tree14812a18be980ecef7539d65581840e891ea1fa7
parent3bb9311e5de8bb39423397213d3de0e0ec4fcbd5 (diff)
sna: Do not force creation of a linear GPU bo that we don't want
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c4
-rw-r--r--src/sna/kgem.h1
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_accel.c11
-rw-r--r--src/sna/sna_display.c8
5 files changed, 15 insertions, 10 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 865291e2..2b146ca9 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4306,7 +4306,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
&pitch);
DBG(("%s: tiled[%d] size=%d\n", __FUNCTION__, tiling, size));
if (size > 0 && size <= kgem->max_gpu_size)
- flags |= KGEM_CAN_CREATE_GPU;
+ flags |= KGEM_CAN_CREATE_GPU | KGEM_CAN_CREATE_TILED;
if (size > 0 && size <= PAGE_SIZE*kgem->aperture_mappable/4)
flags |= KGEM_CAN_CREATE_GTT;
if (size > PAGE_SIZE*kgem->aperture_mappable/4)
@@ -4323,7 +4323,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
while (fence_size < size)
fence_size <<= 1;
if (fence_size > kgem->max_gpu_size)
- flags &= ~KGEM_CAN_CREATE_GPU;
+ flags &= ~KGEM_CAN_CREATE_GPU | KGEM_CAN_CREATE_TILED;
if (fence_size > PAGE_SIZE*kgem->aperture_fenceable/4)
flags &= ~KGEM_CAN_CREATE_GTT;
}
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index a5ee2ef5..c3a9b13d 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -273,6 +273,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem, int width, int height, int depth)
#define KGEM_CAN_CREATE_CPU 0x2
#define KGEM_CAN_CREATE_LARGE 0x4
#define KGEM_CAN_CREATE_GTT 0x8
+#define KGEM_CAN_CREATE_TILED 0x10
bool kgem_check_surface_size(struct kgem *kgem,
uint32_t width,
diff --git a/src/sna/sna.h b/src/sna/sna.h
index bce8bab3..24f96bbb 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -705,6 +705,7 @@ sna_pixmap_undo_cow(struct sna *sna, struct sna_pixmap *priv, unsigned flags);
#define __MOVE_FORCE 0x40
#define __MOVE_DRI 0x80
#define __MOVE_SCANOUT 0x100
+#define __MOVE_TILED 0x200
struct sna_pixmap *
sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int flags);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f8a5924d..92822101 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4114,12 +4114,19 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
assert(list_is_empty(&priv->flush_list));
if (flags & __MOVE_FORCE || priv->create & KGEM_CAN_CREATE_GPU) {
+ bool is_linear;
+
assert(pixmap->drawable.width > 0);
assert(pixmap->drawable.height > 0);
assert(pixmap->drawable.bitsPerPixel >= 8);
- if (sna_pixmap_default_tiling(sna, pixmap) == I915_TILING_NONE &&
- priv->cpu_bo && !priv->shm &&
+ is_linear = sna_pixmap_default_tiling(sna, pixmap) == I915_TILING_NONE;
+ if (is_linear && flags & __MOVE_TILED) {
+ DBG(("%s: not creating linear GPU bo\n", __FUNCTION__));
+ return NULL;
+ }
+
+ if (is_linear && priv->cpu_bo && !priv->shm &&
kgem_bo_convert_to_gpu(&sna->kgem, priv->cpu_bo, flags)) {
assert(!priv->mapped);
assert(!IS_STATIC_PTR(priv->ptr));
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c5580a18..2cc8c426 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1704,12 +1704,8 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
if (priv->gpu_bo->pitch > pitch_limit)
return true;
- if (priv->gpu_bo->tiling && sna->flags & SNA_LINEAR_FB) {
- DBG(("%s: gpu bo is tiled, needlinear, forcing shadow\n", __FUNCTION__));
- return true;
- }
- if (!priv->gpu_bo->tiling && !(sna->flags & SNA_LINEAR_FB)) {
- DBG(("%s: gpu bo is linear, forcing shadow\n", __FUNCTION__));
+ if (priv->gpu_bo->tiling && sna->flags & SNA_LINEAR_FB) {
+ DBG(("%s: gpu bo is tiled, need linear, forcing shadow\n", __FUNCTION__));
return true;
}