[Mesa-dev] [PATCH] egl: Use the canonical drm-uapi fourcc header to avoid local defines.
Jason Ekstrand
jason at jlekstrand.net
Mon Jul 16 23:01:23 UTC 2018
Yes please! Assuming it builds (i.e., those are actually in drm_fourcc.h),
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On Mon, Jul 16, 2018 at 4:00 PM Eric Anholt <eric at anholt.net> wrote:
> We should only use a #define locally once it's been upstreamed, and at
> that point you should just update our drm_fourcc.h.
> ---
> src/egl/Android.mk | 1 +
> src/egl/Makefile.am | 1 +
> src/egl/SConscript | 1 +
> src/egl/drivers/dri2/egl_dri2.c | 28 -------------------------
> src/egl/drivers/dri2/platform_wayland.c | 8 -------
> src/egl/meson.build | 2 +-
> 6 files changed, 4 insertions(+), 37 deletions(-)
>
> diff --git a/src/egl/Android.mk b/src/egl/Android.mk
> index 8412aeb7984a..11128ded93c8 100644
> --- a/src/egl/Android.mk
> +++ b/src/egl/Android.mk
> @@ -44,6 +44,7 @@ LOCAL_CFLAGS := \
> -DHAVE_ANDROID_PLATFORM
>
> LOCAL_C_INCLUDES := \
> + $(MESA_TOP)/include/drm-uapi \
> $(MESA_TOP)/src/egl/main \
> $(MESA_TOP)/src/egl/drivers/dri2
>
> diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
> index 1a2273b8c316..b43805d991a4 100644
> --- a/src/egl/Makefile.am
> +++ b/src/egl/Makefile.am
> @@ -27,6 +27,7 @@ BUILT_SOURCES =
>
> AM_CFLAGS = \
> -I$(top_srcdir)/include \
> + -I$(top_srcdir)/include/drm-uapi \
> -I$(top_srcdir)/src/mapi \
> -I$(top_srcdir)/src/egl/main \
> -I$(top_srcdir)/src/gbm/main \
> diff --git a/src/egl/SConscript b/src/egl/SConscript
> index 927092d22847..153fdc089234 100644
> --- a/src/egl/SConscript
> +++ b/src/egl/SConscript
> @@ -8,6 +8,7 @@ env = env.Clone()
>
> env.Append(CPPPATH = [
> '#/include',
> + '#/include/drm-uapi',
> '#/include/HaikuGL',
> '#/src/egl/main',
> '#/src',
> diff --git a/src/egl/drivers/dri2/egl_dri2.c
> b/src/egl/drivers/dri2/egl_dri2.c
> index 27251ed3639d..a2d2d1c86070 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -65,34 +65,6 @@
> #include "util/u_vector.h"
> #include "mapi/glapi/glapi.h"
>
> -/* The kernel header drm_fourcc.h defines the DRM formats below. We
> duplicate
> - * some of the definitions here so that building Mesa won't bleeding-edge
> - * kernel headers.
> - */
> -#ifndef DRM_FORMAT_R8
> -#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0]
> R */
> -#endif
> -
> -#ifndef DRM_FORMAT_RG88
> -#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /*
> [15:0] R:G 8:8 little endian */
> -#endif
> -
> -#ifndef DRM_FORMAT_GR88
> -#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /*
> [15:0] G:R 8:8 little endian */
> -#endif
> -
> -#ifndef DRM_FORMAT_R16
> -#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /*
> [15:0] R 16 little endian */
> -#endif
> -
> -#ifndef DRM_FORMAT_GR1616
> -#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /*
> [31:0] R:G 16:16 little endian */
> -#endif
> -
> -#ifndef DRM_FORMAT_MOD_INVALID
> -#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
> -#endif
> -
> #define NUM_ATTRIBS 12
>
> static void
> diff --git a/src/egl/drivers/dri2/platform_wayland.c
> b/src/egl/drivers/dri2/platform_wayland.c
> index 11026f9fbf4b..294a6eddd606 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -50,14 +50,6 @@
> #include "wayland-drm-client-protocol.h"
> #include "linux-dmabuf-unstable-v1-client-protocol.h"
>
> -#ifndef DRM_FORMAT_MOD_INVALID
> -#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
> -#endif
> -
> -#ifndef DRM_FORMAT_MOD_LINEAR
> -#define DRM_FORMAT_MOD_LINEAR 0
> -#endif
> -
> /*
> * The index of entries in this table is used as a bitmask in
> * dri2_dpy->formats, which tracks the formats supported by our server.
> diff --git a/src/egl/meson.build b/src/egl/meson.build
> index 5f30bbba89a2..89a84fd89080 100644
> --- a/src/egl/meson.build
> +++ b/src/egl/meson.build
> @@ -24,7 +24,7 @@ inc_egl_dri2 = include_directories('drivers/dri2')
> c_args_for_egl = []
> link_for_egl = []
> deps_for_egl = []
> -incs_for_egl = [inc_include, inc_src, inc_egl]
> +incs_for_egl = [inc_include, inc_drm_uapi, inc_src, inc_egl]
>
> files_egl = files(
> 'main/eglapi.c',
> --
> 2.18.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180716/dd27b6f4/attachment-0001.html>
More information about the mesa-dev
mailing list