mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
vc4: Make a new #define for making code conditional on the simulator.
I'd like to compile as much of the device-specific code as possible when building for simulator, and using if (using_simulator) instead of ifdefs helps.
This commit is contained in:
parent
9bafcf630a
commit
af3d747194
3 changed files with 25 additions and 15 deletions
|
|
@ -318,13 +318,19 @@ vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns)
|
|||
if (screen->finished_seqno >= seqno)
|
||||
return true;
|
||||
|
||||
#ifndef USE_VC4_SIMULATOR
|
||||
struct drm_vc4_wait_seqno wait;
|
||||
memset(&wait, 0, sizeof(wait));
|
||||
wait.seqno = seqno;
|
||||
wait.timeout_ns = timeout_ns;
|
||||
|
||||
int ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_SEQNO, &wait);
|
||||
int ret;
|
||||
if (!using_vc4_simulator)
|
||||
ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_SEQNO, &wait);
|
||||
else {
|
||||
wait.seqno = screen->finished_seqno;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (ret == -ETIME) {
|
||||
return false;
|
||||
} else if (ret != 0) {
|
||||
|
|
@ -334,15 +340,11 @@ vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns)
|
|||
screen->finished_seqno = wait.seqno;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns)
|
||||
{
|
||||
#ifndef USE_VC4_SIMULATOR
|
||||
struct vc4_screen *screen = bo->screen;
|
||||
|
||||
struct drm_vc4_wait_bo wait;
|
||||
|
|
@ -350,7 +352,12 @@ vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns)
|
|||
wait.handle = bo->handle;
|
||||
wait.timeout_ns = timeout_ns;
|
||||
|
||||
int ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_BO, &wait);
|
||||
int ret;
|
||||
if (!using_vc4_simulator)
|
||||
ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_BO, &wait);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
if (ret == -ETIME) {
|
||||
return false;
|
||||
} else if (ret != 0) {
|
||||
|
|
@ -359,9 +366,6 @@ vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns)
|
|||
} else {
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@
|
|||
#include "vc4_cl.h"
|
||||
#include "vc4_qir.h"
|
||||
|
||||
#ifdef USE_VC4_SIMULATOR
|
||||
#define using_vc4_simulator true
|
||||
#else
|
||||
#define using_vc4_simulator false
|
||||
#endif
|
||||
|
||||
#define VC4_DIRTY_BLEND (1 << 0)
|
||||
#define VC4_DIRTY_RASTERIZER (1 << 1)
|
||||
#define VC4_DIRTY_ZSA (1 << 2)
|
||||
|
|
|
|||
|
|
@ -404,11 +404,11 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
|||
if (!rsc->bo)
|
||||
goto fail;
|
||||
|
||||
#ifdef USE_VC4_SIMULATOR
|
||||
slice->stride = align(prsc->width0 * rsc->cpp, 16);
|
||||
#else
|
||||
slice->stride = handle->stride;
|
||||
#endif
|
||||
if (!using_vc4_simulator)
|
||||
slice->stride = handle->stride;
|
||||
else
|
||||
slice->stride = align(prsc->width0 * rsc->cpp, 16);
|
||||
|
||||
slice->tiling = VC4_TILING_FORMAT_LINEAR;
|
||||
|
||||
rsc->vc4_format = get_resource_texture_format(prsc);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue