[Mesa-dev] [PATCH v2] st/dri: support format modifier queries
Varad Gautam
varadgautam at gmail.com
Fri Apr 14 10:33:25 UTC 2017
From: Varad Gautam <varad.gautam at collabora.com>
ask the driver for supported modifiers for a given format.
bump __DRIimageExtension to 16.
v2: move to __DRIimageExtension v16.
Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
---
src/gallium/state_trackers/dri/dri2.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 6dffb1d..650e611 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1274,6 +1274,21 @@ dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
pscreen->query_dmabuf_formats(pscreen, max, formats, count);
}
+static void
+dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
+ uint64_t *modifiers, int *count)
+{
+ struct dri_screen *screen = dri_screen(_screen);
+ struct pipe_screen *pscreen = screen->base.screen;
+ int dri_components;
+ enum pipe_format format = dri2_format_to_pipe_format(
+ convert_fourcc(fourcc,&dri_components));
+
+ if (pscreen->get_param(pscreen, PIPE_CAP_QUERY_DMABUF_ATTRIBS))
+ pscreen->query_dmabuf_modifiers(pscreen, format, max, modifiers,
+ count);
+}
+
static __DRIimage *
dri2_from_dma_bufs(__DRIscreen *screen,
int width, int height, int fourcc,
@@ -1440,7 +1455,7 @@ dri2_get_capabilities(__DRIscreen *_screen)
/* The extension is modified during runtime if DRI_PRIME is detected */
static __DRIimageExtension dri2ImageExtension = {
- .base = { __DRI_IMAGE, 15 },
+ .base = { __DRI_IMAGE, 16 },
.createImageFromName = dri2_create_image_from_name,
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
@@ -1460,6 +1475,7 @@ static __DRIimageExtension dri2ImageExtension = {
.unmapImage = dri2_unmap_image,
.createImageFromDmaBufs2 = NULL,
.queryDmaBufFormats = NULL,
+ .queryDmaBufModifiers = NULL,
};
@@ -2007,6 +2023,8 @@ dri2_init_screen(__DRIscreen * sPriv)
dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
+ dri2ImageExtension.queryDmaBufModifiers =
+ dri2_query_dma_buf_modifiers;
}
}
@@ -2081,6 +2099,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
+ dri2ImageExtension.queryDmaBufModifiers = dri2_query_dma_buf_modifiers;
}
sPriv->extensions = dri_screen_extensions;
--
2.10.0
More information about the mesa-dev
mailing list