[Mesa-dev] [PATCH v2 10/14] st/dri: support format queries
Varad Gautam
varadgautam at gmail.com
Thu Nov 24 15:20:47 UTC 2016
From: Varad Gautam <varad.gautam at collabora.com>
ask the driver for supported dmabuf formats
Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
---
src/gallium/state_trackers/dri/dri2.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index a2b87a7..e12a064 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1259,6 +1259,17 @@ dri2_from_fds(__DRIscreen *screen, int width, int height, int fourcc,
return img;
}
+static void
+dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
+ int *count)
+{
+ struct dri_screen *screen = dri_screen(_screen);
+ struct pipe_screen *pscreen = screen->base.screen;
+
+ if (pscreen->get_param(pscreen, PIPE_CAP_QUERY_DMABUF_ATTRIBS))
+ pscreen->query_dmabuf_formats(pscreen, max, formats, count);
+}
+
static __DRIimage *
dri2_from_dma_bufs(__DRIscreen *screen,
int width, int height, int fourcc,
@@ -1444,6 +1455,7 @@ static __DRIimageExtension dri2ImageExtension = {
.mapImage = dri2_map_image,
.unmapImage = dri2_unmap_image,
.createImageFromDmaBufs2 = NULL,
+ .queryDmaBufFormats = NULL,
};
@@ -1938,6 +1950,7 @@ dri2_init_screen(__DRIscreen * sPriv)
dri2ImageExtension.createImageFromFds = dri2_from_fds;
dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
+ dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
}
}
@@ -2011,6 +2024,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.queryDmaBufFormats = dri2_query_dma_buf_formats;
}
sPriv->extensions = dri_screen_extensions;
--
2.6.2
More information about the mesa-dev
mailing list