virgl: add enum virgl_capsets to virgl_hw.h

Capset ids belong to virgl_hw.h.  Mesa uses magic numbers right now
and can be fixed with this change.

Capset ids are also leaked in virtio_gpu.h, for use with
virgl_renderer_get_cap_set by qemu.  We should replace
virgl_renderer_get_cap_set by something that enumerates all capsets
to stop the leaking, but that is another story.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent 7f23cf43c5
commit 5e96edf216
  1. 7
      src/virgl_hw.h
  2. 16
      src/virglrenderer.c
  3. 4
      src/vrend_renderer.c
  4. 3
      src/vrend_renderer.h

@ -370,6 +370,13 @@ enum virgl_formats {
VIRGL_FORMAT_MAX_EXTENDED
};
#ifdef VIRGL_RENDERER_UNSTABLE_APIS
enum virgl_capsets {
VIRGL_CAPSET_VIRGL = 1,
VIRGL_CAPSET_VIRGL2 = 2,
};
#endif
/* These are used by the capability_bits field in virgl_caps_v2. */
#define VIRGL_CAP_NONE 0
#define VIRGL_CAP_TGSI_INVARIANT (1 << 0)

@ -155,7 +155,14 @@ void virgl_renderer_resource_unref(uint32_t res_handle)
void virgl_renderer_fill_caps(uint32_t set, uint32_t version,
void *caps)
{
switch (set) {
case VIRGL_CAPSET_VIRGL:
case VIRGL_CAPSET_VIRGL2:
vrend_renderer_fill_caps(set, version, (union virgl_caps *)caps);
break;
default:
break;
}
}
int virgl_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name)
@ -354,7 +361,16 @@ int virgl_renderer_resource_get_info(int res_handle,
void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,
uint32_t *max_size)
{
switch (cap_set) {
case VIRGL_CAPSET_VIRGL:
case VIRGL_CAPSET_VIRGL2:
vrend_renderer_get_cap_set(cap_set, max_ver, max_size);
break;
default:
*max_ver = 0;
*max_size = 0;
break;
}
}
void virgl_renderer_get_rect(int resource_id, struct iovec *iov, unsigned int num_iovs,

@ -10264,11 +10264,11 @@ void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,
uint32_t *max_size)
{
switch (cap_set) {
case VREND_CAP_SET:
case VIRGL_CAPSET_VIRGL:
*max_ver = 1;
*max_size = sizeof(struct virgl_caps_v1);
break;
case VREND_CAP_SET2:
case VIRGL_CAPSET_VIRGL2:
/* we should never need to increase this - it should be possible to just grow virgl_caps */
*max_ver = 2;
*max_size = sizeof(struct virgl_caps_v2);

@ -434,9 +434,6 @@ struct vrend_renderer_resource_info {
int vrend_renderer_resource_get_info(struct pipe_resource *pres,
struct vrend_renderer_resource_info *info);
#define VREND_CAP_SET 1
#define VREND_CAP_SET2 2
void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,
uint32_t *max_size);

Loading…
Cancel
Save