summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-07 21:56:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-08 09:16:47 +0000
commit207b4d4482a6af4a39472ec20ff04fa0c9322d73 (patch)
treec6182816230820c33e4aa2cf4f63f7f527b476e2
parent13c960db9ef876ee99991d97dfc34fef184c0341 (diff)
sna: Relax must-be-blittable rules for gen4+
The render pipeline is actually more flexible than the blitter for dealing with large surfaces and so the BLT is no longer the limiting factor on gen4+. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index e80eaaee..0c2f5475 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -799,6 +799,9 @@ static uint32_t kgem_surface_size(struct kgem *kgem,
uint32_t tile_width, tile_height;
uint32_t size;
+ assert(width <= MAXSHORT);
+ assert(height <= MAXSHORT);
+
if (kgem->gen < 30) {
if (tiling) {
tile_width = 512;
@@ -823,32 +826,26 @@ static uint32_t kgem_surface_size(struct kgem *kgem,
break;
}
- /* If it is too wide for the blitter, don't even bother. */
*pitch = ALIGN(width * bpp / 8, tile_width);
- if (kgem->gen < 40) {
- if (tiling != I915_TILING_NONE) {
- if (*pitch > 8192)
- return 0;
- for (size = tile_width; size < *pitch; size <<= 1)
- ;
- *pitch = size;
- } else {
- if (*pitch >= 32768)
- return 0;
- }
+ height = ALIGN(height, tile_height);
+ if (kgem->gen >= 40)
+ return PAGE_ALIGN(*pitch * height);
+
+ /* If it is too wide for the blitter, don't even bother. */
+ if (tiling != I915_TILING_NONE) {
+ if (*pitch > 8192)
+ return 0;
+
+ for (size = tile_width; size < *pitch; size <<= 1)
+ ;
+ *pitch = size;
} else {
- int limit = 32768;
- if (tiling)
- limit *= 4;
- if (*pitch >= limit)
+ if (*pitch >= 32768)
return 0;
}
- height = ALIGN(height, tile_height);
- if (height >= 65536)
- return 0;
size = *pitch * height;
- if (relaxed_fencing || tiling == I915_TILING_NONE || kgem->gen >= 40)
+ if (relaxed_fencing || tiling == I915_TILING_NONE)
return PAGE_ALIGN(size);
/* We need to allocate a pot fence region for a tiled buffer. */
@@ -2233,6 +2230,9 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
if (depth < 8 || kgem->wedged)
return 0;
+ if (width > MAXSHORT || height > MAXSHORT)
+ return 0;
+
size = kgem_surface_size(kgem, false, false,
width, height, bpp,
I915_TILING_NONE, &pitch);