From: Alyssa Rosenzweig Date: Tue, 8 Nov 2022 22:13:10 +0000 (-0500) Subject: asahi: Localize the modifier #define hack for macOS X-Git-Tag: upstream/23.3.3~16808 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ca69b2843fc56a9b1128dd8bf62fa55531726a7;p=platform%2Fupstream%2Fmesa.git asahi: Localize the modifier #define hack for macOS This reduces the burden of synchronizing the values between Linux and macOS and provides fewer ways to shoot ourselves in the foot. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index f2b59fa..2f9c1eb 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -48,6 +48,21 @@ #include "asahi/compiler/agx_compile.h" #include "asahi/lib/decode.h" #include "asahi/lib/agx_formats.h" +#include "util/u_drm.h" + +/* drm_fourcc cannot be built on macOS */ +#ifndef __APPLE__ +#include "drm-uapi/drm_fourcc.h" +#endif + +/* In case of macOS, pick some fake modifier values so we still build */ +#ifndef DRM_FORMAT_MOD_LINEAR +#define DRM_FORMAT_MOD_LINEAR 1 +#endif + +#ifndef DRM_FORMAT_MOD_APPLE_TWIDDLED +#define DRM_FORMAT_MOD_APPLE_TWIDDLED (2) +#endif static const struct debug_named_value agx_debug_options[] = { {"trace", AGX_DBG_TRACE, "Trace the command stream"}, diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index d647985..62b95b3 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -272,12 +272,6 @@ agx_device(struct pipe_screen *p) return &(agx_screen(p)->dev); } -/* TODO: UABI, fake for macOS */ -#ifndef DRM_FORMAT_MOD_LINEAR -#define DRM_FORMAT_MOD_LINEAR 1 -#endif -#define DRM_FORMAT_MOD_APPLE_TWIDDLED (2) - struct agx_resource { struct pipe_resource base; uint64_t modifier;