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

@ -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 *