1 |
commit: b990b01d70bfb34745d7fb1e477377445f6c13cd |
2 |
Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 3 00:22:32 2022 +0000 |
4 |
Commit: Matthew Thode <prometheanfire <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 3 00:22:39 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b990b01d |
7 |
|
8 |
gui-libs/wlroots: fix gles on nvidia |
9 |
|
10 |
upstream https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/59b9518f |
11 |
|
12 |
Closes: https://bugs.gentoo.org/832005 |
13 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
14 |
Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org> |
15 |
|
16 |
gui-libs/wlroots/files/0.15.0-59b9518f.patch | 88 ++++++++++++++++++++++++++++ |
17 |
gui-libs/wlroots/wlroots-0.15.0-r2.ebuild | 75 ++++++++++++++++++++++++ |
18 |
2 files changed, 163 insertions(+) |
19 |
|
20 |
diff --git a/gui-libs/wlroots/files/0.15.0-59b9518f.patch b/gui-libs/wlroots/files/0.15.0-59b9518f.patch |
21 |
new file mode 100644 |
22 |
index 000000000000..95ca0becd618 |
23 |
--- /dev/null |
24 |
+++ b/gui-libs/wlroots/files/0.15.0-59b9518f.patch |
25 |
@@ -0,0 +1,88 @@ |
26 |
+From 59b9518f072527ac59593e51df7f5d5331a34f0e Mon Sep 17 00:00:00 2001 |
27 |
+From: Thomas Hebb <tommyhebb@×××××.com> |
28 |
+Date: Wed, 5 Jan 2022 00:16:59 -0800 |
29 |
+Subject: [PATCH] render/gles2: don't constrain shm formats to ones that |
30 |
+ support reading |
31 |
+ |
32 |
+commit 44e8451cd93e ("render/gles2: hide shm formats without GL |
33 |
+support") added the is_gles2_pixel_format_supported() function to |
34 |
+render/gles2/pixel_format.c, whose stated purpose is to "check whether |
35 |
+the renderer has the needed GL extensions to read a given pixel format." |
36 |
+It then used that function to filter the pixel formats returned by |
37 |
+get_gles2_shm_formats(). |
38 |
+ |
39 |
+The result of this change is that RGB formats are no longer reported for |
40 |
+GL drivers that don't implement EXT_read_format_bgra, even when those |
41 |
+formats are supported for rendering (which they have to be for |
42 |
+wlr_gles2_renderer_create() to succeed). This is a pretty clear |
43 |
+regression, since wlr_renderer_init_wl_shm() fails when either of |
44 |
+WL_SHM_FORMAT_ARGB8888 or WL_SHM_FORMAT_XRGB8888 are missing. |
45 |
+ |
46 |
+To fix the regression, change is_gles2_pixel_format_supported() to |
47 |
+accept all pixel formats that support rendering, regardless of whether |
48 |
+we can read them or not, and move the check for EXT_read_format_bgra |
49 |
+back into gles2_read_pixels(). (There's already a check for this |
50 |
+extension in gles2_preferred_read_format(), so we're not breaking any |
51 |
+abstraction that wasn't already broken.) |
52 |
+ |
53 |
+Tested on the NVIDIA 495.46 proprietary driver, which doesn't support |
54 |
+EXT_read_format_bgra. |
55 |
+ |
56 |
+Fixes: 44e8451cd93e ("render/gles2: hide shm formats without GL support") |
57 |
+--- |
58 |
+ render/gles2/pixel_format.c | 14 ++++++++++---- |
59 |
+ render/gles2/renderer.c | 6 ++++++ |
60 |
+ 2 files changed, 16 insertions(+), 4 deletions(-) |
61 |
+ |
62 |
+diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c |
63 |
+index 31bb3908..b155bbbe 100644 |
64 |
+--- a/render/gles2/pixel_format.c |
65 |
++++ b/render/gles2/pixel_format.c |
66 |
+@@ -98,6 +98,10 @@ static const struct wlr_gles2_pixel_format formats[] = { |
67 |
+ |
68 |
+ // TODO: more pixel formats |
69 |
+ |
70 |
++/* |
71 |
++ * Return true if supported for texturing, even if other operations like |
72 |
++ * reading aren't supported. |
73 |
++ */ |
74 |
+ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer, |
75 |
+ const struct wlr_gles2_pixel_format *format) { |
76 |
+ if (format->gl_type == GL_UNSIGNED_INT_2_10_10_10_REV_EXT |
77 |
+@@ -108,10 +112,12 @@ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer, |
78 |
+ && !renderer->exts.OES_texture_half_float_linear) { |
79 |
+ return false; |
80 |
+ } |
81 |
+- if (format->gl_format == GL_BGRA_EXT |
82 |
+- && !renderer->exts.EXT_read_format_bgra) { |
83 |
+- return false; |
84 |
+- } |
85 |
++ /* |
86 |
++ * Note that we don't need to check for GL_EXT_texture_format_BGRA8888 |
87 |
++ * here, since we've already checked if we have it at renderer creation |
88 |
++ * time and bailed out if not. We do the check there because Wayland |
89 |
++ * requires all compositors to support SHM buffers in that format. |
90 |
++ */ |
91 |
+ return true; |
92 |
+ } |
93 |
+ |
94 |
+diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c |
95 |
+index 527d85bf..67b8ead4 100644 |
96 |
+--- a/render/gles2/renderer.c |
97 |
++++ b/render/gles2/renderer.c |
98 |
+@@ -441,6 +441,12 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer, |
99 |
+ return false; |
100 |
+ } |
101 |
+ |
102 |
++ if (fmt->gl_format == GL_BGRA_EXT && !renderer->exts.EXT_read_format_bgra) { |
103 |
++ wlr_log(WLR_ERROR, |
104 |
++ "Cannot read pixels: missing GL_EXT_read_format_bgra extension"); |
105 |
++ return false; |
106 |
++ } |
107 |
++ |
108 |
+ const struct wlr_pixel_format_info *drm_fmt = |
109 |
+ drm_get_pixel_format_info(fmt->drm_format); |
110 |
+ assert(drm_fmt); |
111 |
+-- |
112 |
+GitLab |
113 |
+ |
114 |
|
115 |
diff --git a/gui-libs/wlroots/wlroots-0.15.0-r2.ebuild b/gui-libs/wlroots/wlroots-0.15.0-r2.ebuild |
116 |
new file mode 100644 |
117 |
index 000000000000..75badbe1a0bc |
118 |
--- /dev/null |
119 |
+++ b/gui-libs/wlroots/wlroots-0.15.0-r2.ebuild |
120 |
@@ -0,0 +1,75 @@ |
121 |
+# Copyright 1999-2022 Gentoo Authors |
122 |
+# Distributed under the terms of the GNU General Public License v2 |
123 |
+ |
124 |
+EAPI=7 |
125 |
+ |
126 |
+inherit meson |
127 |
+ |
128 |
+DESCRIPTION="Pluggable, composable, unopinionated modules for building a Wayland compositor" |
129 |
+HOMEPAGE="https://gitlab.freedesktop.org/wlroots/wlroots" |
130 |
+ |
131 |
+if [[ ${PV} == 9999 ]]; then |
132 |
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/${PN}/${PN}.git" |
133 |
+ inherit git-r3 |
134 |
+ SLOT="0/9999" |
135 |
+else |
136 |
+ SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.gz" |
137 |
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86" |
138 |
+ SLOT="0/15" |
139 |
+fi |
140 |
+ |
141 |
+LICENSE="MIT" |
142 |
+IUSE="vulkan x11-backend X" |
143 |
+ |
144 |
+DEPEND=" |
145 |
+ >=dev-libs/libinput-1.14.0:0= |
146 |
+ >=dev-libs/wayland-1.20.0 |
147 |
+ >=dev-libs/wayland-protocols-1.24 |
148 |
+ media-libs/mesa[egl(+),gles2,gbm(+)] |
149 |
+ sys-auth/seatd:= |
150 |
+ virtual/libudev |
151 |
+ vulkan? ( |
152 |
+ dev-util/glslang:0= |
153 |
+ dev-util/vulkan-headers:0= |
154 |
+ media-libs/vulkan-loader:0= |
155 |
+ ) |
156 |
+ >=x11-libs/libdrm-2.4.109:0= |
157 |
+ x11-libs/libxkbcommon |
158 |
+ x11-libs/pixman |
159 |
+ x11-backend? ( x11-libs/libxcb:0= ) |
160 |
+ X? ( |
161 |
+ x11-base/xwayland |
162 |
+ x11-libs/libxcb:0= |
163 |
+ x11-libs/xcb-util-image |
164 |
+ x11-libs/xcb-util-wm |
165 |
+ ) |
166 |
+" |
167 |
+RDEPEND=" |
168 |
+ ${DEPEND} |
169 |
+" |
170 |
+BDEPEND=" |
171 |
+ >=dev-libs/wayland-protocols-1.24 |
172 |
+ >=dev-util/meson-0.60.0 |
173 |
+ virtual/pkgconfig |
174 |
+" |
175 |
+ |
176 |
+PATCHES=( "${FILESDIR}/0.15.0-59b9518f.patch" ) |
177 |
+ |
178 |
+src_configure() { |
179 |
+ # xcb-util-errors is not on Gentoo Repository (and upstream seems inactive?) |
180 |
+ local emesonargs=( |
181 |
+ "-Dxcb-errors=disabled" |
182 |
+ "-Dexamples=false" |
183 |
+ "-Dwerror=false" |
184 |
+ -Drenderers=$(usex vulkan 'gles2,vulkan' gles2) |
185 |
+ -Dxwayland=$(usex X enabled disabled) |
186 |
+ -Dbackends=drm,libinput$(usex x11-backend ',x11' '') |
187 |
+ ) |
188 |
+ |
189 |
+ meson_src_configure |
190 |
+} |
191 |
+ |
192 |
+pkg_postinst() { |
193 |
+ elog "You must be in the input group to allow your compositor" |
194 |
+ elog "to access input devices via libinput." |
195 |
+} |