virgl: move resource table init out of vrend

The resource table should not be tied to vrend.

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 fadf5528d9
commit b5777196d5
  1. 30
      src/virglrenderer.c
  2. 3
      src/vrend_renderer.c
  3. 3
      src/vrend_renderer.h

@ -439,14 +439,15 @@ void virgl_renderer_poll(void)
void virgl_renderer_cleanup(UNUSED void *cookie)
{
if (state.vrend_initialized) {
if (state.vrend_initialized)
vrend_renderer_prepare_reset();
virgl_context_table_reset();
virgl_resource_table_cleanup();
vrend_renderer_fini();
}
virgl_context_table_cleanup();
virgl_resource_table_cleanup();
if (state.vrend_initialized)
vrend_renderer_fini();
vrend_winsys_cleanup();
memset(&state, 0, sizeof(state));
@ -475,8 +476,13 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
if (ret)
return ret;
if (virgl_context_table_init())
return -1;
ret = virgl_resource_table_init(vrend_renderer_get_pipe_callbacks());
if (ret)
return ret;
ret = virgl_context_table_init();
if (ret)
return ret;
if (!state.vrend_initialized) {
uint32_t renderer_flags = 0;
@ -507,12 +513,14 @@ int virgl_renderer_get_fd_for_texture2(uint32_t tex_id, int *fd, int *stride, in
void virgl_renderer_reset(void)
{
if (state.vrend_initialized) {
if (state.vrend_initialized)
vrend_renderer_prepare_reset();
virgl_context_table_reset();
virgl_resource_table_reset();
virgl_context_table_reset();
virgl_resource_table_reset();
if (state.vrend_initialized)
vrend_renderer_reset();
}
}
int virgl_renderer_get_poll_fd(void)

@ -5907,7 +5907,7 @@ static enum virgl_resource_fd_type vrend_pipe_resource_export_fd(UNUSED struct p
return VIRGL_RESOURCE_FD_INVALID;
}
static const struct virgl_resource_pipe_callbacks *
const struct virgl_resource_pipe_callbacks *
vrend_renderer_get_pipe_callbacks(void)
{
static const struct virgl_resource_pipe_callbacks callbacks = {
@ -5937,7 +5937,6 @@ int vrend_renderer_init(const struct vrend_if_cbs *cbs, uint32_t flags)
virgl_gl_context gl_context;
struct virgl_gl_ctx_param ctx_params;
virgl_resource_table_init(vrend_renderer_get_pipe_callbacks());
vrend_clicbs = cbs;
/* Give some defaults to be able to run the tests */

@ -122,6 +122,9 @@ struct vrend_if_cbs {
#define VREND_USE_THREAD_SYNC 1
#define VREND_USE_EXTERNAL_BLOB 2
const struct virgl_resource_pipe_callbacks *
vrend_renderer_get_pipe_callbacks(void);
int vrend_renderer_init(const struct vrend_if_cbs *cbs, uint32_t flags);
void vrend_insert_format(struct vrend_format_table *entry, uint32_t bindings, uint32_t flags);

Loading…
Cancel
Save