[Mesa-dev] [PATCH 11/13] st/dri: support format modifier queries
Varad Gautam
varadgautam at gmail.com
Tue Nov 15 14:24:32 UTC 2016
From: Varad Gautam <varad.gautam at collabora.com>
ask the driver for supported modifiers for a given format.
Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
---
src/gallium/state_trackers/dri/dri2.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index a2b87a7..2684481 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1259,6 +1259,21 @@ dri2_from_fds(__DRIscreen *screen, int width, int height, int fourcc,
return img;
}
+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_MODIFIERS))
+ pscreen->get_modifiers_for_format(pscreen, format, max, modifiers,
+ count);
+}
+
static __DRIimage *
dri2_from_dma_bufs(__DRIscreen *screen,
int width, int height, int fourcc,
@@ -1425,7 +1440,7 @@ dri2_get_capabilities(__DRIscreen *_screen)
/* The extension is modified during runtime if DRI_PRIME is detected */
static __DRIimageExtension dri2ImageExtension = {
- .base = { __DRI_IMAGE, 14 },
+ .base = { __DRI_IMAGE, 15 },
.createImageFromName = dri2_create_image_from_name,
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
@@ -1938,6 +1953,8 @@ dri2_init_screen(__DRIscreen * sPriv)
dri2ImageExtension.createImageFromFds = dri2_from_fds;
dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
+ dri2ImageExtension.queryDmaBufModifiers =
+ dri2_query_dma_buf_modifiers;
}
}
@@ -2011,6 +2028,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
dri2ImageExtension.createImageFromFds = dri2_from_fds;
dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
+ dri2ImageExtension.queryDmaBufModifiers = dri2_query_dma_buf_modifiers;
}
sPriv->extensions = dri_screen_extensions;
--
2.6.2
More information about the mesa-dev
mailing list