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 ad50b47a14 ("gbm: assume
USE_SCANOUT in create_with_modifiers").
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13202>
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user