diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 588cd79..36ea31d 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -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; + } } diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 4aad24f..41f9706 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -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; - } -} diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index 7ed0e4b..a2645b2 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -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);