virgl: move vrend_renderer_execute to virglrenderer

Add vrend_renderer_export_query for the vrend-specific code and move
the rest to virglrenderer.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 5 years ago
parent 82b548f13a
commit ea5d7a9148
  1. 45
      src/virglrenderer.c
  2. 47
      src/vrend_renderer.c
  3. 3
      src/vrend_renderer.h

@ -548,7 +548,50 @@ virgl_debug_callback_type virgl_set_debug_callback(virgl_debug_callback_type cb)
return vrend_set_debug_callback(cb);
}
static int virgl_renderer_export_query(void *execute_args, uint32_t execute_size)
{
struct virgl_renderer_export_query *export_query = execute_args;
if (execute_size != sizeof(struct virgl_renderer_export_query))
return -EINVAL;
if (export_query->hdr.size != sizeof(struct virgl_renderer_export_query))
return -EINVAL;
return vrend_renderer_export_query(export_query->in_resource_id, export_query);
}
static int virgl_renderer_supported_structures(void *execute_args, uint32_t execute_size)
{
struct virgl_renderer_supported_structures *supported_structures = execute_args;
if (execute_size != sizeof(struct virgl_renderer_supported_structures))
return -EINVAL;
if (supported_structures->hdr.size != sizeof(struct virgl_renderer_supported_structures))
return -EINVAL;
if (supported_structures->in_stype_version == 0) {
supported_structures->out_supported_structures_mask =
VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY |
VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES;
} else {
supported_structures->out_supported_structures_mask = 0;
}
return 0;
}
int virgl_renderer_execute(void *execute_args, uint32_t execute_size)
{
return vrend_renderer_execute(execute_args, execute_size);
struct virgl_renderer_hdr *hdr = execute_args;
if (hdr->stype_version != 0)
return -EINVAL;
switch (hdr->stype) {
case VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES:
return virgl_renderer_supported_structures(execute_args, execute_size);
case VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY:
return virgl_renderer_export_query(execute_args, execute_size);
default:
return -EINVAL;
}
}

@ -10258,17 +10258,12 @@ int vrend_renderer_get_poll_fd(void)
return vrend_state.eventfd;
}
static int vrend_renderer_export_query(void *execute_args, uint32_t execute_size)
int vrend_renderer_export_query(uint32_t res_id,
struct virgl_renderer_export_query *export_query)
{
struct vrend_resource *res;
struct virgl_renderer_export_query *export_query = execute_args;
if (execute_size != sizeof(struct virgl_renderer_export_query))
return -EINVAL;
if (export_query->hdr.size != sizeof(struct virgl_renderer_export_query))
return -EINVAL;
res = vrend_renderer_res_lookup(export_query->in_resource_id);
res = vrend_renderer_res_lookup(res_id);
if (!res)
return -EINVAL;
@ -10288,39 +10283,3 @@ static int vrend_renderer_export_query(void *execute_args, uint32_t execute_size
return 0;
}
static int vrend_renderer_supported_structures(void *execute_args, uint32_t execute_size)
{
struct virgl_renderer_supported_structures *supported_structures = execute_args;
if (execute_size != sizeof(struct virgl_renderer_supported_structures))
return -EINVAL;
if (supported_structures->hdr.size != sizeof(struct virgl_renderer_supported_structures))
return -EINVAL;
if (supported_structures->in_stype_version == 0) {
supported_structures->out_supported_structures_mask =
VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY |
VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES;
} else {
supported_structures->out_supported_structures_mask = 0;
}
return 0;
}
int vrend_renderer_execute(void *execute_args, uint32_t execute_size)
{
struct virgl_renderer_hdr *hdr = execute_args;
if (hdr->stype_version != 0)
return -EINVAL;
switch (hdr->stype) {
case VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES:
return vrend_renderer_supported_structures(execute_args, execute_size);
case VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY:
return vrend_renderer_export_query(execute_args, execute_size);
default:
return -EINVAL;
}
}

@ -482,7 +482,8 @@ static const struct gl_version gl_versions[] = { {4,6}, {4,5}, {4,4}, {4,3}, {4,
extern struct vrend_if_cbs *vrend_clicbs;
int vrend_renderer_execute(void *execute_args, uint32_t execute_size);
int vrend_renderer_export_query(uint32_t res_id,
struct virgl_renderer_export_query *export_query);
void vrend_sync_make_current(virgl_gl_context);

Loading…
Cancel
Save