mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-14 12:44:04 +08:00
gallium/dri: add createImageFromFds2
Same as createImageFromFds but with added flags so the caller can give the driver more context. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13362>
This commit is contained in:
parent
48551a1807
commit
7a5de84249
@ -1237,7 +1237,7 @@ struct __DRIdri2ExtensionRec {
|
||||
* extensions.
|
||||
*/
|
||||
#define __DRI_IMAGE "DRI_IMAGE"
|
||||
#define __DRI_IMAGE_VERSION 19
|
||||
#define __DRI_IMAGE_VERSION 20
|
||||
|
||||
/**
|
||||
* These formats correspond to the similarly named MESA_FORMAT_*
|
||||
@ -1408,7 +1408,7 @@ enum __DRIChromaSiting {
|
||||
#define __BLIT_FLAG_FINISH 0x0002
|
||||
|
||||
/**
|
||||
* Flags for createImageFromDmaBufs3
|
||||
* Flags for createImageFromDmaBufs3 and createImageFromFds2
|
||||
*/
|
||||
#define __DRI_IMAGE_PROTECTED_CONTENT_FLAG 0x00000001
|
||||
|
||||
@ -1738,6 +1738,20 @@ struct __DRIimageExtensionRec {
|
||||
const unsigned int modifier_count,
|
||||
unsigned int use,
|
||||
void *loaderPrivate);
|
||||
|
||||
/**
|
||||
* Like createImageFromFds, but with an added flag parameter.
|
||||
*
|
||||
* See __DRI_IMAGE_*_FLAG for valid definitions of flags.
|
||||
*
|
||||
* \since 20
|
||||
*/
|
||||
__DRIimage *(*createImageFromFds2)(__DRIscreen *screen,
|
||||
int width, int height, int fourcc,
|
||||
int *fds, int num_fds,
|
||||
uint32_t flags,
|
||||
int *strides, int *offsets,
|
||||
void *loaderPrivate);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1518,6 +1518,20 @@ dri2_from_fds(__DRIscreen *screen, int width, int height, int fourcc,
|
||||
strides, offsets, 0, NULL, loaderPrivate);
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
dri2_from_fds2(__DRIscreen *screen, int width, int height, int fourcc,
|
||||
int *fds, int num_fds, uint32_t flags, int *strides,
|
||||
int *offsets, void *loaderPrivate)
|
||||
{
|
||||
unsigned bind = 0;
|
||||
if (flags & __DRI_IMAGE_PROTECTED_CONTENT_FLAG)
|
||||
bind |= PIPE_BIND_PROTECTED;
|
||||
|
||||
return dri2_create_image_from_fd(screen, width, height, fourcc,
|
||||
DRM_FORMAT_MOD_INVALID, fds, num_fds,
|
||||
strides, offsets, bind, NULL, loaderPrivate);
|
||||
}
|
||||
|
||||
static boolean
|
||||
dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
|
||||
uint64_t *modifiers, unsigned int *external_only,
|
||||
@ -1774,7 +1788,7 @@ dri2_get_capabilities(__DRIscreen *_screen)
|
||||
|
||||
/* The extension is modified during runtime if DRI_PRIME is detected */
|
||||
static const __DRIimageExtension dri2ImageExtensionTempl = {
|
||||
.base = { __DRI_IMAGE, 19 },
|
||||
.base = { __DRI_IMAGE, 20 },
|
||||
|
||||
.createImageFromName = dri2_create_image_from_name,
|
||||
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
|
||||
@ -1787,6 +1801,7 @@ static const __DRIimageExtension dri2ImageExtensionTempl = {
|
||||
.fromPlanar = dri2_from_planar,
|
||||
.createImageFromTexture = dri2_create_from_texture,
|
||||
.createImageFromFds = NULL,
|
||||
.createImageFromFds2 = NULL,
|
||||
.createImageFromDmaBufs = NULL,
|
||||
.blitImage = dri2_blit_image,
|
||||
.getCapabilities = dri2_get_capabilities,
|
||||
@ -2279,6 +2294,7 @@ dri2_init_screen_extensions(struct dri_screen *screen,
|
||||
if (drmGetCap(screen->sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
|
||||
(cap & DRM_PRIME_CAP_IMPORT)) {
|
||||
screen->image_extension.createImageFromFds = dri2_from_fds;
|
||||
screen->image_extension.createImageFromFds2 = dri2_from_fds2;
|
||||
screen->image_extension.createImageFromDmaBufs = dri2_from_dma_bufs;
|
||||
screen->image_extension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
|
||||
screen->image_extension.createImageFromDmaBufs3 = dri2_from_dma_bufs3;
|
||||
|
Loading…
Reference in New Issue
Block a user