Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
440
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
70d1d262
Commit
70d1d262
authored
1 year ago
by
Fatih Uzunoğlu
Committed by
Steve Lhomme
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
qt: workaround for nvidia on xwayland
parent
235ba564
No related branches found
No related tags found
1 merge request
!3788
qt: xwayland workaround for garbage nvidia drivers
Pipeline
#394598
passed with stage
in 40 minutes and 37 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
+36
-1
36 additions, 1 deletion
modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
modules/gui/qt/maininterface/compositor_x11_uisurface.hpp
+2
-0
2 additions, 0 deletions
modules/gui/qt/maininterface/compositor_x11_uisurface.hpp
with
38 additions
and
1 deletion
modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
+
36
−
1
View file @
70d1d262
...
...
@@ -21,7 +21,8 @@
#include
<QQuickWindow>
#include
<QQuickItem>
#include
<QOffscreenSurface>
#include
<QGuiApplication>
#include
<QApplication>
#include
<QThread>
#include
"compositor_x11_uisurface.hpp"
#include
"compositor_common.hpp"
...
...
@@ -48,6 +49,13 @@ CompositorX11UISurface::CompositorX11UISurface(QWindow* window, QScreen* screen)
// UI is renderred on offscreen, no need for double bufferring
format
.
setSwapBehavior
(
QSurfaceFormat
::
SingleBuffer
);
// Check if this is XWayland:
if
(
Q_UNLIKELY
(
QApplication
::
platformName
()
==
QLatin1String
(
"xcb"
)
&&
qEnvironmentVariable
(
"XDG_SESSION_TYPE"
)
==
QLatin1String
(
"wayland"
)))
{
applyNvidiaWorkaround
(
format
);
}
setFormat
(
format
);
m_context
=
new
QOpenGLContext
();
...
...
@@ -322,6 +330,33 @@ void CompositorX11UISurface::resizeFbo()
}
}
void
CompositorX11UISurface
::
applyNvidiaWorkaround
(
QSurfaceFormat
&
format
)
{
assert
(
QThread
::
currentThread
()
==
qApp
->
thread
());
QOffscreenSurface
surface
;
surface
.
setFormat
(
format
);
surface
.
create
();
QOpenGLContext
ctx
;
ctx
.
setFormat
(
format
);
if
(
ctx
.
create
()
&&
ctx
.
makeCurrent
(
&
surface
))
{
// Context needs to be created to access the functions
if
(
QOpenGLFunctions
*
const
func
=
ctx
.
functions
())
{
if
(
const
GLubyte
*
str
=
func
->
glGetString
(
GL_VENDOR
))
{
if
(
!
strcmp
(
reinterpret_cast
<
const
char
*>
(
str
),
"NVIDIA Corporation"
))
{
// for some reason SingleBuffer is not supported:
format
.
setSwapBehavior
(
QSurfaceFormat
::
DefaultSwapBehavior
);
}
}
}
}
}
void
CompositorX11UISurface
::
resizeEvent
(
QResizeEvent
*
)
{
if
(
m_onscreenSize
!=
size
()
*
devicePixelRatio
())
...
...
This diff is collapsed.
Click to expand it.
modules/gui/qt/maininterface/compositor_x11_uisurface.hpp
+
2
−
0
View file @
70d1d262
...
...
@@ -90,6 +90,8 @@ protected:
void
resizeFbo
();
private
:
static
void
applyNvidiaWorkaround
(
QSurfaceFormat
&
format
);
QQuickItem
*
m_rootItem
=
nullptr
;
QOpenGLContext
*
m_context
=
nullptr
;
CompositorOffscreenWindow
*
m_uiWindow
=
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
Fatih Uzunoğlu
@fuzun
mentioned in merge request
!6202
·
4 months ago
mentioned in merge request
!6202
mentioned in merge request !6202
Toggle commit list
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment