virgl: Small fix of converting format

Convert pipe format to virgl format since virglrenderer will convert it
back from virgl format to pip format when create pipe_resource.

According to the call stack, only if vflags include flag:
PIPE_RESOURCE_FLAG_MAP_PERSISTENT or PIPE_RESOURCE_FLAG_MAP_COHERENT
will make it call into virgl_drm_winsys_resource_create_blob() so here
remove redundant if condition in virgl_drm_winsys_resource_create_blob().

Signed-off-by: Julia Zhang <julia.zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36672>
This commit is contained in:
Julia Zhang
2024-01-04 17:42:02 +08:00
committed by Marge Bot
parent a8b27a125b
commit 3fa212c4f5
@@ -201,15 +201,12 @@ virgl_drm_winsys_resource_create_blob(struct virgl_winsys *qws,
return NULL;
/* Make sure blob is page aligned. */
if (flags & (VIRGL_RESOURCE_FLAG_MAP_PERSISTENT |
VIRGL_RESOURCE_FLAG_MAP_COHERENT)) {
width = ALIGN(width, getpagesize());
size = ALIGN(size, getpagesize());
}
width = ALIGN(width, getpagesize());
size = ALIGN(size, getpagesize());
blob_id = p_atomic_inc_return(&qdws->blob_id);
cmd[0] = VIRGL_CMD0(VIRGL_CCMD_PIPE_RESOURCE_CREATE, 0, VIRGL_PIPE_RES_CREATE_SIZE);
cmd[VIRGL_PIPE_RES_CREATE_FORMAT] = format;
cmd[VIRGL_PIPE_RES_CREATE_FORMAT] = pipe_to_virgl_format(format);
cmd[VIRGL_PIPE_RES_CREATE_BIND] = bind;
cmd[VIRGL_PIPE_RES_CREATE_TARGET] = target;
cmd[VIRGL_PIPE_RES_CREATE_WIDTH] = width;