diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2022-09-14 07:25:57 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-14 07:25:57 -0300 |
commit | 7d317020686fe31cf6b67553c40e68fd55979234 (patch) | |
tree | 2b9f7d5c396b94797a0ac6a6051c1161f73b2a6c | |
parent | 27684f03ee2efb10a99c4ebf8aa8a9980209038f (diff) | |
parent | efcb2fe79c96beca4d7709a66aa7872839f14b9f (diff) | |
download | meta-freescale-7d317020686fe31cf6b67553c40e68fd55979234.tar.gz |
Merge pull request #1207 from YoeDistro/yoe/mut
Fix xorg/x11 related build issues
15 files changed, 4 insertions, 2091 deletions
diff --git a/recipes-graphics/gtk+/gtk+3_%.bbappend b/recipes-graphics/gtk+/gtk+3_%.bbappend index 2f108a27..fe88c0ad 100644 --- a/recipes-graphics/gtk+/gtk+3_%.bbappend +++ b/recipes-graphics/gtk+/gtk+3_%.bbappend | |||
@@ -1,5 +1,6 @@ | |||
1 | DEPENDS:append:imxgpu2d = " virtual/egl" | 1 | DEPENDS:append:imxgpu2d = " virtual/egl" |
2 | 2 | ||
3 | PACKAGECONFIG:remove:imxgpu2d = " \ | 3 | WAYLAND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'wayland', d)}" |
4 | ${@bb.utils.contains("DISTRO_FEATURES", "wayland", "x11", "", d)} \ | 4 | WAYLANDONLY = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '${WAYLAND}', '', d)}" |
5 | " | 5 | |
6 | PACKAGECONFIG:remove:imxgpu2d = " ${WAYLANDONLY}" | ||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch deleted file mode 100644 index 6f232589..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | From ed3c55fa6260ad125a32f9ac67f9e44a9bce7cf1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> | ||
3 | Date: Mon, 11 May 2020 19:12:51 -0500 | ||
4 | Subject: [PATCH] MGS-5186 Per Specification EGL_NATIVE_PIXMAP_KHR requires | ||
5 | EGL_NO_CONTEXT | ||
6 | |||
7 | https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt | ||
8 | |||
9 | Per Specification EGL_NATIVE_PIXMAP_KHR requires EGL_NO_CONTEXT. | ||
10 | So passing context will result in error. | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> | ||
14 | --- | ||
15 | hw/xwayland/xwayland-glamor-gbm.c | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | Index: xorg-server-1.20.8/hw/xwayland/xwayland-glamor-gbm.c | ||
19 | =================================================================== | ||
20 | --- xorg-server-1.20.8.orig/hw/xwayland/xwayland-glamor-gbm.c | ||
21 | +++ xorg-server-1.20.8/hw/xwayland/xwayland-glamor-gbm.c | ||
22 | @@ -167,7 +167,7 @@ xwl_glamor_gbm_create_pixmap_for_bo(Scre | ||
23 | xwl_pixmap->bo = bo; | ||
24 | xwl_pixmap->buffer = NULL; | ||
25 | xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display, | ||
26 | - xwl_screen->egl_context, | ||
27 | + EGL_NO_CONTEXT, | ||
28 | EGL_NATIVE_PIXMAP_KHR, | ||
29 | xwl_pixmap->bo, NULL); | ||
30 | if (xwl_pixmap->image == EGL_NO_IMAGE_KHR) | ||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch deleted file mode 100644 index c8f1ae73..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | From cc05c01925755310f027c61daa29648a10155f96 Mon Sep 17 00:00:00 2001 | ||
2 | From: Rohan Garg <rohan@garg.io> | ||
3 | Date: Thu, 13 Dec 2018 19:15:01 +0100 | ||
4 | Subject: [PATCH] glamor/glamor_egl.c: EGL_NATIVE_PIXMAP_KHR do not require | ||
5 | contexts | ||
6 | |||
7 | From https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt | ||
8 | |||
9 | * If <target> is EGL_NATIVE_PIXMAP_KHR, and <ctx> is not EGL_NO_CONTEXT, | ||
10 | the error EGL_BAD_PARAMETER is generated. | ||
11 | |||
12 | Fixes: a5321ea4 ("Allow to create textured pixmaps from gbm_bo without using gem names") | ||
13 | --- | ||
14 | glamor/glamor_egl.c | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | Upstream-Status: Backport [cc05c01925755310f027c61daa29648a10155f96] | ||
18 | |||
19 | diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c | ||
20 | index 0f4edb5a3..69844d4e2 100644 | ||
21 | --- a/glamor/glamor_egl.c | ||
22 | +++ b/glamor/glamor_egl.c | ||
23 | @@ -233,7 +233,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, | ||
24 | glamor_make_current(glamor_priv); | ||
25 | |||
26 | image = eglCreateImageKHR(glamor_egl->display, | ||
27 | - glamor_egl->context, | ||
28 | + EGL_NO_CONTEXT, | ||
29 | EGL_NATIVE_PIXMAP_KHR, bo, NULL); | ||
30 | if (image == EGL_NO_IMAGE_KHR) { | ||
31 | glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); | ||
32 | -- | ||
33 | 2.17.1 | ||
34 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-hw-xwayland-Makefile.am-fix-build-without-glx.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-hw-xwayland-Makefile.am-fix-build-without-glx.patch deleted file mode 100644 index 48f271ae..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0001-hw-xwayland-Makefile.am-fix-build-without-glx.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | From 836f93de99b35050d78d61d3654f7c5655184144 Mon Sep 17 00:00:00 2001 | ||
2 | From: Fabrice Fontaine <fontaine.fabrice@gmail.com> | ||
3 | Date: Fri, 19 Apr 2019 10:19:50 +0200 | ||
4 | Subject: [PATCH] hw/xwayland/Makefile.am: fix build without glx | ||
5 | |||
6 | Commit d8ec33fe0542141aed1d9016d2ecaf52da944b4b added libglxvnd.la to | ||
7 | Xwayland_LDFLAGS but GLX can be disabled through --disable-glx. | ||
8 | In this case, build fails on: | ||
9 | |||
10 | make[3]: *** No rule to make target '../../glx/libglxvnd.la', needed by 'Xwayland'. Stop. | ||
11 | make[3]: *** Waiting for unfinished jobs.... | ||
12 | |||
13 | Fixes: | ||
14 | - http://autobuild.buildroot.org/results/397f8098c57fc6c88aa12dc8d35ebb1b933d52ef | ||
15 | |||
16 | Upstream-Status: Backport [836f93de99b35050d78d61d3654f7c5655184144] | ||
17 | Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> | ||
18 | --- | ||
19 | hw/xwayland/Makefile.am | 6 +++++- | ||
20 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am | ||
23 | index bc1cb8506..502879e2a 100644 | ||
24 | --- a/hw/xwayland/Makefile.am | ||
25 | +++ b/hw/xwayland/Makefile.am | ||
26 | @@ -21,10 +21,14 @@ Xwayland_SOURCES = \ | ||
27 | $(top_srcdir)/Xi/stubs.c \ | ||
28 | $(top_srcdir)/mi/miinitext.c | ||
29 | |||
30 | +if GLX | ||
31 | +GLXVND_LIB = $(top_builddir)/glx/libglxvnd.la | ||
32 | +endif | ||
33 | + | ||
34 | Xwayland_LDADD = \ | ||
35 | $(glamor_lib) \ | ||
36 | $(XWAYLAND_LIBS) \ | ||
37 | - $(top_builddir)/glx/libglxvnd.la \ | ||
38 | + $(GLXVND_LIB) \ | ||
39 | $(XWAYLAND_SYS_LIBS) \ | ||
40 | $(top_builddir)/Xext/libXvidmode.la \ | ||
41 | $(XSERVER_SYS_LIBS) | ||
42 | -- | ||
43 | 2.17.1 | ||
44 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch deleted file mode 100644 index 6e140eaa..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | From a99ff39b3b6095a16977fbb13b2b453a7359850f Mon Sep 17 00:00:00 2001 | ||
2 | From: Xianzhong <xianzhong.li@nxp.com> | ||
3 | Date: Mon, 11 Jan 2021 11:53:29 +0800 | ||
4 | Subject: [PATCH] prefer to use GLES2 for glamor EGL config | ||
5 | |||
6 | created the initial patch for xorg/xserver 1.20.8 | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Xianzhong <xianzhong.li@nxp.com> | ||
10 | --- | ||
11 | hw/xwayland/xwayland-glamor-gbm.c | 13 ++++--------- | ||
12 | 1 file changed, 4 insertions(+), 9 deletions(-) | ||
13 | |||
14 | diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c | ||
15 | index dce782fc3..1fdf45490 100644 | ||
16 | --- a/hw/xwayland/xwayland-glamor-gbm.c | ||
17 | +++ b/hw/xwayland/xwayland-glamor-gbm.c | ||
18 | @@ -912,13 +912,8 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen) | ||
19 | struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); | ||
20 | EGLint major, minor; | ||
21 | Bool egl_initialized = FALSE; | ||
22 | - static const EGLint config_attribs_core[] = { | ||
23 | - EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, | ||
24 | - EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, | ||
25 | - EGL_CONTEXT_MAJOR_VERSION_KHR, | ||
26 | - GLAMOR_GL_CORE_VER_MAJOR, | ||
27 | - EGL_CONTEXT_MINOR_VERSION_KHR, | ||
28 | - GLAMOR_GL_CORE_VER_MINOR, | ||
29 | + static const EGLint config_attribs_gles2[] = { | ||
30 | + EGL_CONTEXT_CLIENT_VERSION, 2, | ||
31 | EGL_NONE | ||
32 | }; | ||
33 | const GLubyte *renderer; | ||
34 | @@ -947,10 +942,10 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen) | ||
35 | goto error; | ||
36 | } | ||
37 | |||
38 | - eglBindAPI(EGL_OPENGL_API); | ||
39 | + eglBindAPI(EGL_OPENGL_ES_API); | ||
40 | |||
41 | xwl_screen->egl_context = eglCreateContext( | ||
42 | - xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, config_attribs_core); | ||
43 | + xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, config_attribs_gles2); | ||
44 | if (xwl_screen->egl_context == EGL_NO_CONTEXT) { | ||
45 | xwl_screen->egl_context = eglCreateContext( | ||
46 | xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, NULL); | ||
47 | -- | ||
48 | 2.17.1 | ||
49 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-xfree86-define-FOURCC_NV12-and-XVIMAGE_NV12.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-xfree86-define-FOURCC_NV12-and-XVIMAGE_NV12.patch deleted file mode 100644 index e0958558..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0001-xfree86-define-FOURCC_NV12-and-XVIMAGE_NV12.patch +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | From 3a6fe85a5f123f53319b5be8a69666174cad09cf Mon Sep 17 00:00:00 2001 | ||
2 | From: Julien Isorce <julien.isorce@gmail.com> | ||
3 | Date: Thu, 6 Sep 2018 15:38:13 -0700 | ||
4 | Subject: [PATCH 1/8] xfree86: define FOURCC_NV12 and XVIMAGE_NV12 | ||
5 | |||
6 | Useful for glamor. | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | Signed-off-by: Julien Isorce <jisorce@oblong.com> | ||
10 | Tested-by: Olivier Fourdan <ofourdan@redhat.com> | ||
11 | Reviewed-by: Alex Deucher <alexander.deucher@amd.com> | ||
12 | --- | ||
13 | hw/xfree86/common/fourcc.h | 20 ++++++++++++++++++++ | ||
14 | 1 file changed, 20 insertions(+) | ||
15 | |||
16 | diff --git a/hw/xfree86/common/fourcc.h b/hw/xfree86/common/fourcc.h | ||
17 | index e6126b7fe..a19e6869e 100644 | ||
18 | --- a/hw/xfree86/common/fourcc.h | ||
19 | +++ b/hw/xfree86/common/fourcc.h | ||
20 | @@ -156,4 +156,24 @@ | ||
21 | XvTopToBottom \ | ||
22 | } | ||
23 | |||
24 | +#define FOURCC_NV12 0x3231564e | ||
25 | +#define XVIMAGE_NV12 \ | ||
26 | + { \ | ||
27 | + FOURCC_NV12, \ | ||
28 | + XvYUV, \ | ||
29 | + LSBFirst, \ | ||
30 | + {'N','V','1','2', \ | ||
31 | + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ | ||
32 | + 12, \ | ||
33 | + XvPlanar, \ | ||
34 | + 2, \ | ||
35 | + 0, 0, 0, 0, \ | ||
36 | + 8, 8, 8, \ | ||
37 | + 1, 2, 2, \ | ||
38 | + 1, 2, 2, \ | ||
39 | + {'Y','U','V', \ | ||
40 | + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ | ||
41 | + XvTopToBottom \ | ||
42 | + } | ||
43 | + | ||
44 | #endif /* _XF86_FOURCC_H_ */ | ||
45 | -- | ||
46 | 2.17.1 | ||
47 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch deleted file mode 100644 index 78988373..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0002-glamor-add-support-for-GL_RG.patch +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | From 7f46b31e3d80ca769f68a4ffb201d0fc4801ea93 Mon Sep 17 00:00:00 2001 | ||
2 | From: Julien Isorce <julien.isorce@gmail.com> | ||
3 | Date: Thu, 6 Sep 2018 15:38:14 -0700 | ||
4 | Subject: [PATCH 2/8] glamor: add support for GL_RG | ||
5 | |||
6 | Allow to upload the CbCr plane of an NV12 image into a GL texture. | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | Signed-off-by: Julien Isorce <jisorce@oblong.com> | ||
10 | Tested-by: Olivier Fourdan <ofourdan@redhat.com> | ||
11 | Reviewed-by: Alex Deucher <alexander.deucher@amd.com> | ||
12 | --- | ||
13 | glamor/glamor.c | 2 ++ | ||
14 | glamor/glamor.h | 1 + | ||
15 | glamor/glamor_priv.h | 4 +++- | ||
16 | glamor/glamor_transfer.c | 10 ++++++++-- | ||
17 | glamor/glamor_utils.h | 4 ++++ | ||
18 | 5 files changed, 18 insertions(+), 3 deletions(-) | ||
19 | |||
20 | diff --git a/glamor/glamor.c b/glamor/glamor.c | ||
21 | index abefef614..3e9cf284c 100644 | ||
22 | --- a/glamor/glamor.c | ||
23 | +++ b/glamor/glamor.c | ||
24 | @@ -222,6 +222,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | ||
25 | |||
26 | pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
27 | |||
28 | + pixmap_priv->is_cbcr = (usage == GLAMOR_CREATE_FORMAT_CBCR); | ||
29 | + | ||
30 | format = gl_iformat_for_pixmap(pixmap); | ||
31 | |||
32 | pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3; | ||
33 | diff --git a/glamor/glamor.h b/glamor/glamor.h | ||
34 | index be04bf858..e5992aa56 100644 | ||
35 | --- a/glamor/glamor.h | ||
36 | +++ b/glamor/glamor.h | ||
37 | @@ -129,6 +129,7 @@ extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap); | ||
38 | #define GLAMOR_CREATE_FBO_NO_FBO 0x103 | ||
39 | #define GLAMOR_CREATE_NO_LARGE 0x105 | ||
40 | #define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106 | ||
41 | +#define GLAMOR_CREATE_FORMAT_CBCR 0x107 | ||
42 | |||
43 | /* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo). | ||
44 | * | ||
45 | diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h | ||
46 | index 4353a99f1..a14aaf624 100644 | ||
47 | --- a/glamor/glamor_priv.h | ||
48 | +++ b/glamor/glamor_priv.h | ||
49 | @@ -380,6 +380,8 @@ typedef struct glamor_pixmap_private { | ||
50 | * names. | ||
51 | */ | ||
52 | glamor_pixmap_fbo **fbo_array; | ||
53 | + | ||
54 | + Bool is_cbcr; | ||
55 | } glamor_pixmap_private; | ||
56 | |||
57 | extern DevPrivateKeyRec glamor_pixmap_private_key; | ||
58 | @@ -902,7 +904,7 @@ int glamor_xv_put_image(glamor_port_private *port_priv, | ||
59 | Bool sync, | ||
60 | RegionPtr clipBoxes); | ||
61 | void glamor_xv_core_init(ScreenPtr screen); | ||
62 | -void glamor_xv_render(glamor_port_private *port_priv); | ||
63 | +void glamor_xv_render(glamor_port_private *port_priv, int id); | ||
64 | |||
65 | #include "glamor_utils.h" | ||
66 | |||
67 | diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c | ||
68 | index ebb5101d1..421ed3a5f 100644 | ||
69 | --- a/glamor/glamor_transfer.c | ||
70 | +++ b/glamor/glamor_transfer.c | ||
71 | @@ -27,6 +27,7 @@ | ||
72 | void | ||
73 | glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) | ||
74 | { | ||
75 | + glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||
76 | switch (pixmap->drawable.depth) { | ||
77 | case 24: | ||
78 | case 32: | ||
79 | @@ -38,8 +39,13 @@ glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) | ||
80 | *type = GL_UNSIGNED_INT_2_10_10_10_REV; | ||
81 | break; | ||
82 | case 16: | ||
83 | - *format = GL_RGB; | ||
84 | - *type = GL_UNSIGNED_SHORT_5_6_5; | ||
85 | + if (priv->is_cbcr) { | ||
86 | + *format = priv->fbo->format; | ||
87 | + *type = GL_UNSIGNED_BYTE; | ||
88 | + } else { | ||
89 | + *format = GL_RGB; | ||
90 | + *type = GL_UNSIGNED_SHORT_5_6_5; | ||
91 | + } | ||
92 | break; | ||
93 | case 15: | ||
94 | *format = GL_BGRA; | ||
95 | diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h | ||
96 | index 0d5674d63..1890c1fe5 100644 | ||
97 | --- a/glamor/glamor_utils.h | ||
98 | +++ b/glamor/glamor_utils.h | ||
99 | @@ -613,10 +613,14 @@ gl_iformat_for_pixmap(PixmapPtr pixmap) | ||
100 | { | ||
101 | glamor_screen_private *glamor_priv = | ||
102 | glamor_get_screen_private((pixmap)->drawable.pScreen); | ||
103 | + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
104 | |||
105 | if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
106 | ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) { | ||
107 | return glamor_priv->one_channel_format; | ||
108 | + } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
109 | + (pixmap)->drawable.depth == 16 && pixmap_priv->is_cbcr) { | ||
110 | + return GL_RG; | ||
111 | } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
112 | (pixmap)->drawable.depth == 30) { | ||
113 | return GL_RGB10_A2; | ||
114 | -- | ||
115 | 2.17.1 | ||
116 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0003-Remove-check-for-useSIGIO-option.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0003-Remove-check-for-useSIGIO-option.patch deleted file mode 100644 index beed6cb4..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0003-Remove-check-for-useSIGIO-option.patch +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | From cf407b16cd65ad6e26a9c8e5984e163409a5c0f7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> | ||
3 | Date: Mon, 30 Jan 2017 16:32:06 -0600 | ||
4 | Subject: [PATCH] Remove check for useSIGIO option | ||
5 | |||
6 | Commit 6a5a4e60373c1386b311b2a8bb666c32d68a9d99 removes the configure of useSIGIO | ||
7 | option. | ||
8 | |||
9 | As the xfree86 SIGIO support is reworked to use internal versions of OsBlockSIGIO | ||
10 | and OsReleaseSIGIO. | ||
11 | |||
12 | No longer the check for useSIGIO is needed | ||
13 | |||
14 | Upstream-Status: Pending | ||
15 | |||
16 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> | ||
17 | --- | ||
18 | hw/xfree86/os-support/shared/sigio.c | 6 ------ | ||
19 | 1 file changed, 6 deletions(-) | ||
20 | |||
21 | diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c | ||
22 | index 884a71c..be76498 100644 | ||
23 | --- a/hw/xfree86/os-support/shared/sigio.c | ||
24 | +++ b/hw/xfree86/os-support/shared/sigio.c | ||
25 | @@ -185,9 +185,6 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) | ||
26 | int i; | ||
27 | int installed = FALSE; | ||
28 | |||
29 | - if (!xf86Info.useSIGIO) | ||
30 | - return 0; | ||
31 | - | ||
32 | for (i = 0; i < MAX_FUNCS; i++) { | ||
33 | if (!xf86SigIOFuncs[i].f) { | ||
34 | if (xf86IsPipe(fd)) | ||
35 | @@ -256,9 +253,6 @@ xf86RemoveSIGIOHandler(int fd) | ||
36 | int max; | ||
37 | int ret; | ||
38 | |||
39 | - if (!xf86Info.useSIGIO) | ||
40 | - return 0; | ||
41 | - | ||
42 | max = 0; | ||
43 | ret = 0; | ||
44 | for (i = 0; i < MAX_FUNCS; i++) { | ||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0003-glamor-add-support-for-NV12-in-Xv.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0003-glamor-add-support-for-NV12-in-Xv.patch deleted file mode 100644 index 855d1938..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0003-glamor-add-support-for-NV12-in-Xv.patch +++ /dev/null | |||
@@ -1,322 +0,0 @@ | |||
1 | From 17a3528162304f1586329aabd606d3498bfe48a5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Julien Isorce <julien.isorce@gmail.com> | ||
3 | Date: Tue, 11 Sep 2018 10:28:33 -0700 | ||
4 | Subject: [PATCH 3/8] glamor: add support for NV12 in Xv | ||
5 | |||
6 | Useful when video decoders only output NV12. Currently | ||
7 | glamor Xv only supports I420 and YV12. | ||
8 | |||
9 | Note that Intel's sna supports I420, YV12, YUY2, UYVY, NV12. | ||
10 | |||
11 | Test: xvinfo | grep NV12 | ||
12 | Test: gst-launch-1.0 videotestsrc ! video/x-raw, format=NV12 ! xvimagesink | ||
13 | |||
14 | v2: Combine the two texture2Ds on u_sampler. | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | Signed-off-by: Julien Isorce <jisorce@oblong.com> | ||
18 | Tested-by: Olivier Fourdan <ofourdan@redhat.com> | ||
19 | Reviewed-by: Alex Deucher <alexander.deucher@amd.com> | ||
20 | --- | ||
21 | glamor/glamor_xv.c | 180 ++++++++++++++++++++++++++++++++++++++------- | ||
22 | 1 file changed, 155 insertions(+), 25 deletions(-) | ||
23 | |||
24 | diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c | ||
25 | index 62fc4fff5..6fef6ed0d 100644 | ||
26 | --- a/glamor/glamor_xv.c | ||
27 | +++ b/glamor/glamor_xv.c | ||
28 | @@ -59,8 +59,40 @@ typedef struct tagREF_TRANSFORM { | ||
29 | #define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0) | ||
30 | #define RTFHue(a) (((a)*3.1416)/1000.0) | ||
31 | |||
32 | -static const glamor_facet glamor_facet_xv_planar = { | ||
33 | - .name = "xv_planar", | ||
34 | +static const glamor_facet glamor_facet_xv_planar_2 = { | ||
35 | + .name = "xv_planar_2", | ||
36 | + | ||
37 | + .version = 120, | ||
38 | + | ||
39 | + .source_name = "v_texcoord0", | ||
40 | + .vs_vars = ("attribute vec2 position;\n" | ||
41 | + "attribute vec2 v_texcoord0;\n" | ||
42 | + "varying vec2 tcs;\n"), | ||
43 | + .vs_exec = (GLAMOR_POS(gl_Position, position) | ||
44 | + " tcs = v_texcoord0;\n"), | ||
45 | + | ||
46 | + .fs_vars = ("uniform sampler2D y_sampler;\n" | ||
47 | + "uniform sampler2D u_sampler;\n" | ||
48 | + "uniform vec4 offsetyco;\n" | ||
49 | + "uniform vec4 ucogamma;\n" | ||
50 | + "uniform vec4 vco;\n" | ||
51 | + "varying vec2 tcs;\n"), | ||
52 | + .fs_exec = ( | ||
53 | + " float sample;\n" | ||
54 | + " vec2 sample_uv;\n" | ||
55 | + " vec4 temp1;\n" | ||
56 | + " sample = texture2D(y_sampler, tcs).w;\n" | ||
57 | + " temp1.xyz = offsetyco.www * vec3(sample) + offsetyco.xyz;\n" | ||
58 | + " sample_uv = texture2D(u_sampler, tcs).xy;\n" | ||
59 | + " temp1.xyz = ucogamma.xyz * vec3(sample_uv.x) + temp1.xyz;\n" | ||
60 | + " temp1.xyz = clamp(vco.xyz * vec3(sample_uv.y) + temp1.xyz, 0.0, 1.0);\n" | ||
61 | + " temp1.w = 1.0;\n" | ||
62 | + " gl_FragColor = temp1;\n" | ||
63 | + ), | ||
64 | +}; | ||
65 | + | ||
66 | +static const glamor_facet glamor_facet_xv_planar_3 = { | ||
67 | + .name = "xv_planar_3", | ||
68 | |||
69 | .version = 120, | ||
70 | |||
71 | @@ -110,26 +142,50 @@ Atom glamorBrightness, glamorContrast, glamorSaturation, glamorHue, | ||
72 | XvImageRec glamor_xv_images[] = { | ||
73 | XVIMAGE_YV12, | ||
74 | XVIMAGE_I420, | ||
75 | + XVIMAGE_NV12 | ||
76 | }; | ||
77 | int glamor_xv_num_images = ARRAY_SIZE(glamor_xv_images); | ||
78 | |||
79 | static void | ||
80 | -glamor_init_xv_shader(ScreenPtr screen) | ||
81 | +glamor_init_xv_shader(ScreenPtr screen, int id) | ||
82 | { | ||
83 | glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
84 | GLint sampler_loc; | ||
85 | + const glamor_facet *glamor_facet_xv_planar = NULL; | ||
86 | + | ||
87 | + switch (id) { | ||
88 | + case FOURCC_YV12: | ||
89 | + case FOURCC_I420: | ||
90 | + glamor_facet_xv_planar = &glamor_facet_xv_planar_3; | ||
91 | + break; | ||
92 | + case FOURCC_NV12: | ||
93 | + glamor_facet_xv_planar = &glamor_facet_xv_planar_2; | ||
94 | + break; | ||
95 | + default: | ||
96 | + break; | ||
97 | + } | ||
98 | |||
99 | glamor_build_program(screen, | ||
100 | &glamor_priv->xv_prog, | ||
101 | - &glamor_facet_xv_planar, NULL, NULL, NULL); | ||
102 | + glamor_facet_xv_planar, NULL, NULL, NULL); | ||
103 | |||
104 | glUseProgram(glamor_priv->xv_prog.prog); | ||
105 | sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "y_sampler"); | ||
106 | glUniform1i(sampler_loc, 0); | ||
107 | sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "u_sampler"); | ||
108 | glUniform1i(sampler_loc, 1); | ||
109 | - sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "v_sampler"); | ||
110 | - glUniform1i(sampler_loc, 2); | ||
111 | + | ||
112 | + switch (id) { | ||
113 | + case FOURCC_YV12: | ||
114 | + case FOURCC_I420: | ||
115 | + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog.prog, "v_sampler"); | ||
116 | + glUniform1i(sampler_loc, 2); | ||
117 | + break; | ||
118 | + case FOURCC_NV12: | ||
119 | + break; | ||
120 | + default: | ||
121 | + break; | ||
122 | + } | ||
123 | |||
124 | } | ||
125 | |||
126 | @@ -227,6 +283,21 @@ glamor_xv_query_image_attributes(int id, | ||
127 | offsets[2] = size; | ||
128 | size += tmp; | ||
129 | break; | ||
130 | + case FOURCC_NV12: | ||
131 | + *w = ALIGN(*w, 2); | ||
132 | + *h = ALIGN(*h, 2); | ||
133 | + size = ALIGN(*w, 4); | ||
134 | + if (pitches) | ||
135 | + pitches[0] = size; | ||
136 | + size *= *h; | ||
137 | + if (offsets) | ||
138 | + offsets[1] = offsets[2] = size; | ||
139 | + tmp = ALIGN(*w, 4); | ||
140 | + if (pitches) | ||
141 | + pitches[1] = pitches[2] = tmp; | ||
142 | + tmp *= (*h >> 1); | ||
143 | + size += tmp; | ||
144 | + break; | ||
145 | } | ||
146 | return size; | ||
147 | } | ||
148 | @@ -240,7 +311,7 @@ static REF_TRANSFORM trans[2] = { | ||
149 | }; | ||
150 | |||
151 | void | ||
152 | -glamor_xv_render(glamor_port_private *port_priv) | ||
153 | +glamor_xv_render(glamor_port_private *port_priv, int id) | ||
154 | { | ||
155 | ScreenPtr screen = port_priv->pPixmap->drawable.pScreen; | ||
156 | glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
157 | @@ -264,7 +335,7 @@ glamor_xv_render(glamor_port_private *port_priv) | ||
158 | int dst_box_index; | ||
159 | |||
160 | if (!glamor_priv->xv_prog.prog) | ||
161 | - glamor_init_xv_shader(screen); | ||
162 | + glamor_init_xv_shader(screen, id); | ||
163 | |||
164 | cont = RTFContrast(port_priv->contrast); | ||
165 | bright = RTFBrightness(port_priv->brightness); | ||
166 | @@ -293,6 +364,8 @@ glamor_xv_render(glamor_port_private *port_priv) | ||
167 | glamor_get_pixmap_private(port_priv->src_pix[i]); | ||
168 | pixmap_priv_get_scale(src_pixmap_priv[i], &src_xscale[i], | ||
169 | &src_yscale[i]); | ||
170 | + } else { | ||
171 | + src_pixmap_priv[i] = NULL; | ||
172 | } | ||
173 | } | ||
174 | glamor_make_current(glamor_priv); | ||
175 | @@ -319,12 +392,21 @@ glamor_xv_render(glamor_port_private *port_priv) | ||
176 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
177 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
178 | |||
179 | - glActiveTexture(GL_TEXTURE2); | ||
180 | - glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->fbo->tex); | ||
181 | - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||
182 | - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
183 | - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
184 | - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
185 | + switch (id) { | ||
186 | + case FOURCC_YV12: | ||
187 | + case FOURCC_I420: | ||
188 | + glActiveTexture(GL_TEXTURE2); | ||
189 | + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->fbo->tex); | ||
190 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||
191 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
192 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
193 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
194 | + break; | ||
195 | + case FOURCC_NV12: | ||
196 | + break; | ||
197 | + default: | ||
198 | + break; | ||
199 | + } | ||
200 | |||
201 | glEnableVertexAttribArray(GLAMOR_VERTEX_POS); | ||
202 | glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); | ||
203 | @@ -336,7 +418,7 @@ glamor_xv_render(glamor_port_private *port_priv) | ||
204 | /* Set up a single primitive covering the area being drawn. We'll | ||
205 | * clip it to port_priv->clip using GL scissors instead of just | ||
206 | * emitting a GL_QUAD per box, because this way we hopefully avoid | ||
207 | - * diagonal tearing between the two trangles used to rasterize a | ||
208 | + * diagonal tearing between the two triangles used to rasterize a | ||
209 | * GL_QUAD. | ||
210 | */ | ||
211 | i = 0; | ||
212 | @@ -417,6 +499,7 @@ glamor_xv_put_image(glamor_port_private *port_priv, | ||
213 | RegionPtr clipBoxes) | ||
214 | { | ||
215 | ScreenPtr pScreen = pDrawable->pScreen; | ||
216 | + glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen); | ||
217 | int srcPitch, srcPitch2; | ||
218 | int top, nlines; | ||
219 | int s2offset, s3offset, tmp; | ||
220 | @@ -425,9 +508,16 @@ glamor_xv_put_image(glamor_port_private *port_priv, | ||
221 | s2offset = s3offset = srcPitch2 = 0; | ||
222 | |||
223 | if (!port_priv->src_pix[0] || | ||
224 | - (width != port_priv->src_pix_w || height != port_priv->src_pix_h)) { | ||
225 | + (width != port_priv->src_pix_w || height != port_priv->src_pix_h) || | ||
226 | + (port_priv->src_pix[2] && id == FOURCC_NV12) || | ||
227 | + (!port_priv->src_pix[2] && id != FOURCC_NV12)) { | ||
228 | int i; | ||
229 | |||
230 | + if (glamor_priv->xv_prog.prog) { | ||
231 | + glDeleteProgram(glamor_priv->xv_prog.prog); | ||
232 | + glamor_priv->xv_prog.prog = 0; | ||
233 | + } | ||
234 | + | ||
235 | for (i = 0; i < 3; i++) | ||
236 | if (port_priv->src_pix[i]) | ||
237 | glamor_destroy_pixmap(port_priv->src_pix[i]); | ||
238 | @@ -435,17 +525,34 @@ glamor_xv_put_image(glamor_port_private *port_priv, | ||
239 | port_priv->src_pix[0] = | ||
240 | glamor_create_pixmap(pScreen, width, height, 8, | ||
241 | GLAMOR_CREATE_FBO_NO_FBO); | ||
242 | - port_priv->src_pix[1] = | ||
243 | - glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, | ||
244 | - GLAMOR_CREATE_FBO_NO_FBO); | ||
245 | - port_priv->src_pix[2] = | ||
246 | - glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, | ||
247 | - GLAMOR_CREATE_FBO_NO_FBO); | ||
248 | + | ||
249 | + switch (id) { | ||
250 | + case FOURCC_YV12: | ||
251 | + case FOURCC_I420: | ||
252 | + port_priv->src_pix[1] = | ||
253 | + glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, | ||
254 | + GLAMOR_CREATE_FBO_NO_FBO); | ||
255 | + port_priv->src_pix[2] = | ||
256 | + glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, | ||
257 | + GLAMOR_CREATE_FBO_NO_FBO); | ||
258 | + if (!port_priv->src_pix[2]) | ||
259 | + return BadAlloc; | ||
260 | + break; | ||
261 | + case FOURCC_NV12: | ||
262 | + port_priv->src_pix[1] = | ||
263 | + glamor_create_pixmap(pScreen, width >> 1, height >> 1, 16, | ||
264 | + GLAMOR_CREATE_FBO_NO_FBO | | ||
265 | + GLAMOR_CREATE_FORMAT_CBCR); | ||
266 | + port_priv->src_pix[2] = NULL; | ||
267 | + break; | ||
268 | + default: | ||
269 | + return BadMatch; | ||
270 | + } | ||
271 | + | ||
272 | port_priv->src_pix_w = width; | ||
273 | port_priv->src_pix_h = height; | ||
274 | |||
275 | - if (!port_priv->src_pix[0] || !port_priv->src_pix[1] || | ||
276 | - !port_priv->src_pix[2]) | ||
277 | + if (!port_priv->src_pix[0] || !port_priv->src_pix[1]) | ||
278 | return BadAlloc; | ||
279 | } | ||
280 | |||
281 | @@ -489,6 +596,29 @@ glamor_xv_put_image(glamor_port_private *port_priv, | ||
282 | 0, 0, 0, 0, | ||
283 | buf + s3offset, srcPitch2); | ||
284 | break; | ||
285 | + case FOURCC_NV12: | ||
286 | + srcPitch = ALIGN(width, 4); | ||
287 | + s2offset = srcPitch * height; | ||
288 | + s2offset += ((top >> 1) * srcPitch); | ||
289 | + | ||
290 | + full_box.x1 = 0; | ||
291 | + full_box.y1 = 0; | ||
292 | + full_box.x2 = width; | ||
293 | + full_box.y2 = nlines; | ||
294 | + | ||
295 | + half_box.x1 = 0; | ||
296 | + half_box.y1 = 0; | ||
297 | + half_box.x2 = width; | ||
298 | + half_box.y2 = (nlines + 1) >> 1; | ||
299 | + | ||
300 | + glamor_upload_boxes(port_priv->src_pix[0], &full_box, 1, | ||
301 | + 0, 0, 0, 0, | ||
302 | + buf + (top * srcPitch), srcPitch); | ||
303 | + | ||
304 | + glamor_upload_boxes(port_priv->src_pix[1], &half_box, 1, | ||
305 | + 0, 0, 0, 0, | ||
306 | + buf + s2offset, srcPitch); | ||
307 | + break; | ||
308 | default: | ||
309 | return BadMatch; | ||
310 | } | ||
311 | @@ -511,7 +641,7 @@ glamor_xv_put_image(glamor_port_private *port_priv, | ||
312 | port_priv->w = width; | ||
313 | port_priv->h = height; | ||
314 | port_priv->pDraw = pDrawable; | ||
315 | - glamor_xv_render(port_priv); | ||
316 | + glamor_xv_render(port_priv, id); | ||
317 | return Success; | ||
318 | } | ||
319 | |||
320 | -- | ||
321 | 2.17.1 | ||
322 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0004-glamor-Remove-unused-format_for_pixmap-helper.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0004-glamor-Remove-unused-format_for_pixmap-helper.patch deleted file mode 100644 index c116576f..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0004-glamor-Remove-unused-format_for_pixmap-helper.patch +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | From 69892ca6a623057ed4e3be0c22cb7fd812425024 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com> | ||
3 | Date: Wed, 19 Dec 2018 10:11:22 +0100 | ||
4 | Subject: [PATCH 4/8] glamor: Remove unused format_for_pixmap helper | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | Reviewed-by: Eric Anholt <eric@anholt.net> | ||
8 | --- | ||
9 | glamor/glamor_utils.h | 6 ------ | ||
10 | 1 file changed, 6 deletions(-) | ||
11 | |||
12 | diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h | ||
13 | index 1890c1fe5..8a147ca7e 100644 | ||
14 | --- a/glamor/glamor_utils.h | ||
15 | +++ b/glamor/glamor_utils.h | ||
16 | @@ -629,12 +629,6 @@ gl_iformat_for_pixmap(PixmapPtr pixmap) | ||
17 | } | ||
18 | } | ||
19 | |||
20 | -static inline CARD32 | ||
21 | -format_for_pixmap(PixmapPtr pixmap) | ||
22 | -{ | ||
23 | - return format_for_depth((pixmap)->drawable.depth); | ||
24 | -} | ||
25 | - | ||
26 | #define REVERT_NONE 0 | ||
27 | #define REVERT_NORMAL 1 | ||
28 | #define REVERT_UPLOADING_A1 3 | ||
29 | -- | ||
30 | 2.17.1 | ||
31 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch deleted file mode 100644 index 9a0aa7ab..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | From 2498f6712c3b551c4d8104628aff78246b5cd6c8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Anholt <eric@anholt.net> | ||
3 | Date: Tue, 26 Mar 2019 15:58:59 -0700 | ||
4 | Subject: [PATCH 5/8] glamor: Stop trying to store the pixmap's "format" in | ||
5 | glamor_pixmap_fbo. | ||
6 | |||
7 | "format" is a bit of a confused term (internalformat vs GL format), | ||
8 | and all we really needed was "is this GL_RED?" | ||
9 | |||
10 | Upstream-Status: Backport | ||
11 | Signed-off-by: Eric Anholt <eric@anholt.net> | ||
12 | --- | ||
13 | glamor/glamor.c | 3 +-- | ||
14 | glamor/glamor_fbo.c | 7 ++++--- | ||
15 | glamor/glamor_priv.h | 13 ++----------- | ||
16 | glamor/glamor_render.c | 2 +- | ||
17 | glamor/glamor_transfer.c | 2 +- | ||
18 | 5 files changed, 9 insertions(+), 18 deletions(-) | ||
19 | |||
20 | diff --git a/glamor/glamor.c b/glamor/glamor.c | ||
21 | index 3e9cf284c..c36b6ea74 100644 | ||
22 | --- a/glamor/glamor.c | ||
23 | +++ b/glamor/glamor.c | ||
24 | @@ -184,8 +184,7 @@ glamor_bind_texture(glamor_screen_private *glamor_priv, GLenum texture, | ||
25 | /* Is the operand a GL_RED fbo? | ||
26 | */ | ||
27 | |||
28 | - if (glamor_fbo_red_is_alpha(glamor_priv, fbo)) { | ||
29 | - | ||
30 | + if (fbo->is_red) { | ||
31 | /* If destination is also GL_RED, then preserve the bits in | ||
32 | * the R channel */ | ||
33 | |||
34 | diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c | ||
35 | index f939a6c2f..58eb97bf4 100644 | ||
36 | --- a/glamor/glamor_fbo.c | ||
37 | +++ b/glamor/glamor_fbo.c | ||
38 | @@ -95,7 +95,7 @@ glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv, | ||
39 | |||
40 | glamor_pixmap_fbo * | ||
41 | glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
42 | - int w, int h, GLenum format, GLint tex, int flag) | ||
43 | + int w, int h, Bool is_red, GLint tex, int flag) | ||
44 | { | ||
45 | glamor_pixmap_fbo *fbo; | ||
46 | |||
47 | @@ -106,7 +106,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
48 | fbo->tex = tex; | ||
49 | fbo->width = w; | ||
50 | fbo->height = h; | ||
51 | - fbo->format = format; | ||
52 | + fbo->is_red = is_red; | ||
53 | |||
54 | if (flag != GLAMOR_CREATE_FBO_NO_FBO) { | ||
55 | if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) { | ||
56 | @@ -163,7 +163,8 @@ glamor_create_fbo(glamor_screen_private *glamor_priv, | ||
57 | if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */ | ||
58 | return NULL; | ||
59 | |||
60 | - return glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag); | ||
61 | + return glamor_create_fbo_from_tex(glamor_priv, w, h, format == GL_RED, | ||
62 | + tex, flag); | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h | ||
67 | index a14aaf624..e70d349da 100644 | ||
68 | --- a/glamor/glamor_priv.h | ||
69 | +++ b/glamor/glamor_priv.h | ||
70 | @@ -317,8 +317,7 @@ typedef struct glamor_pixmap_fbo { | ||
71 | GLuint fb; /**< GL FBO name */ | ||
72 | int width; /**< width in pixels */ | ||
73 | int height; /**< height in pixels */ | ||
74 | - GLenum format; /**< GL format used to create the texture. */ | ||
75 | - GLenum type; /**< GL type used to create the texture. */ | ||
76 | + Bool is_red; | ||
77 | } glamor_pixmap_fbo; | ||
78 | |||
79 | typedef struct glamor_pixmap_clipped_regions { | ||
80 | @@ -533,7 +532,7 @@ glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private * | ||
81 | void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo); | ||
82 | glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private * | ||
83 | glamor_priv, int w, int h, | ||
84 | - GLenum format, GLint tex, | ||
85 | + Bool is_red, GLint tex, | ||
86 | int flag); | ||
87 | glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w, | ||
88 | int h, GLenum format, int flag); | ||
89 | @@ -549,14 +548,6 @@ static inline Bool glamor_picture_is_alpha(PicturePtr picture) | ||
90 | return picture->format == PICT_a1 || picture->format == PICT_a8; | ||
91 | } | ||
92 | |||
93 | -/* Return whether 'fbo' is storing alpha bits in the red channel */ | ||
94 | -static inline Bool | ||
95 | -glamor_fbo_red_is_alpha(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) | ||
96 | -{ | ||
97 | - /* True when the format is GL_RED (that can only happen when our one channel format is GL_RED */ | ||
98 | - return fbo->format == GL_RED; | ||
99 | -} | ||
100 | - | ||
101 | /* Return whether 'picture' is storing alpha bits in the red channel */ | ||
102 | static inline Bool | ||
103 | glamor_picture_red_is_alpha(PicturePtr picture) | ||
104 | diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c | ||
105 | index d5737018f..6db6bfbc3 100644 | ||
106 | --- a/glamor/glamor_render.c | ||
107 | +++ b/glamor/glamor_render.c | ||
108 | @@ -529,7 +529,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, | ||
109 | * sometimes get zero bits in the R channel, which is harmless. | ||
110 | */ | ||
111 | glamor_bind_texture(glamor_priv, GL_TEXTURE0 + unit, fbo, | ||
112 | - glamor_fbo_red_is_alpha(glamor_priv, dest_priv->fbo)); | ||
113 | + dest_priv->fbo->is_red); | ||
114 | repeat_type = picture->repeatType; | ||
115 | switch (picture->repeatType) { | ||
116 | case RepeatNone: | ||
117 | diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c | ||
118 | index 421ed3a5f..215752d7b 100644 | ||
119 | --- a/glamor/glamor_transfer.c | ||
120 | +++ b/glamor/glamor_transfer.c | ||
121 | @@ -40,7 +40,7 @@ glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) | ||
122 | break; | ||
123 | case 16: | ||
124 | if (priv->is_cbcr) { | ||
125 | - *format = priv->fbo->format; | ||
126 | + *format = GL_RG; | ||
127 | *type = GL_UNSIGNED_BYTE; | ||
128 | } else { | ||
129 | *format = GL_RGB; | ||
130 | -- | ||
131 | 2.17.1 | ||
132 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch deleted file mode 100644 index 66d2877c..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch +++ /dev/null | |||
@@ -1,265 +0,0 @@ | |||
1 | From 3c14a16e1b4277aa00a2b23d5758d99dc20ca819 Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Anholt <eric@anholt.net> | ||
3 | Date: Tue, 26 Mar 2019 16:57:24 -0700 | ||
4 | Subject: [PATCH 6/8] glamor: Plumb the pixmap through fbo creation instead of | ||
5 | a "format" | ||
6 | |||
7 | For GLES, we're going to need a lot more logic for picking the | ||
8 | iformat/format/type of texture setup, so we'll want the pixmap's depth | ||
9 | and is_cbcr flag. | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | Signed-off-by: Eric Anholt <eric@anholt.net> | ||
13 | --- | ||
14 | glamor/glamor.c | 20 +++++++------------- | ||
15 | glamor/glamor_fbo.c | 33 +++++++++++++++++++-------------- | ||
16 | glamor/glamor_picture.c | 2 +- | ||
17 | glamor/glamor_priv.h | 12 ++++++------ | ||
18 | 4 files changed, 33 insertions(+), 34 deletions(-) | ||
19 | |||
20 | diff --git a/glamor/glamor.c b/glamor/glamor.c | ||
21 | index c36b6ea74..f618c2128 100644 | ||
22 | --- a/glamor/glamor.c | ||
23 | +++ b/glamor/glamor.c | ||
24 | @@ -106,7 +106,6 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) | ||
25 | glamor_pixmap_private *pixmap_priv; | ||
26 | glamor_screen_private *glamor_priv; | ||
27 | glamor_pixmap_fbo *fbo; | ||
28 | - GLenum format; | ||
29 | |||
30 | glamor_priv = glamor_get_screen_private(screen); | ||
31 | pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
32 | @@ -116,9 +115,9 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) | ||
33 | glamor_destroy_fbo(glamor_priv, fbo); | ||
34 | } | ||
35 | |||
36 | - format = gl_iformat_for_pixmap(pixmap); | ||
37 | - fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width, | ||
38 | - pixmap->drawable.height, format, tex, 0); | ||
39 | + fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap, | ||
40 | + pixmap->drawable.width, | ||
41 | + pixmap->drawable.height, tex, 0); | ||
42 | |||
43 | if (fbo == NULL) { | ||
44 | ErrorF("XXX fail to create fbo.\n"); | ||
45 | @@ -204,7 +203,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | ||
46 | glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
47 | glamor_pixmap_fbo *fbo = NULL; | ||
48 | int pitch; | ||
49 | - GLenum format; | ||
50 | |||
51 | if (w > 32767 || h > 32767) | ||
52 | return NullPixmap; | ||
53 | @@ -223,8 +221,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | ||
54 | |||
55 | pixmap_priv->is_cbcr = (usage == GLAMOR_CREATE_FORMAT_CBCR); | ||
56 | |||
57 | - format = gl_iformat_for_pixmap(pixmap); | ||
58 | - | ||
59 | pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3; | ||
60 | screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL); | ||
61 | |||
62 | @@ -238,12 +234,12 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | ||
63 | glamor_check_fbo_size(glamor_priv, w, h)) | ||
64 | { | ||
65 | glamor_init_pixmap_private_small(pixmap, pixmap_priv); | ||
66 | - fbo = glamor_create_fbo(glamor_priv, w, h, format, usage); | ||
67 | + fbo = glamor_create_fbo(glamor_priv, pixmap, w, h, usage); | ||
68 | } else { | ||
69 | int tile_size = glamor_priv->max_fbo_size; | ||
70 | DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", | ||
71 | pixmap, w, h, tile_size); | ||
72 | - fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage, | ||
73 | + fbo = glamor_create_fbo_array(glamor_priv, pixmap, usage, | ||
74 | tile_size, tile_size, pixmap_priv); | ||
75 | } | ||
76 | |||
77 | @@ -860,8 +856,7 @@ _glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, | ||
78 | switch (pixmap_priv->type) { | ||
79 | case GLAMOR_TEXTURE_DRM: | ||
80 | case GLAMOR_TEXTURE_ONLY: | ||
81 | - if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ? | ||
82 | - GL_RGB10_A2 : GL_RGBA, 0)) | ||
83 | + if (!glamor_pixmap_ensure_fbo(pixmap, 0)) | ||
84 | return 0; | ||
85 | |||
86 | if (modifier) { | ||
87 | @@ -937,8 +932,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size) | ||
88 | switch (pixmap_priv->type) { | ||
89 | case GLAMOR_TEXTURE_DRM: | ||
90 | case GLAMOR_TEXTURE_ONLY: | ||
91 | - if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ? | ||
92 | - GL_RGB10_A2 : GL_RGBA, 0)) | ||
93 | + if (!glamor_pixmap_ensure_fbo(pixmap, 0)) | ||
94 | return -1; | ||
95 | return glamor_egl_fd_name_from_pixmap(pixmap->drawable.pScreen, | ||
96 | pixmap, stride, size); | ||
97 | diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c | ||
98 | index 58eb97bf4..75f7e2baa 100644 | ||
99 | --- a/glamor/glamor_fbo.c | ||
100 | +++ b/glamor/glamor_fbo.c | ||
101 | @@ -95,8 +95,9 @@ glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv, | ||
102 | |||
103 | glamor_pixmap_fbo * | ||
104 | glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
105 | - int w, int h, Bool is_red, GLint tex, int flag) | ||
106 | + PixmapPtr pixmap, int w, int h, GLint tex, int flag) | ||
107 | { | ||
108 | + GLenum format = gl_iformat_for_pixmap(pixmap); | ||
109 | glamor_pixmap_fbo *fbo; | ||
110 | |||
111 | fbo = calloc(1, sizeof(*fbo)); | ||
112 | @@ -106,7 +107,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
113 | fbo->tex = tex; | ||
114 | fbo->width = w; | ||
115 | fbo->height = h; | ||
116 | - fbo->is_red = is_red; | ||
117 | + fbo->is_red = format == GL_RED; | ||
118 | |||
119 | if (flag != GLAMOR_CREATE_FBO_NO_FBO) { | ||
120 | if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) { | ||
121 | @@ -120,13 +121,15 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
122 | |||
123 | static int | ||
124 | _glamor_create_tex(glamor_screen_private *glamor_priv, | ||
125 | - int w, int h, GLenum format) | ||
126 | + PixmapPtr pixmap, int w, int h) | ||
127 | { | ||
128 | + GLenum iformat = gl_iformat_for_pixmap(pixmap); | ||
129 | + GLenum format = iformat; | ||
130 | unsigned int tex; | ||
131 | - GLenum iformat = format; | ||
132 | |||
133 | if (format == GL_RGB10_A2) | ||
134 | format = GL_RGBA; | ||
135 | + | ||
136 | glamor_make_current(glamor_priv); | ||
137 | glGenTextures(1, &tex); | ||
138 | glBindTexture(GL_TEXTURE_2D, tex); | ||
139 | @@ -156,14 +159,14 @@ _glamor_create_tex(glamor_screen_private *glamor_priv, | ||
140 | |||
141 | glamor_pixmap_fbo * | ||
142 | glamor_create_fbo(glamor_screen_private *glamor_priv, | ||
143 | - int w, int h, GLenum format, int flag) | ||
144 | + PixmapPtr pixmap, int w, int h, int flag) | ||
145 | { | ||
146 | - GLint tex = _glamor_create_tex(glamor_priv, w, h, format); | ||
147 | + GLint tex = _glamor_create_tex(glamor_priv, pixmap, w, h); | ||
148 | |||
149 | if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */ | ||
150 | return NULL; | ||
151 | |||
152 | - return glamor_create_fbo_from_tex(glamor_priv, w, h, format == GL_RED, | ||
153 | + return glamor_create_fbo_from_tex(glamor_priv, pixmap, w, h, | ||
154 | tex, flag); | ||
155 | } | ||
156 | |||
157 | @@ -173,10 +176,12 @@ glamor_create_fbo(glamor_screen_private *glamor_priv, | ||
158 | */ | ||
159 | glamor_pixmap_fbo * | ||
160 | glamor_create_fbo_array(glamor_screen_private *glamor_priv, | ||
161 | - int w, int h, GLenum format, int flag, | ||
162 | + PixmapPtr pixmap, int flag, | ||
163 | int block_w, int block_h, | ||
164 | glamor_pixmap_private *priv) | ||
165 | { | ||
166 | + int w = pixmap->drawable.width; | ||
167 | + int h = pixmap->drawable.height; | ||
168 | int block_wcnt; | ||
169 | int block_hcnt; | ||
170 | glamor_pixmap_fbo **fbo_array; | ||
171 | @@ -216,8 +221,8 @@ glamor_create_fbo_array(glamor_screen_private *glamor_priv, | ||
172 | box_array[i * block_wcnt + j].x2 - box_array[i * block_wcnt + | ||
173 | j].x1; | ||
174 | fbo_array[i * block_wcnt + j] = glamor_create_fbo(glamor_priv, | ||
175 | + pixmap, | ||
176 | fbo_w, fbo_h, | ||
177 | - format, | ||
178 | GLAMOR_CREATE_PIXMAP_FIXUP); | ||
179 | if (fbo_array[i * block_wcnt + j] == NULL) | ||
180 | goto cleanup; | ||
181 | @@ -315,7 +320,7 @@ glamor_pixmap_destroy_fbo(PixmapPtr pixmap) | ||
182 | } | ||
183 | |||
184 | Bool | ||
185 | -glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) | ||
186 | +glamor_pixmap_ensure_fbo(PixmapPtr pixmap, int flag) | ||
187 | { | ||
188 | glamor_screen_private *glamor_priv; | ||
189 | glamor_pixmap_private *pixmap_priv; | ||
190 | @@ -325,8 +330,8 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) | ||
191 | pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
192 | if (pixmap_priv->fbo == NULL) { | ||
193 | |||
194 | - fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width, | ||
195 | - pixmap->drawable.height, format, flag); | ||
196 | + fbo = glamor_create_fbo(glamor_priv, pixmap, pixmap->drawable.width, | ||
197 | + pixmap->drawable.height, flag); | ||
198 | if (fbo == NULL) | ||
199 | return FALSE; | ||
200 | |||
201 | @@ -336,8 +341,8 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) | ||
202 | /* We do have a fbo, but it may lack of fb or tex. */ | ||
203 | if (!pixmap_priv->fbo->tex) | ||
204 | pixmap_priv->fbo->tex = | ||
205 | - _glamor_create_tex(glamor_priv, pixmap->drawable.width, | ||
206 | - pixmap->drawable.height, format); | ||
207 | + _glamor_create_tex(glamor_priv, pixmap, pixmap->drawable.width, | ||
208 | + pixmap->drawable.height); | ||
209 | |||
210 | if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0) | ||
211 | if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->fbo) != 0) | ||
212 | diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c | ||
213 | index 685d8d618..e6d387d42 100644 | ||
214 | --- a/glamor/glamor_picture.c | ||
215 | +++ b/glamor/glamor_picture.c | ||
216 | @@ -340,7 +340,7 @@ glamor_upload_picture_to_texture(PicturePtr picture) | ||
217 | else | ||
218 | iformat = format; | ||
219 | |||
220 | - if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) { | ||
221 | + if (!glamor_pixmap_ensure_fbo(pixmap, GLAMOR_CREATE_FBO_NO_FBO)) { | ||
222 | ret = FALSE; | ||
223 | goto fail; | ||
224 | } | ||
225 | diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h | ||
226 | index e70d349da..a87caec9b 100644 | ||
227 | --- a/glamor/glamor_priv.h | ||
228 | +++ b/glamor/glamor_priv.h | ||
229 | @@ -531,11 +531,11 @@ glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private * | ||
230 | pixmap_priv); | ||
231 | void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo); | ||
232 | glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private * | ||
233 | - glamor_priv, int w, int h, | ||
234 | - Bool is_red, GLint tex, | ||
235 | + glamor_priv, PixmapPtr pixmap, | ||
236 | + int w, int h, GLint tex, | ||
237 | int flag); | ||
238 | -glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w, | ||
239 | - int h, GLenum format, int flag); | ||
240 | +glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, | ||
241 | + PixmapPtr pixmap, int w, int h, int flag); | ||
242 | void glamor_destroy_fbo(glamor_screen_private *glamor_priv, | ||
243 | glamor_pixmap_fbo *fbo); | ||
244 | void glamor_pixmap_destroy_fbo(PixmapPtr pixmap); | ||
245 | @@ -563,7 +563,7 @@ void glamor_bind_texture(glamor_screen_private *glamor_priv, | ||
246 | Bool destination_red); | ||
247 | |||
248 | glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv, | ||
249 | - int w, int h, GLenum format, | ||
250 | + PixmapPtr pixmap, | ||
251 | int flag, int block_w, int block_h, | ||
252 | glamor_pixmap_private *); | ||
253 | |||
254 | @@ -673,7 +673,7 @@ glamor_put_vbo_space(ScreenPtr screen); | ||
255 | * the fbo has valid texture and attach to a valid fb. | ||
256 | * If the fbo already has a valid glfbo then do nothing. | ||
257 | */ | ||
258 | -Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag); | ||
259 | +Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, int flag); | ||
260 | |||
261 | glamor_pixmap_clipped_regions * | ||
262 | glamor_compute_clipped_regions(PixmapPtr pixmap, | ||
263 | -- | ||
264 | 2.17.1 | ||
265 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0007-glamor-Switch-the-gl_flavor-to-a-boolean-is_gles.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0007-glamor-Switch-the-gl_flavor-to-a-boolean-is_gles.patch deleted file mode 100644 index f2947f32..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0007-glamor-Switch-the-gl_flavor-to-a-boolean-is_gles.patch +++ /dev/null | |||
@@ -1,287 +0,0 @@ | |||
1 | From 3a03576d672d24f19fdb930b08afde9a3a3f55da Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Anholt <eric@anholt.net> | ||
3 | Date: Tue, 26 Mar 2019 15:02:38 -0700 | ||
4 | Subject: [PATCH 7/8] glamor: Switch the gl_flavor to a boolean is_gles. | ||
5 | |||
6 | There are only 2 flavors we are distinguishing -- GL versions are | ||
7 | handled separately. | ||
8 | |||
9 | Upstream-Status: Backport | ||
10 | Signed-off-by: Eric Anholt <eric@anholt.net> | ||
11 | --- | ||
12 | glamor/glamor.c | 20 +++++++++----------- | ||
13 | glamor/glamor_picture.c | 22 +++++++++++----------- | ||
14 | glamor/glamor_pixmap.c | 2 +- | ||
15 | glamor/glamor_priv.h | 7 +------ | ||
16 | glamor/glamor_program.c | 2 +- | ||
17 | glamor/glamor_render.c | 2 +- | ||
18 | glamor/glamor_utils.h | 6 +++--- | ||
19 | 7 files changed, 27 insertions(+), 34 deletions(-) | ||
20 | |||
21 | diff --git a/glamor/glamor.c b/glamor/glamor.c | ||
22 | index f618c2128..019edbbb1 100644 | ||
23 | --- a/glamor/glamor.c | ||
24 | +++ b/glamor/glamor.c | ||
25 | @@ -505,10 +505,8 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
26 | |||
27 | glamor_make_current(glamor_priv); | ||
28 | |||
29 | - if (epoxy_is_desktop_gl()) | ||
30 | - glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP; | ||
31 | - else | ||
32 | - glamor_priv->gl_flavor = GLAMOR_GL_ES2; | ||
33 | + if (!epoxy_is_desktop_gl()) | ||
34 | + glamor_priv->is_gles = TRUE; | ||
35 | |||
36 | gl_version = epoxy_gl_version(); | ||
37 | |||
38 | @@ -540,7 +538,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
39 | } | ||
40 | glamor_priv->glsl_version = glsl_major * 100 + glsl_minor; | ||
41 | |||
42 | - if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { | ||
43 | + if (glamor_priv->is_gles) { | ||
44 | /* Force us back to the base version of our programs on an ES | ||
45 | * context, anyway. Basically glamor only uses desktop 1.20 | ||
46 | * or 1.30 currently. 1.30's new features are also present in | ||
47 | @@ -564,7 +562,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
48 | * have support for it, with most of the ones lacking it being on | ||
49 | * Windows with Intel 4-series (G45) graphics or older. | ||
50 | */ | ||
51 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
52 | + if (!glamor_priv->is_gles) { | ||
53 | if (gl_version < 21) { | ||
54 | ErrorF("Require OpenGL version 2.1 or later.\n"); | ||
55 | goto fail; | ||
56 | @@ -610,7 +608,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
57 | } | ||
58 | |||
59 | glamor_priv->has_rw_pbo = FALSE; | ||
60 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) | ||
61 | + if (!glamor_priv->is_gles) | ||
62 | glamor_priv->has_rw_pbo = TRUE; | ||
63 | |||
64 | glamor_priv->has_khr_debug = epoxy_has_gl_extension("GL_KHR_debug"); | ||
65 | @@ -628,11 +626,11 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
66 | glamor_priv->has_nv_texture_barrier = | ||
67 | epoxy_has_gl_extension("GL_NV_texture_barrier"); | ||
68 | glamor_priv->has_unpack_subimage = | ||
69 | - glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP || | ||
70 | + !glamor_priv->is_gles || | ||
71 | epoxy_gl_version() >= 30 || | ||
72 | epoxy_has_gl_extension("GL_EXT_unpack_subimage"); | ||
73 | glamor_priv->has_pack_subimage = | ||
74 | - glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP || | ||
75 | + !glamor_priv->is_gles || | ||
76 | epoxy_gl_version() >= 30 || | ||
77 | epoxy_has_gl_extension("GL_NV_pack_subimage"); | ||
78 | glamor_priv->has_dual_blend = | ||
79 | @@ -643,7 +641,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
80 | |||
81 | glamor_setup_debug_output(screen); | ||
82 | |||
83 | - glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) && | ||
84 | + glamor_priv->use_quads = !glamor_priv->is_gles && | ||
85 | !glamor_priv->is_core_profile; | ||
86 | |||
87 | /* Driver-specific hack: Avoid using GL_QUADS on VC4, where | ||
88 | @@ -665,7 +663,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
89 | |||
90 | glamor_priv->has_texture_swizzle = | ||
91 | (epoxy_has_gl_extension("GL_ARB_texture_swizzle") || | ||
92 | - (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP && gl_version >= 30)); | ||
93 | + (glamor_priv->is_gles && gl_version >= 30)); | ||
94 | |||
95 | glamor_priv->one_channel_format = GL_ALPHA; | ||
96 | if (epoxy_has_gl_extension("GL_ARB_texture_rg") && | ||
97 | diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c | ||
98 | index e6d387d42..ed2decc83 100644 | ||
99 | --- a/glamor/glamor_picture.c | ||
100 | +++ b/glamor/glamor_picture.c | ||
101 | @@ -90,7 +90,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
102 | |||
103 | case PICT_b8g8r8x8: | ||
104 | case PICT_b8g8r8a8: | ||
105 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
106 | + if (!glamor_priv->is_gles) { | ||
107 | *tex_format = GL_BGRA; | ||
108 | *tex_type = GL_UNSIGNED_INT_8_8_8_8; | ||
109 | } else { | ||
110 | @@ -109,7 +109,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
111 | |||
112 | case PICT_x8r8g8b8: | ||
113 | case PICT_a8r8g8b8: | ||
114 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
115 | + if (!glamor_priv->is_gles) { | ||
116 | *tex_format = GL_BGRA; | ||
117 | *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; | ||
118 | } else { | ||
119 | @@ -128,7 +128,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
120 | case PICT_x8b8g8r8: | ||
121 | case PICT_a8b8g8r8: | ||
122 | *tex_format = GL_RGBA; | ||
123 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
124 | + if (!glamor_priv->is_gles) { | ||
125 | *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; | ||
126 | } else { | ||
127 | *tex_format = GL_RGBA; | ||
128 | @@ -141,7 +141,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
129 | |||
130 | case PICT_x2r10g10b10: | ||
131 | case PICT_a2r10g10b10: | ||
132 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
133 | + if (!glamor_priv->is_gles) { | ||
134 | *tex_format = GL_BGRA; | ||
135 | *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; | ||
136 | } else { | ||
137 | @@ -151,7 +151,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
138 | |||
139 | case PICT_x2b10g10r10: | ||
140 | case PICT_a2b10g10r10: | ||
141 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
142 | + if (!glamor_priv->is_gles) { | ||
143 | *tex_format = GL_RGBA; | ||
144 | *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; | ||
145 | } else { | ||
146 | @@ -165,7 +165,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
147 | break; | ||
148 | case PICT_b5g6r5: | ||
149 | *tex_format = GL_RGB; | ||
150 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
151 | + if (!glamor_priv->is_gles) { | ||
152 | *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV; | ||
153 | } else { | ||
154 | *tex_type = GL_UNSIGNED_SHORT_5_6_5; | ||
155 | @@ -177,7 +177,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
156 | case PICT_x1b5g5r5: | ||
157 | case PICT_a1b5g5r5: | ||
158 | *tex_format = GL_RGBA; | ||
159 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
160 | + if (!glamor_priv->is_gles) { | ||
161 | *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; | ||
162 | } else { | ||
163 | return FALSE; | ||
164 | @@ -186,7 +186,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
165 | |||
166 | case PICT_x1r5g5b5: | ||
167 | case PICT_a1r5g5b5: | ||
168 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
169 | + if (!glamor_priv->is_gles) { | ||
170 | *tex_format = GL_BGRA; | ||
171 | *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; | ||
172 | } else { | ||
173 | @@ -201,7 +201,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
174 | |||
175 | case PICT_x4r4g4b4: | ||
176 | case PICT_a4r4g4b4: | ||
177 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
178 | + if (!glamor_priv->is_gles) { | ||
179 | *tex_format = GL_BGRA; | ||
180 | *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; | ||
181 | } else { | ||
182 | @@ -213,7 +213,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
183 | |||
184 | case PICT_x4b4g4r4: | ||
185 | case PICT_a4b4g4r4: | ||
186 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { | ||
187 | + if (!glamor_priv->is_gles) { | ||
188 | *tex_format = GL_RGBA; | ||
189 | *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; | ||
190 | } else { | ||
191 | @@ -335,7 +335,7 @@ glamor_upload_picture_to_texture(PicturePtr picture) | ||
192 | stride = pixman_image_get_stride(converted_image); | ||
193 | } | ||
194 | |||
195 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) | ||
196 | + if (!glamor_priv->is_gles) | ||
197 | iformat = gl_iformat_for_pixmap(pixmap); | ||
198 | else | ||
199 | iformat = format; | ||
200 | diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c | ||
201 | index 166bde509..9aa169cdc 100644 | ||
202 | --- a/glamor/glamor_pixmap.c | ||
203 | +++ b/glamor/glamor_pixmap.c | ||
204 | @@ -124,7 +124,7 @@ glamor_set_alu(ScreenPtr screen, unsigned char alu) | ||
205 | { | ||
206 | glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
207 | |||
208 | - if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { | ||
209 | + if (glamor_priv->is_gles) { | ||
210 | if (alu != GXcopy) | ||
211 | return FALSE; | ||
212 | else | ||
213 | diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h | ||
214 | index a87caec9b..8e8433ff3 100644 | ||
215 | --- a/glamor/glamor_priv.h | ||
216 | +++ b/glamor/glamor_priv.h | ||
217 | @@ -155,11 +155,6 @@ enum gradient_shader { | ||
218 | struct glamor_screen_private; | ||
219 | struct glamor_pixmap_private; | ||
220 | |||
221 | -enum glamor_gl_flavor { | ||
222 | - GLAMOR_GL_DESKTOP, // OPENGL API | ||
223 | - GLAMOR_GL_ES2 // OPENGL ES2.0 API | ||
224 | -}; | ||
225 | - | ||
226 | #define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024) | ||
227 | |||
228 | struct glamor_saved_procs { | ||
229 | @@ -185,7 +180,7 @@ struct glamor_saved_procs { | ||
230 | }; | ||
231 | |||
232 | typedef struct glamor_screen_private { | ||
233 | - enum glamor_gl_flavor gl_flavor; | ||
234 | + Bool is_gles; | ||
235 | int glsl_version; | ||
236 | Bool has_pack_invert; | ||
237 | Bool has_fbo_blit; | ||
238 | diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c | ||
239 | index 830deb38b..b0a9d07a4 100644 | ||
240 | --- a/glamor/glamor_program.c | ||
241 | +++ b/glamor/glamor_program.c | ||
242 | @@ -459,7 +459,7 @@ glamor_set_blend(CARD8 op, glamor_program_alpha alpha, PicturePtr dst) | ||
243 | break; | ||
244 | } | ||
245 | |||
246 | - if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) | ||
247 | + if (!glamor_priv->is_gles) | ||
248 | glDisable(GL_COLOR_LOGIC_OP); | ||
249 | |||
250 | if (op == PictOpSrc) | ||
251 | diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c | ||
252 | index 6db6bfbc3..d3859e4d1 100644 | ||
253 | --- a/glamor/glamor_render.c | ||
254 | +++ b/glamor/glamor_render.c | ||
255 | @@ -1091,7 +1091,7 @@ glamor_composite_set_shader_blend(glamor_screen_private *glamor_priv, | ||
256 | } | ||
257 | } | ||
258 | |||
259 | - if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) | ||
260 | + if (!glamor_priv->is_gles) | ||
261 | glDisable(GL_COLOR_LOGIC_OP); | ||
262 | |||
263 | if (op_info->source_blend == GL_ONE && op_info->dest_blend == GL_ZERO) { | ||
264 | diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h | ||
265 | index 8a147ca7e..cbb808294 100644 | ||
266 | --- a/glamor/glamor_utils.h | ||
267 | +++ b/glamor/glamor_utils.h | ||
268 | @@ -615,13 +615,13 @@ gl_iformat_for_pixmap(PixmapPtr pixmap) | ||
269 | glamor_get_screen_private((pixmap)->drawable.pScreen); | ||
270 | glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
271 | |||
272 | - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
273 | + if (!glamor_priv->is_gles && | ||
274 | ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) { | ||
275 | return glamor_priv->one_channel_format; | ||
276 | - } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
277 | + } else if (!glamor_priv->is_gles && | ||
278 | (pixmap)->drawable.depth == 16 && pixmap_priv->is_cbcr) { | ||
279 | return GL_RG; | ||
280 | - } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && | ||
281 | + } else if (!glamor_priv->is_gles && | ||
282 | (pixmap)->drawable.depth == 30) { | ||
283 | return GL_RGB10_A2; | ||
284 | } else { | ||
285 | -- | ||
286 | 2.17.1 | ||
287 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0008-glamor-Introduce-a-central-place-for-our-pixmap-form.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0008-glamor-Introduce-a-central-place-for-our-pixmap-form.patch deleted file mode 100644 index dd82340a..00000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg/0008-glamor-Introduce-a-central-place-for-our-pixmap-form.patch +++ /dev/null | |||
@@ -1,669 +0,0 @@ | |||
1 | From b75296bee6ab3578f3a13cfb6de5d77ec02b9047 Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Anholt <eric@anholt.net> | ||
3 | Date: Tue, 26 Mar 2019 15:10:49 -0700 | ||
4 | Subject: [PATCH 8/8] glamor: Introduce a central place for our pixmap | ||
5 | format/type handling. | ||
6 | |||
7 | We had various helper functions trying to come up with the | ||
8 | internalformat/format/type/render formats for pixmaps, and it's much | ||
9 | nicer to just detect what those should be once at startup. This gives | ||
10 | us a chance to do the right thing for GLES. | ||
11 | |||
12 | It also, notably, fixes our format/type for depth 15 and 16 setup for | ||
13 | desktop GL, so that we actually allocate 16bpp (GL_RGB/565) on most | ||
14 | drivers instead of 32bpp (GL_RGB/UBYTE). | ||
15 | |||
16 | GLES still has regressions over desktop (2 regressions in llvmpipe | ||
17 | XTS, many in rendercheck), but I think this is a good baseline. | ||
18 | |||
19 | Upstream-Status: Backport | ||
20 | Signed-off-by: Eric Anholt <eric@anholt.net> | ||
21 | --- | ||
22 | glamor/glamor.c | 167 ++++++++++++++++++++++++++++++++++++-- | ||
23 | glamor/glamor_fbo.c | 16 ++-- | ||
24 | glamor/glamor_picture.c | 7 +- | ||
25 | glamor/glamor_priv.h | 22 ++++- | ||
26 | glamor/glamor_render.c | 7 +- | ||
27 | glamor/glamor_spans.c | 14 ++-- | ||
28 | glamor/glamor_transfer.c | 56 ++----------- | ||
29 | glamor/glamor_transfer.h | 3 - | ||
30 | glamor/glamor_transform.c | 5 +- | ||
31 | glamor/glamor_utils.h | 57 ------------- | ||
32 | 10 files changed, 209 insertions(+), 145 deletions(-) | ||
33 | |||
34 | diff --git a/glamor/glamor.c b/glamor/glamor.c | ||
35 | index 019edbbb1..3450113e0 100644 | ||
36 | --- a/glamor/glamor.c | ||
37 | +++ b/glamor/glamor.c | ||
38 | @@ -212,7 +212,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | ||
39 | w <= glamor_priv->glyph_max_dim && | ||
40 | h <= glamor_priv->glyph_max_dim) | ||
41 | || (w == 0 && h == 0) | ||
42 | - || !glamor_check_pixmap_fbo_depth(depth))) | ||
43 | + || !glamor_priv->formats[depth].format)) | ||
44 | return fbCreatePixmap(screen, w, h, depth, usage); | ||
45 | else | ||
46 | pixmap = fbCreatePixmap(screen, 0, 0, depth, usage); | ||
47 | @@ -440,6 +440,165 @@ glamor_setup_debug_output(ScreenPtr screen) | ||
48 | glEnable(GL_DEBUG_OUTPUT); | ||
49 | } | ||
50 | |||
51 | +const struct glamor_format * | ||
52 | +glamor_format_for_pixmap(PixmapPtr pixmap) | ||
53 | +{ | ||
54 | + ScreenPtr pScreen = pixmap->drawable.pScreen; | ||
55 | + glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen); | ||
56 | + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
57 | + | ||
58 | + if (pixmap_priv->is_cbcr) | ||
59 | + return &glamor_priv->cbcr_format; | ||
60 | + else | ||
61 | + return &glamor_priv->formats[pixmap->drawable.depth]; | ||
62 | +} | ||
63 | + | ||
64 | +static void | ||
65 | +glamor_add_format(ScreenPtr screen, int depth, CARD32 render_format, | ||
66 | + GLenum internalformat, GLenum format, GLenum type) | ||
67 | +{ | ||
68 | + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
69 | + struct glamor_format *f = &glamor_priv->formats[depth]; | ||
70 | + | ||
71 | + /* If we're trying to run on GLES, make sure that we get the read | ||
72 | + * formats that we're expecting, since glamor_transfer relies on | ||
73 | + * them matching to get data back out. To avoid this limitation, we | ||
74 | + * would need to have a more general glReadPixels() path in | ||
75 | + * glamor_transfer that re-encoded the bits to the pixel format that | ||
76 | + * we intended after. | ||
77 | + * | ||
78 | + * Note that we can't just create a pixmap because we're in | ||
79 | + * screeninit. | ||
80 | + */ | ||
81 | + if (glamor_priv->is_gles) { | ||
82 | + unsigned fbo, tex; | ||
83 | + int read_format, read_type; | ||
84 | + GLenum status; | ||
85 | + | ||
86 | + glGenTextures(1, &tex); | ||
87 | + glBindTexture(GL_TEXTURE_2D, tex); | ||
88 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||
89 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | ||
90 | + glTexImage2D(GL_TEXTURE_2D, 0, internalformat, 1, 1, 0, | ||
91 | + format, type, NULL); | ||
92 | + | ||
93 | + glGenFramebuffers(1, &fbo); | ||
94 | + glBindFramebuffer(GL_FRAMEBUFFER, fbo); | ||
95 | + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | ||
96 | + GL_TEXTURE_2D, tex, 0); | ||
97 | + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); | ||
98 | + if (status != GL_FRAMEBUFFER_COMPLETE) { | ||
99 | + ErrorF("glamor: Test fbo for depth %d incomplete. " | ||
100 | + "Falling back to software.\n", depth); | ||
101 | + glDeleteTextures(1, &tex); | ||
102 | + glDeleteFramebuffers(1, &fbo); | ||
103 | + return; | ||
104 | + } | ||
105 | + | ||
106 | + glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format); | ||
107 | + glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type); | ||
108 | + | ||
109 | + glDeleteTextures(1, &tex); | ||
110 | + glDeleteFramebuffers(1, &fbo); | ||
111 | + | ||
112 | + if (format != read_format || type != read_type) { | ||
113 | + ErrorF("glamor: Implementation returned 0x%x/0x%x read format/type " | ||
114 | + "for depth %d, expected 0x%x/0x%x. " | ||
115 | + "Falling back to software.\n", | ||
116 | + read_format, read_type, depth, format, type); | ||
117 | + return; | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | + f->depth = depth; | ||
122 | + f->render_format = render_format; | ||
123 | + f->internalformat = internalformat; | ||
124 | + f->format = format; | ||
125 | + f->type = type; | ||
126 | +} | ||
127 | + | ||
128 | +/* Set up the GL format/types that glamor will use for the various depths | ||
129 | + * | ||
130 | + * X11's pixel data doesn't have channels, but to store our data in GL | ||
131 | + * we have to pick some sort of format to move X11 pixel data in and | ||
132 | + * out with in glamor_transfer.c. For X11 core operations, other than | ||
133 | + * GL logic ops (non-GXcopy GC ops) what the driver chooses internally | ||
134 | + * doesn't matter as long as it doesn't drop any bits (we expect them | ||
135 | + * to generally expand, if anything). For Render, we can expect | ||
136 | + * clients to tend to render with PictFormats matching our channel | ||
137 | + * layouts here since ultimately X11 pixels tend to end up on the | ||
138 | + * screen. The render implementation will fall back to fb if the | ||
139 | + * channels don't match. | ||
140 | + * | ||
141 | + * Note that these formats don't affect what glamor_egl.c or | ||
142 | + * Xwayland's EGL layer choose for surfaces exposed through DRI or | ||
143 | + * scanout. For now, those layers need to match what we're choosing | ||
144 | + * here, or channels will end up swizzled around. Similarly, the | ||
145 | + * driver's visual masks also need to match what we're doing here. | ||
146 | + */ | ||
147 | +static void | ||
148 | +glamor_setup_formats(ScreenPtr screen) | ||
149 | +{ | ||
150 | + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
151 | + | ||
152 | + /* Prefer r8 textures since they're required by GLES3 and core, | ||
153 | + * only falling back to a8 if we can't do them. | ||
154 | + */ | ||
155 | + if (glamor_priv->is_gles || epoxy_has_gl_extension("GL_ARB_texture_rg")) { | ||
156 | + glamor_add_format(screen, 8, PICT_a8, | ||
157 | + GL_R8, GL_RED, GL_UNSIGNED_BYTE); | ||
158 | + } else { | ||
159 | + glamor_add_format(screen, 8, PICT_a8, | ||
160 | + GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE); | ||
161 | + } | ||
162 | + | ||
163 | + if (glamor_priv->is_gles) { | ||
164 | + /* For 15bpp, GLES supports format/type RGBA/5551, rather than | ||
165 | + * bgra/1555_rev. GL_EXT_bgra lets the impl say the color | ||
166 | + * read format/type is bgra/1555 even if we had to create it | ||
167 | + * with rgba/5551, with Mesa does. That means we can't use | ||
168 | + * the same format/type for TexSubImage and readpixels. | ||
169 | + * | ||
170 | + * Instead, just store 16 bits using the trusted 565 path, and | ||
171 | + * disable render accel for now. | ||
172 | + */ | ||
173 | + glamor_add_format(screen, 15, PICT_x1r5g5b5, | ||
174 | + GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1); | ||
175 | + } else { | ||
176 | + glamor_add_format(screen, 15, PICT_x1r5g5b5, | ||
177 | + GL_RGBA, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV); | ||
178 | + } | ||
179 | + | ||
180 | + glamor_add_format(screen, 16, PICT_r5g6b5, | ||
181 | + GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5); | ||
182 | + | ||
183 | + if (glamor_priv->is_gles) { | ||
184 | + assert(X_BYTE_ORDER == X_LITTLE_ENDIAN); | ||
185 | + glamor_add_format(screen, 24, PICT_x8b8g8r8, | ||
186 | + GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE); | ||
187 | + glamor_add_format(screen, 32, PICT_a8b8g8r8, | ||
188 | + GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE); | ||
189 | + } else { | ||
190 | + glamor_add_format(screen, 24, PICT_x8r8g8b8, | ||
191 | + GL_RGBA, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV); | ||
192 | + glamor_add_format(screen, 32, PICT_a8r8g8b8, | ||
193 | + GL_RGBA, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV); | ||
194 | + } | ||
195 | + | ||
196 | + if (glamor_priv->is_gles) { | ||
197 | + glamor_add_format(screen, 30, PICT_x2b10g10r10, | ||
198 | + GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV); | ||
199 | + } else { | ||
200 | + glamor_add_format(screen, 30, PICT_x2r10g10b10, | ||
201 | + GL_RGB10_A2, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV); | ||
202 | + } | ||
203 | + | ||
204 | + glamor_priv->cbcr_format.depth = 16; | ||
205 | + glamor_priv->cbcr_format.internalformat = GL_RG8; | ||
206 | + glamor_priv->cbcr_format.format = GL_RG; | ||
207 | + glamor_priv->cbcr_format.type = GL_UNSIGNED_BYTE; | ||
208 | +} | ||
209 | + | ||
210 | /** Set up glamor for an already-configured GL context. */ | ||
211 | Bool | ||
212 | glamor_init(ScreenPtr screen, unsigned int flags) | ||
213 | @@ -665,11 +824,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) | ||
214 | (epoxy_has_gl_extension("GL_ARB_texture_swizzle") || | ||
215 | (glamor_priv->is_gles && gl_version >= 30)); | ||
216 | |||
217 | - glamor_priv->one_channel_format = GL_ALPHA; | ||
218 | - if (epoxy_has_gl_extension("GL_ARB_texture_rg") && | ||
219 | - glamor_priv->has_texture_swizzle) { | ||
220 | - glamor_priv->one_channel_format = GL_RED; | ||
221 | - } | ||
222 | + glamor_setup_formats(screen); | ||
223 | |||
224 | glamor_set_debug_level(&glamor_debug_level); | ||
225 | |||
226 | diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c | ||
227 | index 75f7e2baa..dfb3f754d 100644 | ||
228 | --- a/glamor/glamor_fbo.c | ||
229 | +++ b/glamor/glamor_fbo.c | ||
230 | @@ -97,7 +97,7 @@ glamor_pixmap_fbo * | ||
231 | glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
232 | PixmapPtr pixmap, int w, int h, GLint tex, int flag) | ||
233 | { | ||
234 | - GLenum format = gl_iformat_for_pixmap(pixmap); | ||
235 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
236 | glamor_pixmap_fbo *fbo; | ||
237 | |||
238 | fbo = calloc(1, sizeof(*fbo)); | ||
239 | @@ -107,7 +107,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, | ||
240 | fbo->tex = tex; | ||
241 | fbo->width = w; | ||
242 | fbo->height = h; | ||
243 | - fbo->is_red = format == GL_RED; | ||
244 | + fbo->is_red = f->format == GL_RED; | ||
245 | |||
246 | if (flag != GLAMOR_CREATE_FBO_NO_FBO) { | ||
247 | if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) { | ||
248 | @@ -123,23 +123,19 @@ static int | ||
249 | _glamor_create_tex(glamor_screen_private *glamor_priv, | ||
250 | PixmapPtr pixmap, int w, int h) | ||
251 | { | ||
252 | - GLenum iformat = gl_iformat_for_pixmap(pixmap); | ||
253 | - GLenum format = iformat; | ||
254 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
255 | unsigned int tex; | ||
256 | |||
257 | - if (format == GL_RGB10_A2) | ||
258 | - format = GL_RGBA; | ||
259 | - | ||
260 | glamor_make_current(glamor_priv); | ||
261 | glGenTextures(1, &tex); | ||
262 | glBindTexture(GL_TEXTURE_2D, tex); | ||
263 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||
264 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | ||
265 | - if (format == glamor_priv->one_channel_format && format == GL_RED) | ||
266 | + if (f->format == GL_RED) | ||
267 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED); | ||
268 | glamor_priv->suppress_gl_out_of_memory_logging = true; | ||
269 | - glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, | ||
270 | - format, GL_UNSIGNED_BYTE, NULL); | ||
271 | + glTexImage2D(GL_TEXTURE_2D, 0, f->internalformat, w, h, 0, | ||
272 | + f->format, f->type, NULL); | ||
273 | glamor_priv->suppress_gl_out_of_memory_logging = false; | ||
274 | |||
275 | if (glGetError() == GL_OUT_OF_MEMORY) { | ||
276 | diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c | ||
277 | index ed2decc83..33b3bebd9 100644 | ||
278 | --- a/glamor/glamor_picture.c | ||
279 | +++ b/glamor/glamor_picture.c | ||
280 | @@ -83,7 +83,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
281 | |||
282 | switch (format) { | ||
283 | case PICT_a1: | ||
284 | - *tex_format = glamor_priv->one_channel_format; | ||
285 | + *tex_format = glamor_priv->formats[1].format; | ||
286 | *tex_type = GL_UNSIGNED_BYTE; | ||
287 | *temp_format = PICT_a8; | ||
288 | break; | ||
289 | @@ -195,7 +195,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen, | ||
290 | break; | ||
291 | |||
292 | case PICT_a8: | ||
293 | - *tex_format = glamor_priv->one_channel_format; | ||
294 | + *tex_format = glamor_priv->formats[8].format; | ||
295 | *tex_type = GL_UNSIGNED_BYTE; | ||
296 | break; | ||
297 | |||
298 | @@ -286,6 +286,7 @@ glamor_upload_picture_to_texture(PicturePtr picture) | ||
299 | Bool ret = TRUE; | ||
300 | Bool needs_swizzle; | ||
301 | pixman_image_t *converted_image = NULL; | ||
302 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
303 | |||
304 | assert(glamor_pixmap_is_memory(pixmap)); | ||
305 | assert(!pixmap_priv->fbo); | ||
306 | @@ -336,7 +337,7 @@ glamor_upload_picture_to_texture(PicturePtr picture) | ||
307 | } | ||
308 | |||
309 | if (!glamor_priv->is_gles) | ||
310 | - iformat = gl_iformat_for_pixmap(pixmap); | ||
311 | + iformat = f->internalformat; | ||
312 | else | ||
313 | iformat = format; | ||
314 | |||
315 | diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h | ||
316 | index 8e8433ff3..b8e2b932e 100644 | ||
317 | --- a/glamor/glamor_priv.h | ||
318 | +++ b/glamor/glamor_priv.h | ||
319 | @@ -157,6 +157,21 @@ struct glamor_pixmap_private; | ||
320 | |||
321 | #define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024) | ||
322 | |||
323 | +struct glamor_format { | ||
324 | + /** X Server's "depth" value */ | ||
325 | + int depth; | ||
326 | + /** GL internalformat for creating textures of this type */ | ||
327 | + GLenum internalformat; | ||
328 | + /** GL format transferring pixels in/out of textures of this type. */ | ||
329 | + GLenum format; | ||
330 | + /** GL type transferring pixels in/out of textures of this type. */ | ||
331 | + GLenum type; | ||
332 | + /* Render PICT_* matching GL's channel layout for pixels | ||
333 | + * transferred using format/type. | ||
334 | + */ | ||
335 | + CARD32 render_format; | ||
336 | +}; | ||
337 | + | ||
338 | struct glamor_saved_procs { | ||
339 | CloseScreenProcPtr close_screen; | ||
340 | CreateGCProcPtr create_gc; | ||
341 | @@ -199,7 +214,8 @@ typedef struct glamor_screen_private { | ||
342 | Bool can_copyplane; | ||
343 | int max_fbo_size; | ||
344 | |||
345 | - GLuint one_channel_format; | ||
346 | + struct glamor_format formats[33]; | ||
347 | + struct glamor_format cbcr_format; | ||
348 | |||
349 | /* glamor point shader */ | ||
350 | glamor_program point_prog; | ||
351 | @@ -537,6 +553,8 @@ void glamor_pixmap_destroy_fbo(PixmapPtr pixmap); | ||
352 | Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap); | ||
353 | void glamor_pixmap_clear_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo); | ||
354 | |||
355 | +const struct glamor_format *glamor_format_for_pixmap(PixmapPtr pixmap); | ||
356 | + | ||
357 | /* Return whether 'picture' is alpha-only */ | ||
358 | static inline Bool glamor_picture_is_alpha(PicturePtr picture) | ||
359 | { | ||
360 | @@ -549,7 +567,7 @@ glamor_picture_red_is_alpha(PicturePtr picture) | ||
361 | { | ||
362 | /* True when the picture is alpha only and the screen is using GL_RED for alpha pictures */ | ||
363 | return glamor_picture_is_alpha(picture) && | ||
364 | - glamor_get_screen_private(picture->pDrawable->pScreen)->one_channel_format == GL_RED; | ||
365 | + glamor_get_screen_private(picture->pDrawable->pScreen)->formats[8].format == GL_RED; | ||
366 | } | ||
367 | |||
368 | void glamor_bind_texture(glamor_screen_private *glamor_priv, | ||
369 | diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c | ||
370 | index d3859e4d1..a8dc3924b 100644 | ||
371 | --- a/glamor/glamor_render.c | ||
372 | +++ b/glamor/glamor_render.c | ||
373 | @@ -772,12 +772,15 @@ static Bool | ||
374 | glamor_render_format_is_supported(PicturePtr picture) | ||
375 | { | ||
376 | PictFormatShort storage_format; | ||
377 | + glamor_screen_private *glamor_priv; | ||
378 | |||
379 | /* Source-only pictures should always work */ | ||
380 | if (!picture->pDrawable) | ||
381 | return TRUE; | ||
382 | |||
383 | - storage_format = format_for_depth(picture->pDrawable->depth); | ||
384 | + glamor_priv = glamor_get_screen_private(picture->pDrawable->pScreen); | ||
385 | + storage_format = | ||
386 | + glamor_priv->formats[picture->pDrawable->depth].render_format; | ||
387 | |||
388 | switch (picture->format) { | ||
389 | case PICT_x2r10g10b10: | ||
390 | @@ -898,7 +901,7 @@ glamor_composite_choose_shader(CARD8 op, | ||
391 | } | ||
392 | |||
393 | if (dest_pixmap->drawable.bitsPerPixel <= 8 && | ||
394 | - glamor_priv->one_channel_format == GL_RED) { | ||
395 | + glamor_priv->formats[8].format == GL_RED) { | ||
396 | key.dest_swizzle = SHADER_DEST_SWIZZLE_ALPHA_TO_RED; | ||
397 | } else { | ||
398 | key.dest_swizzle = SHADER_DEST_SWIZZLE_DEFAULT; | ||
399 | diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c | ||
400 | index b3c028d67..b5f297d2f 100644 | ||
401 | --- a/glamor/glamor_spans.c | ||
402 | +++ b/glamor/glamor_spans.c | ||
403 | @@ -187,9 +187,8 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax, | ||
404 | int box_index; | ||
405 | int n; | ||
406 | char *d; | ||
407 | - GLenum type; | ||
408 | - GLenum format; | ||
409 | int off_x, off_y; | ||
410 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
411 | |||
412 | pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
413 | if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) | ||
414 | @@ -197,8 +196,6 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax, | ||
415 | |||
416 | glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); | ||
417 | |||
418 | - glamor_format_for_pixmap(pixmap, &format, &type); | ||
419 | - | ||
420 | glamor_make_current(glamor_priv); | ||
421 | |||
422 | glamor_pixmap_loop(pixmap_priv, box_index) { | ||
423 | @@ -234,7 +231,8 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax, | ||
424 | if (y >= box->y2) | ||
425 | continue; | ||
426 | |||
427 | - glReadPixels(x1 - box->x1, y - box->y1, x2 - x1, 1, format, type, l); | ||
428 | + glReadPixels(x1 - box->x1, y - box->y1, x2 - x1, 1, | ||
429 | + f->format, f->type, l); | ||
430 | } | ||
431 | } | ||
432 | |||
433 | @@ -269,11 +267,10 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src, | ||
434 | glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); | ||
435 | PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); | ||
436 | glamor_pixmap_private *pixmap_priv; | ||
437 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
438 | int box_index; | ||
439 | int n; | ||
440 | char *s; | ||
441 | - GLenum type; | ||
442 | - GLenum format; | ||
443 | int off_x, off_y; | ||
444 | |||
445 | pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
446 | @@ -287,7 +284,6 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src, | ||
447 | goto bail; | ||
448 | |||
449 | glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); | ||
450 | - glamor_format_for_pixmap(pixmap, &format, &type); | ||
451 | |||
452 | glamor_make_current(glamor_priv); | ||
453 | |||
454 | @@ -348,7 +344,7 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src, | ||
455 | |||
456 | glTexSubImage2D(GL_TEXTURE_2D, 0, | ||
457 | x1 - box->x1, y1 - box->y1, x2 - x1, 1, | ||
458 | - format, type, | ||
459 | + f->format, f->type, | ||
460 | l); | ||
461 | } | ||
462 | s += PixmapBytePad(w, drawable->depth); | ||
463 | diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c | ||
464 | index 215752d7b..e706e0fb4 100644 | ||
465 | --- a/glamor/glamor_transfer.c | ||
466 | +++ b/glamor/glamor_transfer.c | ||
467 | @@ -23,44 +23,6 @@ | ||
468 | #include "glamor_priv.h" | ||
469 | #include "glamor_transfer.h" | ||
470 | |||
471 | -/* XXX a kludge for now */ | ||
472 | -void | ||
473 | -glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) | ||
474 | -{ | ||
475 | - glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||
476 | - switch (pixmap->drawable.depth) { | ||
477 | - case 24: | ||
478 | - case 32: | ||
479 | - *format = GL_BGRA; | ||
480 | - *type = GL_UNSIGNED_INT_8_8_8_8_REV; | ||
481 | - break; | ||
482 | - case 30: | ||
483 | - *format = GL_BGRA; | ||
484 | - *type = GL_UNSIGNED_INT_2_10_10_10_REV; | ||
485 | - break; | ||
486 | - case 16: | ||
487 | - if (priv->is_cbcr) { | ||
488 | - *format = GL_RG; | ||
489 | - *type = GL_UNSIGNED_BYTE; | ||
490 | - } else { | ||
491 | - *format = GL_RGB; | ||
492 | - *type = GL_UNSIGNED_SHORT_5_6_5; | ||
493 | - } | ||
494 | - break; | ||
495 | - case 15: | ||
496 | - *format = GL_BGRA; | ||
497 | - *type = GL_UNSIGNED_SHORT_1_5_5_5_REV; | ||
498 | - break; | ||
499 | - case 8: | ||
500 | - *format = glamor_get_screen_private(pixmap->drawable.pScreen)->one_channel_format; | ||
501 | - *type = GL_UNSIGNED_BYTE; | ||
502 | - break; | ||
503 | - default: | ||
504 | - FatalError("Invalid pixmap depth %d\n", pixmap->drawable.depth); | ||
505 | - break; | ||
506 | - } | ||
507 | -} | ||
508 | - | ||
509 | /* | ||
510 | * Write a region of bits into a pixmap | ||
511 | */ | ||
512 | @@ -75,10 +37,7 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, | ||
513 | glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||
514 | int box_index; | ||
515 | int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3; | ||
516 | - GLenum type; | ||
517 | - GLenum format; | ||
518 | - | ||
519 | - glamor_format_for_pixmap(pixmap, &format, &type); | ||
520 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
521 | |||
522 | glamor_make_current(glamor_priv); | ||
523 | |||
524 | @@ -116,14 +75,14 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, | ||
525 | glTexSubImage2D(GL_TEXTURE_2D, 0, | ||
526 | x1 - box->x1, y1 - box->y1, | ||
527 | x2 - x1, y2 - y1, | ||
528 | - format, type, | ||
529 | + f->format, f->type, | ||
530 | bits + ofs); | ||
531 | } else { | ||
532 | for (; y1 < y2; y1++, ofs += byte_stride) | ||
533 | glTexSubImage2D(GL_TEXTURE_2D, 0, | ||
534 | x1 - box->x1, y1 - box->y1, | ||
535 | x2 - x1, 1, | ||
536 | - format, type, | ||
537 | + f->format, f->type, | ||
538 | bits + ofs); | ||
539 | } | ||
540 | } | ||
541 | @@ -178,10 +137,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, | ||
542 | glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||
543 | int box_index; | ||
544 | int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3; | ||
545 | - GLenum type; | ||
546 | - GLenum format; | ||
547 | - | ||
548 | - glamor_format_for_pixmap(pixmap, &format, &type); | ||
549 | + const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||
550 | |||
551 | glamor_make_current(glamor_priv); | ||
552 | |||
553 | @@ -216,10 +172,10 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, | ||
554 | |||
555 | if (glamor_priv->has_pack_subimage || | ||
556 | x2 - x1 == byte_stride / bytes_per_pixel) { | ||
557 | - glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs); | ||
558 | + glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, f->format, f->type, bits + ofs); | ||
559 | } else { | ||
560 | for (; y1 < y2; y1++, ofs += byte_stride) | ||
561 | - glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs); | ||
562 | + glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, f->format, f->type, bits + ofs); | ||
563 | } | ||
564 | } | ||
565 | } | ||
566 | diff --git a/glamor/glamor_transfer.h b/glamor/glamor_transfer.h | ||
567 | index de8186a70..a6137b3ff 100644 | ||
568 | --- a/glamor/glamor_transfer.h | ||
569 | +++ b/glamor/glamor_transfer.h | ||
570 | @@ -23,9 +23,6 @@ | ||
571 | #ifndef _GLAMOR_TRANSFER_H_ | ||
572 | #define _GLAMOR_TRANSFER_H_ | ||
573 | |||
574 | -void | ||
575 | -glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type); | ||
576 | - | ||
577 | void | ||
578 | glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, | ||
579 | int dx_src, int dy_src, | ||
580 | diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c | ||
581 | index 2d5a634a8..348d00be1 100644 | ||
582 | --- a/glamor/glamor_transform.c | ||
583 | +++ b/glamor/glamor_transform.c | ||
584 | @@ -121,10 +121,9 @@ glamor_set_color_depth(ScreenPtr pScreen, | ||
585 | |||
586 | glamor_get_rgba_from_pixel(pixel, | ||
587 | &color[0], &color[1], &color[2], &color[3], | ||
588 | - format_for_depth(depth)); | ||
589 | + glamor_priv->formats[depth].render_format); | ||
590 | |||
591 | - if ((depth == 1 || depth == 8) && | ||
592 | - glamor_priv->one_channel_format == GL_RED) | ||
593 | + if ((depth <= 8) && glamor_priv->formats[8].format == GL_RED) | ||
594 | color[0] = color[3]; | ||
595 | |||
596 | glUniform4fv(uniform, 1, color); | ||
597 | diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h | ||
598 | index cbb808294..651faf2fe 100644 | ||
599 | --- a/glamor/glamor_utils.h | ||
600 | +++ b/glamor/glamor_utils.h | ||
601 | @@ -570,65 +570,8 @@ | ||
602 | && (_w_) <= _glamor_->max_fbo_size \ | ||
603 | && (_h_) <= _glamor_->max_fbo_size) | ||
604 | |||
605 | -/* For 1bpp pixmap, we don't store it as texture. */ | ||
606 | -#define glamor_check_pixmap_fbo_depth(_depth_) ( \ | ||
607 | - _depth_ == 8 \ | ||
608 | - || _depth_ == 15 \ | ||
609 | - || _depth_ == 16 \ | ||
610 | - || _depth_ == 24 \ | ||
611 | - || _depth_ == 30 \ | ||
612 | - || _depth_ == 32) | ||
613 | - | ||
614 | #define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL) | ||
615 | |||
616 | -/** | ||
617 | - * Borrow from uxa. | ||
618 | - */ | ||
619 | -static inline CARD32 | ||
620 | -format_for_depth(int depth) | ||
621 | -{ | ||
622 | - switch (depth) { | ||
623 | - case 1: | ||
624 | - return PICT_a1; | ||
625 | - case 4: | ||
626 | - return PICT_a4; | ||
627 | - case 8: | ||
628 | - return PICT_a8; | ||
629 | - case 15: | ||
630 | - return PICT_x1r5g5b5; | ||
631 | - case 16: | ||
632 | - return PICT_r5g6b5; | ||
633 | - default: | ||
634 | - case 24: | ||
635 | - return PICT_x8r8g8b8; | ||
636 | - case 30: | ||
637 | - return PICT_x2r10g10b10; | ||
638 | - case 32: | ||
639 | - return PICT_a8r8g8b8; | ||
640 | - } | ||
641 | -} | ||
642 | - | ||
643 | -static inline GLenum | ||
644 | -gl_iformat_for_pixmap(PixmapPtr pixmap) | ||
645 | -{ | ||
646 | - glamor_screen_private *glamor_priv = | ||
647 | - glamor_get_screen_private((pixmap)->drawable.pScreen); | ||
648 | - glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||
649 | - | ||
650 | - if (!glamor_priv->is_gles && | ||
651 | - ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) { | ||
652 | - return glamor_priv->one_channel_format; | ||
653 | - } else if (!glamor_priv->is_gles && | ||
654 | - (pixmap)->drawable.depth == 16 && pixmap_priv->is_cbcr) { | ||
655 | - return GL_RG; | ||
656 | - } else if (!glamor_priv->is_gles && | ||
657 | - (pixmap)->drawable.depth == 30) { | ||
658 | - return GL_RGB10_A2; | ||
659 | - } else { | ||
660 | - return GL_RGBA; | ||
661 | - } | ||
662 | -} | ||
663 | - | ||
664 | #define REVERT_NONE 0 | ||
665 | #define REVERT_NORMAL 1 | ||
666 | #define REVERT_UPLOADING_A1 3 | ||
667 | -- | ||
668 | 2.17.1 | ||
669 | |||
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend b/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend index c956245b..161df049 100644 --- a/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend +++ b/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend | |||
@@ -1,21 +1,6 @@ | |||
1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" | 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" |
2 | 2 | ||
3 | SRC_URI:append:use-mainline-bsp = " file://0001-Allow-to-enable-atomic-in-modesetting-DDX.patch" | 3 | SRC_URI:append:use-mainline-bsp = " file://0001-Allow-to-enable-atomic-in-modesetting-DDX.patch" |
4 | SRC_URI:append:imxgpu = " \ | ||
5 | file://0003-Remove-check-for-useSIGIO-option.patch \ | ||
6 | file://0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch \ | ||
7 | file://0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch \ | ||
8 | file://0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch \ | ||
9 | file://0001-hw-xwayland-Makefile.am-fix-build-without-glx.patch \ | ||
10 | file://0001-xfree86-define-FOURCC_NV12-and-XVIMAGE_NV12.patch \ | ||
11 | file://0002-glamor-add-support-for-GL_RG.patch \ | ||
12 | file://0003-glamor-add-support-for-NV12-in-Xv.patch \ | ||
13 | file://0004-glamor-Remove-unused-format_for_pixmap-helper.patch \ | ||
14 | file://0005-glamor-Stop-trying-to-store-the-pixmap-s-format-in-g.patch \ | ||
15 | file://0006-glamor-Plumb-the-pixmap-through-fbo-creation-instead.patch \ | ||
16 | file://0007-glamor-Switch-the-gl_flavor-to-a-boolean-is_gles.patch \ | ||
17 | file://0008-glamor-Introduce-a-central-place-for-our-pixmap-form.patch \ | ||
18 | " | ||
19 | 4 | ||
20 | IMX_OPENGL_PKGCONFIGS_REMOVE = "" | 5 | IMX_OPENGL_PKGCONFIGS_REMOVE = "" |
21 | IMX_OPENGL_PKGCONFIGS_REMOVE:imxgpu = "glamor" | 6 | IMX_OPENGL_PKGCONFIGS_REMOVE:imxgpu = "glamor" |