crocus: check for depth+stencil before creating resource
This avoid leaking memory if we return early.
Fixes: 5f7df5df0d
("crocus: disable depth and d+s formats with memory objects")
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30305>
This commit is contained in:
@@ -840,6 +840,10 @@ crocus_resource_from_memobj(struct pipe_screen *pscreen,
|
|||||||
struct pipe_memory_object *pmemobj,
|
struct pipe_memory_object *pmemobj,
|
||||||
uint64_t offset)
|
uint64_t offset)
|
||||||
{
|
{
|
||||||
|
/* Disable Depth, and combined Depth+Stencil for now. */
|
||||||
|
if (util_format_has_depth(util_format_description(templ->format)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
struct crocus_screen *screen = (struct crocus_screen *)pscreen;
|
struct crocus_screen *screen = (struct crocus_screen *)pscreen;
|
||||||
struct crocus_memory_object *memobj = (struct crocus_memory_object *)pmemobj;
|
struct crocus_memory_object *memobj = (struct crocus_memory_object *)pmemobj;
|
||||||
struct crocus_resource *res = crocus_alloc_resource(pscreen, templ);
|
struct crocus_resource *res = crocus_alloc_resource(pscreen, templ);
|
||||||
@@ -847,10 +851,6 @@ crocus_resource_from_memobj(struct pipe_screen *pscreen,
|
|||||||
if (!res)
|
if (!res)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Disable Depth, and combined Depth+Stencil for now. */
|
|
||||||
if (util_format_has_depth(util_format_description(templ->format)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (templ->flags & PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY) {
|
if (templ->flags & PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY) {
|
||||||
UNUSED const bool isl_surf_created_successfully =
|
UNUSED const bool isl_surf_created_successfully =
|
||||||
crocus_resource_configure_main(screen, res, templ, DRM_FORMAT_MOD_INVALID, 0);
|
crocus_resource_configure_main(screen, res, templ, DRM_FORMAT_MOD_INVALID, 0);
|
||||||
|
Reference in New Issue
Block a user