blob: 0bda0145052cd4d0ee121cd31180acc8ef2d1543 [file] [log] [blame]
Andrew Geissler062316f2020-05-15 14:19:14 -05001mesa: querying dma_buf_modifiers for specific formats
2
3mesa wl_drm protocol is the backend for wayland server side which requires
4the dmabuf modifiers for some DRM formats on specific devices like RPI.
5Currently there is no support of giving any dmabuf modifiers on wl_drm protocol.
6This dma_buf modifiers allows EGL implementations to add extra attributes
7to drm_fourcc format.
8
9Upstream-Status: Pending
10
11Signed-off-by: Balaji Velmurugan <balaji.velmurugan@ltts.com>
12
13--- a/src/gallium/state_trackers/dri/dri2.c
14+++ b/src/gallium/state_trackers/dri/dri2.c
15@@ -1366,14 +1366,28 @@ dri2_from_planar(__DRIimage *image, int
16 return img;
17 }
18
19+static boolean
20+dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
21+ uint64_t *modifiers, unsigned int *external_only,
22+ int *count);
23 static __DRIimage *
24 dri2_from_fds(__DRIscreen *screen, int width, int height, int fourcc,
25 int *fds, int num_fds, int *strides, int *offsets,
26 void *loaderPrivate)
27 {
28+ uint64_t modifier= DRM_FORMAT_MOD_INVALID;
29+ unsigned int external_only= 0;
30+ int count= 0;
31+ boolean result;
32+ result= dri2_query_dma_buf_modifiers( screen, fourcc, 1, &modifier, &external_only, &count);
33+ return dri2_create_image_from_fd(screen, width, height, fourcc,
34+ modifier, fds, num_fds,
35+ strides, offsets, NULL, loaderPrivate);
36+ #if 0
37 return dri2_create_image_from_fd(screen, width, height, fourcc,
38 DRM_FORMAT_MOD_INVALID, fds, num_fds,
39 strides, offsets, NULL, loaderPrivate);
40+ #endif
41 }
42
43 static boolean