Module: Mesa Branch: main Commit: 2aa8e56e52d181c6e1349d611c60957e19599097 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2aa8e56e52d181c6e1349d611c60957e19599097
Author: Corentin Noël <[email protected]> Date: Wed Jan 5 12:33:43 2022 +0100 virgl: Update virgl_protocol and use the provided constants Allow for better readability of the code. Signed-off-by: Corentin Noël <[email protected]> Reviewed-by: Gert Wollny <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14473> --- src/gallium/drivers/virgl/virgl_encode.c | 4 ++-- src/virtio/virtio-gpu/virgl_protocol.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index c1d0d189569..34336d11f9f 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -1533,13 +1533,13 @@ void virgl_encode_copy_transfer(struct virgl_context *ctx, uint32_t command; struct virgl_screen *vs = virgl_screen(ctx->base.screen); // set always synchronized to 1, second bit is used for direction - uint32_t direction_and_synchronized = 1; + uint32_t direction_and_synchronized = VIRGL_COPY_TRANSFER3D_FLAGS_SYNCHRONIZED; if (vs->caps.caps.v2.capability_bits_v2 & VIRGL_CAP_V2_COPY_TRANSFER_BOTH_DIRECTIONS) { if (trans->direction == VIRGL_TRANSFER_TO_HOST) { // do nothing, as 0 means transfer to host } else if (trans->direction == VIRGL_TRANSFER_FROM_HOST) { - direction_and_synchronized |= 1 << 1; + direction_and_synchronized |= VIRGL_COPY_TRANSFER3D_FLAGS_READ_FROM_HOST; } else { // something wrong happened here assert(0); diff --git a/src/virtio/virtio-gpu/virgl_protocol.h b/src/virtio/virtio-gpu/virgl_protocol.h index 4166217a589..fca9b428c4f 100644 --- a/src/virtio/virtio-gpu/virgl_protocol.h +++ b/src/virtio/virtio-gpu/virgl_protocol.h @@ -613,10 +613,11 @@ enum virgl_context_cmd { /* The first 11 dwords are the same as VIRGL_RESOURCE_IW_* */ #define VIRGL_COPY_TRANSFER3D_SRC_RES_HANDLE 12 #define VIRGL_COPY_TRANSFER3D_SRC_RES_OFFSET 13 -/* Second bit of this dword is used to identify the direction - * 1 << 1 means transfer from host. 0 << 1 means transfer to host. - */ -#define VIRGL_COPY_TRANSFER3D_SYNCHRONIZED 14 +#define VIRGL_COPY_TRANSFER3D_FLAGS 14 +#define VIRGL_COPY_TRANSFER3D_FLAGS_SYNCHRONIZED (1 << 0) +/* 1 << 1 means transfer from host. + 0 << 1 means transfer to host.*/ +#define VIRGL_COPY_TRANSFER3D_FLAGS_READ_FROM_HOST (1 << 1) /* set tweak flags */ #define VIRGL_SET_TWEAKS_SIZE 2
