Skip to content

Commit

Permalink
chore: Add spec file for KWin 5.27.10
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Dec 7, 2023
1 parent cf3b89a commit c5701f2
Show file tree
Hide file tree
Showing 2 changed files with 1,357 additions and 0 deletions.
68 changes: 68 additions & 0 deletions spec_files/kwin/fix-nvidia-screencast.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
From 17f81c4faa4c93dc9ac2d9abf1b759b38df2ed9d Mon Sep 17 00:00:00 2001
From: Alessandro Astone <[email protected]>
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 <[email protected]>
---
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 <[email protected]>
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

Loading

0 comments on commit c5701f2

Please sign in to comment.