virgl: Update virgl_protocol and use the provided constants

Allow for better readability of the code.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14473>
This commit is contained in:
Corentin Noël 2022-01-05 12:33:43 +01:00
parent 04d812b2d0
commit 2aa8e56e52
2 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -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