Skip to content
GitLab
Menu
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
aa8c9ffc
Commit
aa8c9ffc
authored
Oct 14, 2021
by
Xaver Hugl
Browse files
platforms/drm: use gbm with NVidia driver 495+
(cherry picked from commit
dc56b03d
)
parent
4c2a1b13
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/platforms/drm/drm_gpu.cpp
View file @
aa8c9ffc
...
...
@@ -74,7 +74,14 @@ DrmGpu::DrmGpu(DrmBackend *backend, const QString &devNode, int fd, dev_t device
// find out if this GPU is using the NVidia proprietary driver
DrmScopedPointer
<
drmVersion
>
version
(
drmGetVersion
(
fd
));
m_useEglStreams
=
strstr
(
version
->
name
,
"nvidia-drm"
);
m_isNVidia
=
strstr
(
version
->
name
,
"nvidia-drm"
);
m_useEglStreams
=
m_isNVidia
;
#if HAVE_GBM
m_gbmDevice
=
gbm_create_device
(
m_fd
);
if
(
m_gbmDevice
)
{
m_useEglStreams
=
m_isNVidia
&&
strcmp
(
gbm_device_get_backend_name
(
m_gbmDevice
),
"nvidia"
)
!=
0
;
}
#endif
m_socketNotifier
=
new
QSocketNotifier
(
fd
,
QSocketNotifier
::
Read
,
this
);
connect
(
m_socketNotifier
,
&
QSocketNotifier
::
activated
,
this
,
&
DrmGpu
::
dispatchEvents
);
...
...
@@ -551,4 +558,9 @@ bool DrmGpu::isFormatSupported(uint32_t drmFormat) const
}
}
bool
DrmGpu
::
isNVidia
()
const
{
return
m_isNVidia
;
}
}
src/plugins/platforms/drm/drm_gpu.h
View file @
aa8c9ffc
...
...
@@ -94,6 +94,7 @@ public:
bool
addFB2ModifiersSupported
()
const
{
return
m_addFB2ModifiersSupported
;
}
bool
isNVidia
()
const
;
void
waitIdle
();
DrmBackend
*
platform
()
const
;
...
...
@@ -131,6 +132,7 @@ private:
const
dev_t
m_deviceId
;
bool
m_atomicModeSetting
;
bool
m_useEglStreams
;
bool
m_isNVidia
;
gbm_device
*
m_gbmDevice
;
EGLDisplay
m_eglDisplay
=
EGL_NO_DISPLAY
;
clockid_t
m_presentationClock
;
...
...
src/plugins/platforms/drm/drm_object_plane.cpp
View file @
aa8c9ffc
...
...
@@ -73,7 +73,10 @@ bool DrmPlane::init()
checkSupport
(
5
,
Transformation
::
ReflectY
);
// read formats from blob if available and if modifiers are supported, and from the plane object if not
if
(
auto
formatProp
=
getProp
(
PropertyIndex
::
In_Formats
);
formatProp
&&
gpu
()
->
addFB2ModifiersSupported
()
&&
qEnvironmentVariableIntValue
(
"KWIN_DRM_USE_MODIFIERS"
)
==
1
)
{
bool
modifiersEnvSet
=
false
;
bool
modifiersEnv
=
qEnvironmentVariableIntValue
(
"KWIN_DRM_USE_MODIFIERS"
,
&
modifiersEnvSet
)
!=
0
;
bool
allowModifiers
=
(
gpu
()
->
isNVidia
()
&&
!
modifiersEnvSet
)
||
(
modifiersEnvSet
&&
modifiersEnv
);
if
(
auto
formatProp
=
getProp
(
PropertyIndex
::
In_Formats
);
formatProp
&&
gpu
()
->
addFB2ModifiersSupported
()
&&
allowModifiers
)
{
DrmScopedPointer
<
drmModePropertyBlobRes
>
propertyBlob
(
drmModeGetPropertyBlob
(
gpu
()
->
fd
(),
formatProp
->
current
()));
if
(
propertyBlob
&&
propertyBlob
->
data
)
{
auto
blob
=
static_cast
<
drm_format_modifier_blob
*>
(
propertyBlob
->
data
);
...
...
src/plugins/platforms/drm/egl_gbm_backend.cpp
View file @
aa8c9ffc
...
...
@@ -88,14 +88,12 @@ bool EglGbmBackend::initializeEgl()
return
false
;
}
auto
device
=
gbm_create_device
(
m_gpu
->
fd
());
if
(
!
device
)
{
if
(
!
m_gpu
->
gbmDevice
())
{
setFailed
(
"Could not create gbm device"
);
return
false
;
}
m_gpu
->
setGbmDevice
(
device
);
display
=
eglGetPlatformDisplayEXT
(
platform
,
d
evice
,
nullptr
);
display
=
eglGetPlatformDisplayEXT
(
platform
,
m_gpu
->
gbmD
evice
()
,
nullptr
);
m_gpu
->
setEglDisplay
(
display
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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