Mesa (main): i915g: Check for the scanout-layout conditions before setting level info.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 5 22:48:10 UTC 2021
Module: Mesa
Branch: main
Commit: 60f464bbce963704290a793c2b9637f7ed3aded3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=60f464bbce963704290a793c2b9637f7ed3aded3
Author: Emma Anholt <emma at anholt.net>
Date: Tue Oct 5 12:33:15 2021 -0700
i915g: Check for the scanout-layout conditions before setting level info.
Fixes leaks (release) or assertion failures (debug) on allocating small
scanout resources, when falling through to the non-scanout-specific layout
code, which became more common as of ad50b47a14e9 ("gbm: assume
USE_SCANOUT in create_with_modifiers").
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13202>
---
src/gallium/drivers/i915/i915_resource_texture.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index aac9756c1ed..75a1ce5bf16 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -193,9 +193,6 @@ i9x5_scanout_layout(struct i915_texture *tex)
if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4)
return false;
- i915_texture_set_level_info(tex, 0, 1);
- i915_texture_set_image_offset(tex, 0, 0, 0, 0);
-
if (pt->width0 >= 240) {
tex->stride = align(util_format_get_stride(pt->format, pt->width0), 64);
tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
@@ -208,6 +205,10 @@ i9x5_scanout_layout(struct i915_texture *tex)
return false;
}
+ i915_texture_set_level_info(tex, 0, 1);
+ i915_texture_set_image_offset(tex, 0, 0, 0, 0);
+
+
#if DEBUG_TEXTURE
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
pt->width0, pt->height0, util_format_get_blocksize(pt->format),
More information about the mesa-commit
mailing list