vrend: remove vrend_renderer_res_lookup

Move resource lookup up from vrend to virglrenderer for
vrend_renderer_export_query.  Now that the last user of
vrend_renderer_res_lookup is gone, we can remove the helper.

After this change, it becomes clear that vrend deals with
vrend_resource mostly.  The only exceptions are the
virgl_context::{attach_resource,detach_resource,transfer_3d}
callbacks.

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 ea5d7a9148
commit ca00a33c4c
  1. 7
      src/virglrenderer.c
  2. 16
      src/vrend_renderer.c
  3. 2
      src/vrend_renderer.h

@ -550,6 +550,7 @@ virgl_debug_callback_type virgl_set_debug_callback(virgl_debug_callback_type cb)
static int virgl_renderer_export_query(void *execute_args, uint32_t execute_size)
{
struct virgl_resource *res;
struct virgl_renderer_export_query *export_query = execute_args;
if (execute_size != sizeof(struct virgl_renderer_export_query))
return -EINVAL;
@ -557,7 +558,11 @@ static int virgl_renderer_export_query(void *execute_args, uint32_t execute_size
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);
res = virgl_resource_lookup(export_query->in_resource_id);
if (!res || !res->pipe_resource)
return -EINVAL;
return vrend_renderer_export_query(res->pipe_resource, export_query);
}
static int virgl_renderer_supported_structures(void *execute_args, uint32_t execute_size)

@ -6115,12 +6115,6 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de
return grctx;
}
static struct vrend_resource *vrend_renderer_res_lookup(uint32_t res_id)
{
struct virgl_resource *res = virgl_resource_lookup(res_id);
return (struct vrend_resource *) (res ? res->pipe_resource : NULL);
}
static int check_resource_valid(struct vrend_renderer_resource_create_args *args,
char errmsg[256])
{
@ -10258,18 +10252,16 @@ int vrend_renderer_get_poll_fd(void)
return vrend_state.eventfd;
}
int vrend_renderer_export_query(uint32_t res_id,
int vrend_renderer_export_query(struct pipe_resource *pres,
struct virgl_renderer_export_query *export_query)
{
struct vrend_resource *res;
res = vrend_renderer_res_lookup(res_id);
if (!res)
return -EINVAL;
struct vrend_resource *res = (struct vrend_resource *)pres;
#ifdef ENABLE_MINIGBM_ALLOCATION
if (res->gbm_bo)
return virgl_gbm_export_query(res->gbm_bo, export_query);
#else
(void)res;
#endif
/*

@ -482,7 +482,7 @@ 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_export_query(uint32_t res_id,
int vrend_renderer_export_query(struct pipe_resource *pres,
struct virgl_renderer_export_query *export_query);
void vrend_sync_make_current(virgl_gl_context);

Loading…
Cancel
Save