From: David Stevens Date: Wed, 9 Dec 2020 01:38:25 +0000 (+0900) Subject: i965: plumb loader image cleanup callback X-Git-Tag: upstream/21.0.0~1393 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1cf065e0a1aba0deb7c1fee0ed4e720468d28c9;p=platform%2Fupstream%2Fmesa.git i965: plumb loader image cleanup callback Signed-off-by: David Stevens Reviewed-by: Tapani Pälli Part-of: --- diff --git a/src/mesa/drivers/dri/i965/intel_image.h b/src/mesa/drivers/dri/i965/intel_image.h index 961b2712360..c150473db4f 100644 --- a/src/mesa/drivers/dri/i965/intel_image.h +++ b/src/mesa/drivers/dri/i965/intel_image.h @@ -110,7 +110,9 @@ struct __DRIimageRec { enum __DRIChromaSiting vertical_siting; /* \} */ - void *data; + __DRIscreen *driScrnPriv; + + void *loader_private; }; #ifdef __cplusplus diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index e5606f8f7d0..1e34cbbca1a 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -477,7 +477,8 @@ intel_allocate_image(struct intel_screen *screen, int dri_format, } image->internal_format = _mesa_get_format_base_format(image->format); - image->data = loaderPrivate; + image->driScrnPriv = screen->driScrnPriv; + image->loader_private = loaderPrivate; return image; } @@ -568,7 +569,8 @@ intel_create_image_from_renderbuffer(__DRIcontext *context, image->modifier = tiling_to_modifier( isl_tiling_to_i915_tiling(irb->mt->surf.tiling)); image->offset = 0; - image->data = loaderPrivate; + image->driScrnPriv = context->driScreenPriv; + image->loader_private = loaderPrivate; brw_bo_unreference(image->bo); image->bo = irb->mt->bo; brw_bo_reference(irb->mt->bo); @@ -630,7 +632,8 @@ intel_create_image_from_texture(__DRIcontext *context, int target, image->format = obj->Image[face][level]->TexFormat; image->modifier = tiling_to_modifier( isl_tiling_to_i915_tiling(iobj->mt->surf.tiling)); - image->data = loaderPrivate; + image->driScrnPriv = context->driScreenPriv; + image->loader_private = loaderPrivate; intel_setup_image_from_mipmap_tree(brw, image, iobj->mt, level, zoffset); image->dri_format = driGLFormatToImageFormat(image->format); image->has_depthstencil = iobj->mt->stencil_mt? true : false; @@ -648,6 +651,18 @@ intel_create_image_from_texture(__DRIcontext *context, int target, static void intel_destroy_image(__DRIimage *image) { + const __DRIscreen * driScreen = image->driScrnPriv; + const __DRIimageLoaderExtension *imgLoader = driScreen->image.loader; + const __DRIdri2LoaderExtension *dri2Loader = driScreen->dri2.loader; + + if (imgLoader && imgLoader->base.version >= 4 && + imgLoader->destroyLoaderImageState) { + imgLoader->destroyLoaderImageState(image->loader_private); + } else if (dri2Loader && dri2Loader->base.version >= 5 && + dri2Loader->destroyLoaderImageState) { + dri2Loader->destroyLoaderImageState(image->loader_private); + } + brw_bo_unreference(image->bo); free(image); } @@ -1007,7 +1022,8 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate) image->tile_x = orig_image->tile_x; image->tile_y = orig_image->tile_y; image->has_depthstencil = orig_image->has_depthstencil; - image->data = loaderPrivate; + image->driScrnPriv = orig_image->driScrnPriv; + image->loader_private = loaderPrivate; image->aux_offset = orig_image->aux_offset; image->aux_pitch = orig_image->aux_pitch;