frontend/dri: plumb loader image cleanup callback
Signed-off-by: David Stevens <stevensd@chromium.org> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7805>
This commit is contained in:
parent
479840459f
commit
d7814d6e0c
|
@ -849,6 +849,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
|
|||
img->layer = 0;
|
||||
img->use = 0;
|
||||
img->loader_private = loaderPrivate;
|
||||
img->sPriv = _screen;
|
||||
|
||||
return img;
|
||||
}
|
||||
|
@ -1057,6 +1058,7 @@ dri2_create_image_common(__DRIscreen *_screen,
|
|||
img->use = use;
|
||||
|
||||
img->loader_private = loaderPrivate;
|
||||
img->sPriv = _screen;
|
||||
return img;
|
||||
}
|
||||
|
||||
|
@ -1309,6 +1311,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
|
|||
/* This should be 0 for sub images, but dup is also used for base images. */
|
||||
img->dri_components = image->dri_components;
|
||||
img->loader_private = loaderPrivate;
|
||||
img->sPriv = image->sPriv;
|
||||
|
||||
return img;
|
||||
}
|
||||
|
|
|
@ -296,6 +296,7 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context,
|
|||
|
||||
img->dri_format = driGLFormatToImageFormat(rb->Format);
|
||||
img->loader_private = loaderPrivate;
|
||||
img->sPriv = context->driScreenPriv;
|
||||
|
||||
pipe_resource_reference(&img->texture, tex);
|
||||
|
||||
|
@ -315,6 +316,17 @@ dri2_create_image_from_renderbuffer(__DRIcontext *context,
|
|||
void
|
||||
dri2_destroy_image(__DRIimage *img)
|
||||
{
|
||||
const __DRIimageLoaderExtension *imgLoader = img->sPriv->image.loader;
|
||||
const __DRIdri2LoaderExtension *dri2Loader = img->sPriv->dri2.loader;
|
||||
|
||||
if (imgLoader && imgLoader->base.version >= 4 &&
|
||||
imgLoader->destroyLoaderImageState) {
|
||||
imgLoader->destroyLoaderImageState(img->loader_private);
|
||||
} else if (dri2Loader && dri2Loader->base.version >= 5 &&
|
||||
dri2Loader->destroyLoaderImageState) {
|
||||
dri2Loader->destroyLoaderImageState(img->loader_private);
|
||||
}
|
||||
|
||||
pipe_resource_reference(&img->texture, NULL);
|
||||
FREE(img);
|
||||
}
|
||||
|
@ -373,6 +385,7 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
|
|||
img->dri_format = driGLFormatToImageFormat(obj->Image[face][level]->TexFormat);
|
||||
|
||||
img->loader_private = loaderPrivate;
|
||||
img->sPriv = context->driScreenPriv;
|
||||
|
||||
pipe_resource_reference(&img->texture, tex);
|
||||
|
||||
|
|
|
@ -118,6 +118,8 @@ struct __DRIimageRec {
|
|||
enum __DRIChromaSiting horizontal_siting;
|
||||
enum __DRIChromaSiting vertical_siting;
|
||||
|
||||
/* DRI loader screen */
|
||||
__DRIscreen *sPriv;
|
||||
};
|
||||
|
||||
static inline boolean
|
||||
|
|
Loading…
Reference in New Issue