virgl: return -1 for PIPE_CAP_ACCELERATED

There's no way currently in virgl to determine whether it's running
above CPU or GPU. This info will be used to disable HW SELECT.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>
This commit is contained in:
Qiang Yu 2022-05-21 20:55:00 +08:00 committed by Marge Bot
parent 1b3fd8b3d2
commit e8658adaa8
3 changed files with 7 additions and 4 deletions

View File

@ -256,7 +256,10 @@ The integer capabilities:
not available one should return 0xFFFFFFFF.
* ``PIPE_CAP_DEVICE_ID``: The device ID (PCI ID) of the underlying hardware.
0xFFFFFFFF if not available.
* ``PIPE_CAP_ACCELERATED``: Whether the renderer is hardware accelerated.
* ``PIPE_CAP_ACCELERATED``: Whether the renderer is hardware accelerated. 0 means
not accelerated (ie. CPU rendering), 1 means accelerated (ie. GPU rendering),
-1 means unknown (ie. an API translation driver which doesn't known what kind of
hardware it's running above).
* ``PIPE_CAP_VIDEO_MEMORY``: The amount of video memory in megabytes.
* ``PIPE_CAP_UMA``: If the device has a unified memory architecture or on-card
memory and GART.

View File

@ -330,7 +330,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_DEVICE_ID:
return 0x1010;
case PIPE_CAP_ACCELERATED:
return 1;
return -1; /* -1 means unknown */
case PIPE_CAP_UMA:
case PIPE_CAP_VIDEO_MEMORY:
if (vscreen->caps.caps.v2.capability_bits_v2 & VIRGL_CAP_V2_VIDEO_MEMORY)

View File

@ -98,8 +98,8 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param,
return 0;
case __DRI2_RENDERER_ACCELERATED:
value[0] =
(unsigned int)screen->base.screen->get_param(screen->base.screen,
PIPE_CAP_ACCELERATED);
(unsigned int)!!screen->base.screen->get_param(screen->base.screen,
PIPE_CAP_ACCELERATED);
return 0;
case __DRI2_RENDERER_VIDEO_MEMORY: {