v3d/v3dv: build simulator references conditionally

Instead of checking on run time if simulator is available or not, do it
at build time.

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30900>
This commit is contained in:
Juan A. Suarez Romero 2024-08-28 16:55:29 +02:00 committed by Marge Bot
parent bf37bd7e26
commit 1536b7e9a8
4 changed files with 18 additions and 12 deletions

View file

@ -2564,10 +2564,11 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(v3dv_sampler, base, VkSampler,
static inline int
v3dv_ioctl(int fd, unsigned long request, void *arg)
{
if (USE_V3D_SIMULATOR)
return v3d_simulator_ioctl(fd, request, arg);
else
return drmIoctl(fd, request, arg);
#if USE_V3D_SIMULATOR
return v3d_simulator_ioctl(fd, request, arg);
#else
return drmIoctl(fd, request, arg);
#endif
}
/* Flags OOM conditions in command buffer state.

View file

@ -201,10 +201,13 @@ v3d_bo_free(struct v3d_bo *bo)
struct v3d_screen *screen = bo->screen;
if (bo->map) {
if (USE_V3D_SIMULATOR && bo->name &&
#if USE_V3D_SIMULATOR
if (bo->name &&
strcmp(bo->name, "winsys") == 0) {
free(bo->map);
} else {
} else
#endif
{
munmap(bo->map, bo->size);
VG(VALGRIND_FREELIKE_BLOCK(bo->map, 0));
}

View file

@ -745,10 +745,11 @@ void v3d_query_init(struct pipe_context *pctx);
static inline int
v3d_ioctl(int fd, unsigned long request, void *arg)
{
if (USE_V3D_SIMULATOR)
return v3d_simulator_ioctl(fd, request, arg);
else
return drmIoctl(fd, request, arg);
#if USE_V3D_SIMULATOR
return v3d_simulator_ioctl(fd, request, arg);
#else
return drmIoctl(fd, request, arg);
#endif
}
static inline bool

View file

@ -812,9 +812,10 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
/* Scanout BOs for simulator need to be linear for interaction with
* i965.
*/
if (USE_V3D_SIMULATOR &&
tmpl->bind & (PIPE_BIND_SHARED | PIPE_BIND_SCANOUT))
#if USE_V3D_SIMULATOR
if (tmpl->bind & PIPE_BIND_SHARED)
should_tile = false;
#endif
/* If using the old-school SCANOUT flag, we don't know what the screen
* might support other than linear. Just force linear.