1
0
Fork 0

backend/native: Define struct drm_plane_size_hint only if libdrm doesn't

Fixes error building against libdrm >= 2.4.122:

../src/backends/native/meta-kms-plane.c:67:8: error: redefinition of ‘struct drm_plane_size_hint’
   67 | struct drm_plane_size_hint {
      |        ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/libdrm/drm.h:1025,
                 from /usr/local/include/xf86drm.h:40,
                 from ../src/backends/native/meta-kms-plane-private.h:20,
                 from ../src/backends/native/meta-kms-plane.c:21:
/usr/local/include/libdrm/drm_mode.h:866:8: note: originally defined here
  866 | struct drm_plane_size_hint {
      |        ^~~~~~~~~~~~~~~~~~~

Suggested by Jonas Ådahl.

v2:
* Use has_type. (Sebastian Wick)

v3: (jadahl)
* Bump meson requirement to 1.3.0 for compiler.has_type()

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3556
Fixes: 0ca933baec ("backend/native: Adds support for SIZE_HINTS Cursor Plane Property")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3848>
This commit is contained in:
Michel Dänzer 2024-07-02 12:39:34 +02:00 committed by Marge Bot
parent a1191c405d
commit 92d60dbb08
3 changed files with 14 additions and 1 deletions

View file

@ -138,3 +138,6 @@
/* Supports eventfd */
#mesondefine HAVE_EVENTFD
/* libdrm defines struct drm_plane_size_hint */
#mesondefine HAVE_DRM_PLANE_SIZE_HINT

View file

@ -1,6 +1,6 @@
project('mutter', 'c',
version: '47.alpha',
meson_version: '>= 1.1.0',
meson_version: '>= 1.3.0',
license: 'GPLv2+'
)
@ -271,6 +271,11 @@ endif
if have_wayland or have_native_backend
libdrm_dep = dependency('libdrm', version: libdrm_req)
have_drm_plane_size_hint = cc.has_type('struct drm_plane_size_hint',
dependencies: libdrm_dep,
prefix: '#include <drm_mode.h>')
else
have_drm_plane_size_hint = false
endif
have_egl_device = get_option('egl_device')
@ -567,6 +572,7 @@ cdata.set('HAVE_PANGO_FT2', have_pango_ft2)
cdata.set('HAVE_TIMERFD', have_timerfd)
cdata.set('HAVE_MALLOC_TRIM', have_malloc_trim)
cdata.set('HAVE_EVENTFD', have_eventfd)
cdata.set('HAVE_DRM_PLANE_SIZE_HINT', have_drm_plane_size_hint)
if have_x11_client
xkb_base = xkeyboard_config_dep.get_variable('xkb_base')

View file

@ -63,12 +63,16 @@ struct _MetaKmsPlane
MetaKmsDevice *device;
};
#ifndef HAVE_DRM_PLANE_SIZE_HINT
/* Shall be removed once available on libdrm.*/
struct drm_plane_size_hint {
__u16 width;
__u16 height;
};
#endif
G_DEFINE_TYPE (MetaKmsPlane, meta_kms_plane, G_TYPE_OBJECT)
MetaKmsDevice *