commit:     0067859eefa40b1f2b58faaa2a053df48787e7ef
Author:     Julien Roy <julien <AT> jroy <DOT> ca>
AuthorDate: Sun May  7 18:14:54 2023 +0000
Commit:     Julien Roy <julien <AT> jroy <DOT> ca>
CommitDate: Sun May  7 18:15:09 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0067859e

gui-wm/hyprland: add nvidia patch

Signed-off-by: Julien Roy <julien <AT> jroy.ca>

 gui-wm/hyprland/files/0.21.0-meson.patch  | 13 ----------
 gui-wm/hyprland/files/nvidia-0.25.0.patch | 41 +++++++++++++++++++++++++++++++
 gui-wm/hyprland/hyprland-0.25.0.ebuild    | 10 ++++++--
 3 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/gui-wm/hyprland/files/0.21.0-meson.patch 
b/gui-wm/hyprland/files/0.21.0-meson.patch
deleted file mode 100644
index 30664610e..000000000
--- a/gui-wm/hyprland/files/0.21.0-meson.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/protocols/meson.build b/protocols/meson.build
-index 9d47e0a..c082845 100644
---- a/protocols/meson.build
-+++ b/protocols/meson.build
-@@ -29,7 +29,7 @@ protocols = [
-   ['pointer-constraints-unstable-v1.xml'],
-   ['tablet-unstable-v2.xml'],
-   ['idle.xml'],
--  [hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml']
-+  ['hyprland-toplevel-export-v1.xml']
- ]
- wl_protos_src = []
- wl_protos_headers = []

diff --git a/gui-wm/hyprland/files/nvidia-0.25.0.patch 
b/gui-wm/hyprland/files/nvidia-0.25.0.patch
new file mode 100644
index 000000000..f83258b3c
--- /dev/null
+++ b/gui-wm/hyprland/files/nvidia-0.25.0.patch
@@ -0,0 +1,41 @@
+diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
+index 6a86b183..823fc318 100644
+--- a/render/gles2/renderer.c
++++ b/render/gles2/renderer.c
+@@ -165,7 +165,7 @@ static bool gles2_bind_buffer(struct wlr_renderer 
*wlr_renderer,
+               assert(wlr_egl_is_current(renderer->egl));
+ 
+               push_gles2_debug(renderer);
+-              glFlush();
++              glFinish();
+               glBindFramebuffer(GL_FRAMEBUFFER, 0);
+               pop_gles2_debug(renderer);
+ 
+diff --git a/types/output/render.c b/types/output/render.c
+index ed1afa4a..ddc730c7 100644
+--- a/types/output/render.c
++++ b/types/output/render.c
+@@ -225,22 +225,7 @@ struct wlr_drm_format *output_pick_format(struct 
wlr_output *output,
+ }
+ 
+ uint32_t wlr_output_preferred_read_format(struct wlr_output *output) {
+-      struct wlr_renderer *renderer = output->renderer;
+-      assert(renderer != NULL);
+-
+-      if (!renderer->impl->preferred_read_format || 
!renderer->impl->read_pixels) {
+-              return DRM_FORMAT_INVALID;
+-      }
+-
+-      if (!output_attach_back_buffer(output, &output->pending, NULL)) {
+-              return false;
+-      }
+-
+-      uint32_t fmt = renderer->impl->preferred_read_format(renderer);
+-
+-      output_clear_back_buffer(output);
+-
+-      return fmt;
++      return DRM_FORMAT_XRGB8888;
+ }
+ 
+ bool output_is_direct_scanout(struct wlr_output *output,

diff --git a/gui-wm/hyprland/hyprland-0.25.0.ebuild 
b/gui-wm/hyprland/hyprland-0.25.0.ebuild
index 07e6cfa72..cc7d5b63d 100644
--- a/gui-wm/hyprland/hyprland-0.25.0.ebuild
+++ b/gui-wm/hyprland/hyprland-0.25.0.ebuild
@@ -18,7 +18,7 @@ S="${WORKDIR}/${PN}-source"
 KEYWORDS="~amd64"
 LICENSE="BSD"
 SLOT="0"
-IUSE="X grimblast hyprprop legacy-renderer scratchpad shellevents systemd"
+IUSE="X grimblast hyprprop legacy-renderer scratchpad shellevents systemd 
video_cards_nvidia"
 
 RDEPEND="
        app-misc/jq
@@ -75,7 +75,13 @@ src_prepare() {
                die "Hyprland requires >=sys-devel/gcc-12.1.0 to build"
        fi
 
-       default
+       if use video_cards_nvidia; then
+               cd "${S}/subprojects/wlroots" || die
+               eapply "${FILESDIR}/nvidia-0.25.0.patch"
+               cd "${S}" || die
+       fi
+
+       eapply_user
 }
 
 src_configure() {

Reply via email to