summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Thode <prometheanfire@gentoo.org>2022-02-02 18:22:32 -0600
committerMatthew Thode <prometheanfire@gentoo.org>2022-02-02 18:22:39 -0600
commitb990b01d70bfb34745d7fb1e477377445f6c13cd (patch)
tree1dc426e5917022e295d88a4dab7fa2f030b0e417 /gui-libs
parentsci-mathematics/giac: remove old "unused" giac-1.7.0.45.ebuild. (diff)
downloadgentoo-b990b01d70bfb34745d7fb1e477377445f6c13cd.tar.gz
gentoo-b990b01d70bfb34745d7fb1e477377445f6c13cd.tar.bz2
gentoo-b990b01d70bfb34745d7fb1e477377445f6c13cd.zip
gui-libs/wlroots: fix gles on nvidia
upstream https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/59b9518f Closes: https://bugs.gentoo.org/832005 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Matthew Thode <prometheanfire@gentoo.org>
Diffstat (limited to 'gui-libs')
-rw-r--r--gui-libs/wlroots/files/0.15.0-59b9518f.patch88
-rw-r--r--gui-libs/wlroots/wlroots-0.15.0-r2.ebuild75
2 files changed, 163 insertions, 0 deletions
diff --git a/gui-libs/wlroots/files/0.15.0-59b9518f.patch b/gui-libs/wlroots/files/0.15.0-59b9518f.patch
new file mode 100644
index 000000000000..95ca0becd618
--- /dev/null
+++ b/gui-libs/wlroots/files/0.15.0-59b9518f.patch
@@ -0,0 +1,88 @@
+From 59b9518f072527ac59593e51df7f5d5331a34f0e Mon Sep 17 00:00:00 2001
+From: Thomas Hebb <tommyhebb@gmail.com>
+Date: Wed, 5 Jan 2022 00:16:59 -0800
+Subject: [PATCH] render/gles2: don't constrain shm formats to ones that
+ support reading
+
+commit 44e8451cd93e ("render/gles2: hide shm formats without GL
+support") added the is_gles2_pixel_format_supported() function to
+render/gles2/pixel_format.c, whose stated purpose is to "check whether
+the renderer has the needed GL extensions to read a given pixel format."
+It then used that function to filter the pixel formats returned by
+get_gles2_shm_formats().
+
+The result of this change is that RGB formats are no longer reported for
+GL drivers that don't implement EXT_read_format_bgra, even when those
+formats are supported for rendering (which they have to be for
+wlr_gles2_renderer_create() to succeed). This is a pretty clear
+regression, since wlr_renderer_init_wl_shm() fails when either of
+WL_SHM_FORMAT_ARGB8888 or WL_SHM_FORMAT_XRGB8888 are missing.
+
+To fix the regression, change is_gles2_pixel_format_supported() to
+accept all pixel formats that support rendering, regardless of whether
+we can read them or not, and move the check for EXT_read_format_bgra
+back into gles2_read_pixels(). (There's already a check for this
+extension in gles2_preferred_read_format(), so we're not breaking any
+abstraction that wasn't already broken.)
+
+Tested on the NVIDIA 495.46 proprietary driver, which doesn't support
+EXT_read_format_bgra.
+
+Fixes: 44e8451cd93e ("render/gles2: hide shm formats without GL support")
+---
+ render/gles2/pixel_format.c | 14 ++++++++++----
+ render/gles2/renderer.c | 6 ++++++
+ 2 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c
+index 31bb3908..b155bbbe 100644
+--- a/render/gles2/pixel_format.c
++++ b/render/gles2/pixel_format.c
+@@ -98,6 +98,10 @@ static const struct wlr_gles2_pixel_format formats[] = {
+
+ // TODO: more pixel formats
+
++/*
++ * Return true if supported for texturing, even if other operations like
++ * reading aren't supported.
++ */
+ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
+ const struct wlr_gles2_pixel_format *format) {
+ if (format->gl_type == GL_UNSIGNED_INT_2_10_10_10_REV_EXT
+@@ -108,10 +112,12 @@ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
+ && !renderer->exts.OES_texture_half_float_linear) {
+ return false;
+ }
+- if (format->gl_format == GL_BGRA_EXT
+- && !renderer->exts.EXT_read_format_bgra) {
+- return false;
+- }
++ /*
++ * Note that we don't need to check for GL_EXT_texture_format_BGRA8888
++ * here, since we've already checked if we have it at renderer creation
++ * time and bailed out if not. We do the check there because Wayland
++ * requires all compositors to support SHM buffers in that format.
++ */
+ return true;
+ }
+
+diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
+index 527d85bf..67b8ead4 100644
+--- a/render/gles2/renderer.c
++++ b/render/gles2/renderer.c
+@@ -441,6 +441,12 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
+ return false;
+ }
+
++ if (fmt->gl_format == GL_BGRA_EXT && !renderer->exts.EXT_read_format_bgra) {
++ wlr_log(WLR_ERROR,
++ "Cannot read pixels: missing GL_EXT_read_format_bgra extension");
++ return false;
++ }
++
+ const struct wlr_pixel_format_info *drm_fmt =
+ drm_get_pixel_format_info(fmt->drm_format);
+ assert(drm_fmt);
+--
+GitLab
+
diff --git a/gui-libs/wlroots/wlroots-0.15.0-r2.ebuild b/gui-libs/wlroots/wlroots-0.15.0-r2.ebuild
new file mode 100644
index 000000000000..75badbe1a0bc
--- /dev/null
+++ b/gui-libs/wlroots/wlroots-0.15.0-r2.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit meson
+
+DESCRIPTION="Pluggable, composable, unopinionated modules for building a Wayland compositor"
+HOMEPAGE="https://gitlab.freedesktop.org/wlroots/wlroots"
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/${PN}/${PN}.git"
+ inherit git-r3
+ SLOT="0/9999"
+else
+ SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+ SLOT="0/15"
+fi
+
+LICENSE="MIT"
+IUSE="vulkan x11-backend X"
+
+DEPEND="
+ >=dev-libs/libinput-1.14.0:0=
+ >=dev-libs/wayland-1.20.0
+ >=dev-libs/wayland-protocols-1.24
+ media-libs/mesa[egl(+),gles2,gbm(+)]
+ sys-auth/seatd:=
+ virtual/libudev
+ vulkan? (
+ dev-util/glslang:0=
+ dev-util/vulkan-headers:0=
+ media-libs/vulkan-loader:0=
+ )
+ >=x11-libs/libdrm-2.4.109:0=
+ x11-libs/libxkbcommon
+ x11-libs/pixman
+ x11-backend? ( x11-libs/libxcb:0= )
+ X? (
+ x11-base/xwayland
+ x11-libs/libxcb:0=
+ x11-libs/xcb-util-image
+ x11-libs/xcb-util-wm
+ )
+"
+RDEPEND="
+ ${DEPEND}
+"
+BDEPEND="
+ >=dev-libs/wayland-protocols-1.24
+ >=dev-util/meson-0.60.0
+ virtual/pkgconfig
+"
+
+PATCHES=( "${FILESDIR}/0.15.0-59b9518f.patch" )
+
+src_configure() {
+ # xcb-util-errors is not on Gentoo Repository (and upstream seems inactive?)
+ local emesonargs=(
+ "-Dxcb-errors=disabled"
+ "-Dexamples=false"
+ "-Dwerror=false"
+ -Drenderers=$(usex vulkan 'gles2,vulkan' gles2)
+ -Dxwayland=$(usex X enabled disabled)
+ -Dbackends=drm,libinput$(usex x11-backend ',x11' '')
+ )
+
+ meson_src_configure
+}
+
+pkg_postinst() {
+ elog "You must be in the input group to allow your compositor"
+ elog "to access input devices via libinput."
+}