summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-11 15:24:28 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-11 15:29:08 +0000
commit2a5ab05f1690484c230e8f876a3f7aefb371af71 (patch)
tree6bc6f5e6ffe4d43c49b2441860b07737a16c9a20
parente94807759eb6cfb10bd2d372fa71cc64a730bc7c (diff)
sna: Use a minimum alignment of 64
We should be able to reduce this by disabling dual-stream mode of the GPU (which we want to achieve any way for 2D performance). Artefacts in small uploads demonstrate that we fail to do. References: https://bugs.freedesktop.org/show_bug.cgi?id=44150 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c18
-rw-r--r--src/sna/kgem.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f7bf116a..7636387f 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -594,6 +594,12 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
DBG(("%s: aperture mappable=%d [%d]\n", __FUNCTION__,
kgem->aperture_mappable, kgem->aperture_mappable / (1024*1024)));
+ kgem->min_alignment = 4;
+ if (gen < 60)
+ /* XXX workaround an issue where we appear to fail to
+ * disable dual-stream mode */
+ kgem->min_alignment = 64;
+
kgem->max_object_size = kgem->aperture_mappable / 2;
if (kgem->max_object_size > kgem->aperture_low)
kgem->max_object_size = kgem->aperture_low;
@@ -621,10 +627,8 @@ static uint32_t kgem_untiled_pitch(struct kgem *kgem,
uint32_t width, uint32_t bpp,
bool scanout)
{
- /* XXX workaround an issue on gen3 where we appear to fail to
- * disable dual-stream mode */
- return ALIGN(width * bpp,
- scanout || (kgem->gen >= 30 && kgem->gen < 33) ? 8*64 : 8*4) >> 3;
+ width = width * bpp >> 3;
+ return ALIGN(width, scanout ? 64 : kgem->min_alignment);
}
static uint32_t kgem_surface_size(struct kgem *kgem,
@@ -644,13 +648,13 @@ static uint32_t kgem_surface_size(struct kgem *kgem,
tile_width = 512;
tile_height = 16;
} else {
- tile_width = scanout ? 64 : 4;
+ tile_width = scanout ? 64 : kgem->min_alignment;
tile_height = 2;
}
} else switch (tiling) {
default:
case I915_TILING_NONE:
- tile_width = scanout || kgem->gen < 33 ? 64 : 4;
+ tile_width = scanout ? 64 : kgem->min_alignment;
tile_height = 2;
break;
case I915_TILING_X:
@@ -3077,7 +3081,7 @@ struct kgem_bo *kgem_create_buffer_2d(struct kgem *kgem,
int stride;
stride = ALIGN(width, 2) * bpp >> 3;
- stride = ALIGN(stride, 4);
+ stride = ALIGN(stride, kgem->min_alignment);
bo = kgem_create_buffer(kgem, stride * ALIGN(height, 2), flags, ret);
if (bo == NULL)
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index d6fdfbc9..12e5c2fa 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -148,6 +148,7 @@ struct kgem {
uint16_t half_cpu_cache_pages;
uint32_t aperture_high, aperture_low, aperture;
uint32_t aperture_fenced, aperture_mappable;
+ uint32_t min_alignment;
uint32_t max_object_size;
void (*context_switch)(struct kgem *kgem, int new_mode);