summarylogtreecommitdiffstats
path: root/0026-egl-wayland-expose-EXT_yuv_surface-support.patch
blob: 5969e3060246f2a57da064736be1a39b84ed0e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 812fd3091ba1e3e2973f99e95d9d7fca9ca018c9 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Thu, 11 Jan 2018 09:38:47 +0000
Subject: [PATCH] egl/wayland: expose EXT_yuv_surface support

This adds support for YUYV configs.

---
 src/egl/drivers/dri2/egl_dri2.c         |  1 +
 src/egl/drivers/dri2/platform_wayland.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index b8e7bb0..635c445 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2420,6 +2420,7 @@ static const struct wl_drm_components_descriptor {
    { __DRI_IMAGE_COMPONENTS_Y_U_V, EGL_TEXTURE_Y_U_V_WL, 3 },
    { __DRI_IMAGE_COMPONENTS_Y_UV, EGL_TEXTURE_Y_UV_WL, 2 },
    { __DRI_IMAGE_COMPONENTS_Y_XUXV, EGL_TEXTURE_Y_XUXV_WL, 2 },
+   { __DRI_IMAGE_COMPONENTS_EXTERNAL, EGL_TEXTURE_EXTERNAL_WL, 1 },
 };
 
 static _EGLImage *
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 185c52c..10a90ff 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -151,6 +151,13 @@ static const struct dri2_wl_visual {
       { 11, 5, 0, -1 },
       { 5, 6, 5, 0 },
    },
+   {
+     "YUYV",
+     WL_DRM_FORMAT_YUYV, WL_SHM_FORMAT_YUYV,
+     __DRI_IMAGE_FORMAT_YUYV, __DRI_IMAGE_FORMAT_NONE, 32,
+     { -1, -1, -1, -1 },
+     { 0, 0, 0, 0 },
+   },
 };
 
 static int
@@ -1431,6 +1438,7 @@ dri2_wl_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
 {
    switch (cap) {
    case DRI_LOADER_CAP_FP16:
+   case DRI_LOADER_CAP_YUV_SURFACE_IMG:
       return 1;
    case DRI_LOADER_CAP_RGBA_ORDERING:
       return 1;
@@ -2135,6 +2143,7 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    unsigned int format_count[ARRAY_SIZE(dri2_wl_visuals)] = { 0 };
    unsigned int count = 0;
+   EGLint surface_type;
    bool assigned;
 
    for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++) {
@@ -2146,8 +2155,12 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
          if (!BITSET_TEST(dri2_dpy->formats.formats_bitmap, j))
             continue;
 
+         surface_type = EGL_WINDOW_BIT;
+         if (dri2_wl_visuals[j].wl_drm_format != WL_DRM_FORMAT_YUYV)
+            surface_type |= EGL_PBUFFER_BIT;
+
          dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
-               count + 1, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, NULL, dri2_wl_visuals[j].rgba_shifts, dri2_wl_visuals[j].rgba_sizes);
+               count + 1, surface_type, NULL, dri2_wl_visuals[j].rgba_shifts, dri2_wl_visuals[j].rgba_sizes);
          if (dri2_conf) {
             if (dri2_conf->base.ConfigID == count + 1)
                count++;