Module: Mesa Branch: main Commit: 6ca69b2843fc56a9b1128dd8bf62fa55531726a7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ca69b2843fc56a9b1128dd8bf62fa55531726a7
Author: Alyssa Rosenzweig <[email protected]> Date: Tue Nov 8 17:13:10 2022 -0500 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19606> --- src/gallium/drivers/asahi/agx_pipe.c | 15 +++++++++++++++ src/gallium/drivers/asahi/agx_state.h | 6 ------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index f2b59fac900..2f9c1eb2a4a 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 d6479852281..62b95b383e7 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;
