Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
b7a3a028
Commit
b7a3a028
authored
Feb 28, 2022
by
Xaver Hugl
Browse files
backends/drm: fix recording with direct scanout
Backported from
72d9711e
BUG: 450943
FIXED-IN: 5.24.3
parent
85558234
Pipeline
#143523
passed with stage
in 24 minutes and 59 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/backends/drm/egl_gbm_backend.cpp
View file @
b7a3a028
...
...
@@ -529,6 +529,7 @@ QRegion EglGbmBackend::beginFrame(AbstractOutput *drmOutput)
qCDebug
(
KWIN_DRM
)
<<
"Direct scanout stopped on output"
<<
output
.
output
->
name
();
}
output
.
scanoutSurface
=
nullptr
;
output
.
scanoutBuffer
=
nullptr
;
if
(
output
.
scanoutCandidate
.
surface
)
{
output
.
oldScanoutCandidate
=
output
.
scanoutCandidate
.
surface
;
output
.
scanoutCandidate
=
{};
...
...
@@ -768,6 +769,7 @@ bool EglGbmBackend::scanout(AbstractOutput *drmOutput, SurfaceItem *surfaceItem)
qCDebug
(
KWIN_DRM
).
nospace
()
<<
"Direct scanout starting on output "
<<
output
.
output
->
name
()
<<
" for application
\"
"
<<
path
<<
"
\"
"
;
}
output
.
scanoutSurface
=
surface
;
output
.
scanoutBuffer
=
bo
;
return
true
;
}
else
{
// TODO clean the modeset and direct scanout code paths up
...
...
@@ -796,7 +798,18 @@ QSharedPointer<DrmBuffer> EglGbmBackend::renderTestFrame(DrmAbstractOutput *outp
QSharedPointer
<
GLTexture
>
EglGbmBackend
::
textureForOutput
(
AbstractOutput
*
output
)
const
{
Q_ASSERT
(
m_outputs
.
contains
(
output
));
const
auto
createImage
=
[
this
,
output
](
GbmBuffer
*
buffer
)
{
EGLImageKHR
image
=
eglCreateImageKHR
(
eglDisplay
(),
nullptr
,
EGL_NATIVE_PIXMAP_KHR
,
buffer
->
getBo
(),
nullptr
);
if
(
image
==
EGL_NO_IMAGE_KHR
)
{
qCWarning
(
KWIN_DRM
)
<<
"Failed to record frame: Error creating EGLImageKHR - "
<<
glGetError
();
return
QSharedPointer
<
EGLImageTexture
>
(
nullptr
);
}
return
QSharedPointer
<
EGLImageTexture
>::
create
(
eglDisplay
(),
image
,
GL_RGBA8
,
static_cast
<
DrmAbstractOutput
*>
(
output
)
->
modeSize
());
};
auto
&
renderOutput
=
m_outputs
[
output
];
if
(
renderOutput
.
scanoutBuffer
)
{
return
createImage
(
dynamic_cast
<
GbmBuffer
*>
(
renderOutput
.
scanoutBuffer
.
data
()));
}
if
(
renderOutput
.
current
.
shadowBuffer
)
{
const
auto
glTexture
=
QSharedPointer
<
KWin
::
GLTexture
>::
create
(
renderOutput
.
current
.
shadowBuffer
->
texture
(),
GL_RGBA8
,
renderOutput
.
output
->
sourceSize
());
glTexture
->
setYInverted
(
true
);
...
...
@@ -807,13 +820,7 @@ QSharedPointer<GLTexture> EglGbmBackend::textureForOutput(AbstractOutput *output
qCWarning
(
KWIN_DRM
)
<<
"Failed to record frame: No gbm buffer!"
;
return
{};
}
EGLImageKHR
image
=
eglCreateImageKHR
(
eglDisplay
(),
nullptr
,
EGL_NATIVE_PIXMAP_KHR
,
gbmBuffer
->
getBo
(),
nullptr
);
if
(
image
==
EGL_NO_IMAGE_KHR
)
{
qCWarning
(
KWIN_DRM
)
<<
"Failed to record frame: Error creating EGLImageKHR - "
<<
glGetError
();
return
{};
}
return
QSharedPointer
<
EGLImageTexture
>::
create
(
eglDisplay
(),
image
,
GL_RGBA8
,
static_cast
<
DrmAbstractOutput
*>
(
output
)
->
modeSize
());
return
createImage
(
gbmBuffer
);
}
bool
EglGbmBackend
::
directScanoutAllowed
(
AbstractOutput
*
output
)
const
...
...
src/backends/drm/egl_gbm_backend.h
View file @
b7a3a028
...
...
@@ -113,6 +113,7 @@ private:
QPointer
<
KWaylandServer
::
SurfaceInterface
>
surface
;
QMap
<
uint32_t
,
QVector
<
uint64_t
>>
attemptedFormats
;
}
scanoutCandidate
;
QSharedPointer
<
DrmBuffer
>
scanoutBuffer
;
QPointer
<
KWaylandServer
::
SurfaceInterface
>
oldScanoutCandidate
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment