guard gbm version for gbm_bo_get_fd_for_plane
This commit is contained in:
parent
a234e5aaf4
commit
5cc5d81cea
3 changed files with 15 additions and 0 deletions
|
@ -217,6 +217,11 @@ set_package_properties(Libdrm PROPERTIES TYPE REQUIRED PURPOSE "Required for drm
|
|||
find_package(gbm)
|
||||
set_package_properties(gbm PROPERTIES TYPE OPTIONAL PURPOSE "Required for egl output of drm backend.")
|
||||
set(HAVE_GBM ${gbm_FOUND})
|
||||
if (${gbm_VERSION} GREATER_EQUAL 21.1)
|
||||
set(HAVE_GBM_BO_GET_FD_FOR_PLANE 1)
|
||||
else()
|
||||
set(HAVE_GBM_BO_GET_FD_FOR_PLANE 0)
|
||||
endif()
|
||||
|
||||
option(KWIN_BUILD_EGL_STREAM_BACKEND "Enable building of EGLStream based DRM backend" ON)
|
||||
if (KWIN_BUILD_EGL_STREAM_BACKEND)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#cmakedefine01 HAVE_X11_XCB
|
||||
#cmakedefine01 HAVE_X11_XINPUT
|
||||
#cmakedefine01 HAVE_GBM
|
||||
#cmakedefine01 HAVE_GBM_BO_GET_FD_FOR_PLANE
|
||||
#cmakedefine01 HAVE_EGL_STREAMS
|
||||
#cmakedefine01 HAVE_WAYLAND_EGL
|
||||
#cmakedefine01 HAVE_SYS_PRCTL_H
|
||||
|
|
|
@ -146,7 +146,12 @@ bool EglGbmBackend::resetOutput(Output &output)
|
|||
QVector<uint64_t> modifiers = output.output->supportedModifiers(m_gbmFormat);
|
||||
|
||||
QSharedPointer<GbmSurface> gbmSurface;
|
||||
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
|
||||
if (modifiers.isEmpty()) {
|
||||
#else
|
||||
// modifiers have to be disabled with multi-gpu if gbm_bo_get_fd_for_plane is not available
|
||||
if (modifiers.isEmpty() || output.output->gpu() != m_gpu) {
|
||||
#endif
|
||||
int flags = GBM_BO_USE_RENDERING;
|
||||
if (output.output->gpu() == m_gpu) {
|
||||
flags |= GBM_BO_USE_SCANOUT;
|
||||
|
@ -245,6 +250,7 @@ bool EglGbmBackend::exportFramebufferAsDmabuf(DrmAbstractOutput *drmOutput, int
|
|||
{
|
||||
Q_ASSERT(m_outputs.contains(drmOutput));
|
||||
auto bo = m_outputs[drmOutput].current.gbmSurface->currentBuffer()->getBo();
|
||||
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
|
||||
if (gbm_bo_get_handle_for_plane(bo, 0).s32 != -1) {
|
||||
*num_fds = gbm_bo_get_plane_count(bo);
|
||||
for (uint32_t i = 0; i < *num_fds; i++) {
|
||||
|
@ -261,6 +267,7 @@ bool EglGbmBackend::exportFramebufferAsDmabuf(DrmAbstractOutput *drmOutput, int
|
|||
}
|
||||
*modifier = gbm_bo_get_modifier(bo);
|
||||
} else {
|
||||
#endif
|
||||
fds[0] = gbm_bo_get_fd(bo);
|
||||
if (fds[0] < 0) {
|
||||
qCWarning(KWIN_DRM) << "failed to export gbm_bo as dma-buf:" << strerror(errno);
|
||||
|
@ -269,7 +276,9 @@ bool EglGbmBackend::exportFramebufferAsDmabuf(DrmAbstractOutput *drmOutput, int
|
|||
*num_fds = 1;
|
||||
strides[0] = gbm_bo_get_stride(bo);
|
||||
*modifier = DRM_FORMAT_MOD_INVALID;
|
||||
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
|
||||
}
|
||||
#endif
|
||||
*format = gbm_bo_get_format(bo);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue