Backport proposed patch to fix nvidia screencasting

epel9
Alessandro Astone 1 year ago
parent 54e0a80843
commit a775cc3814

@ -0,0 +1,68 @@
From 17f81c4faa4c93dc9ac2d9abf1b759b38df2ed9d Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Wed, 15 Nov 2023 23:22:56 +0100
Subject: [PATCH 1/2] screencast: Fix GLES path
glReadPixels reads from the bound framebuffer, so create an offscreen
framebuffer and attach the texture to it
Co-authored-by: Jan Grulich <jgrulich@redhat.com>
---
src/plugins/screencast/screencastutils.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/plugins/screencast/screencastutils.h b/src/plugins/screencast/screencastutils.h
index f402c21fdf..1a57362dea 100644
--- a/src/plugins/screencast/screencastutils.h
+++ b/src/plugins/screencast/screencastutils.h
@@ -8,6 +8,7 @@
#include "kwinglplatform.h"
#include "kwingltexture.h"
+#include "kwinglutils.h"
#include <spa/buffer/buffer.h>
#include <spa/param/video/raw.h>
@@ -60,7 +61,10 @@ static void grabTexture(GLTexture *texture, spa_data *spa, spa_video_format form
texture->bind();
if (GLPlatform::instance()->isGLES()) {
+ GLFramebuffer fbo(texture);
+ GLFramebuffer::pushFramebuffer(&fbo);
glReadPixels(0, 0, size.width(), size.height(), closestGLType(format), GL_UNSIGNED_BYTE, spa->data);
+ GLFramebuffer::popFramebuffer();
} else if (GLPlatform::instance()->glVersion() >= kVersionNumber(4, 5)) {
glGetTextureImage(texture->texture(), 0, closestGLType(format), GL_UNSIGNED_BYTE, spa->chunk->size, spa->data);
} else {
--
2.41.0
From 79083bdf721dd56ace7412f89d7b80e7b9a2ba52 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Wed, 15 Nov 2023 23:23:14 +0100
Subject: [PATCH 2/2] screencast: Make nvidia use the GLES path
glGetTexImage returns a black image
Fixes: BUG:476602
---
src/plugins/screencast/screencastutils.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/screencast/screencastutils.h b/src/plugins/screencast/screencastutils.h
index 1a57362dea..31b8a1c95c 100644
--- a/src/plugins/screencast/screencastutils.h
+++ b/src/plugins/screencast/screencastutils.h
@@ -60,7 +60,7 @@ static void grabTexture(GLTexture *texture, spa_data *spa, spa_video_format form
}
texture->bind();
- if (GLPlatform::instance()->isGLES()) {
+ if (GLPlatform::instance()->isGLES() || GLPlatform::instance()->driver() == Driver_NVidia) {
GLFramebuffer fbo(texture);
GLFramebuffer::pushFramebuffer(&fbo);
glReadPixels(0, 0, size.width(), size.height(), closestGLType(format), GL_UNSIGNED_BYTE, spa->data);
--
2.41.0

@ -17,7 +17,7 @@
Name: kwin
Version: 5.27.9
Release: 2%{?dist}
Release: 3%{?dist}
Summary: KDE Window manager
# all sources are effectively GPLv2+, except for:
@ -39,6 +39,8 @@ Source0: http://download.kde.org/%{stable}/plasma/%{version}/%{name}-%{version}.
## upstream patches
## proposed patches
# https://invent.kde.org/plasma/kwin/-/merge_requests/4651
Patch0: fix-nvidia-screencast.patch
# Base
BuildRequires: extra-cmake-modules
@ -363,6 +365,9 @@ make test ARGS="--output-on-failure --timeout 10" -C %{_target_platform} ||:
%changelog
* Thu Nov 16 2023 Alessandro Astone <ales.astone@gmail.com> - 5.27.9-3
- Backport proposed patch to fix nvidia screencasting
* Fri Nov 03 2023 Neal Gompa <ngompa@fedoraproject.org> - 5.27.9-2
- Mark kwin-x11 as deprecated

Loading…
Cancel
Save