renderer: cleanup context create errors and context destroy

macos/master
Dave Airlie 10 years ago
parent d30144b6aa
commit 3d91ff730e
  1. 3
      src/virglrenderer.c
  2. 10
      src/vrend_decode.c
  3. 2
      src/vrend_renderer.h

@ -62,8 +62,7 @@ void virgl_renderer_fill_caps(uint32_t set, uint32_t version,
int virgl_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name)
{
vrend_renderer_context_create(handle, nlen, name);
return 0;
return vrend_renderer_context_create(handle, nlen, name);
}
void virgl_renderer_context_destroy(uint32_t handle)

@ -985,25 +985,29 @@ void vrend_renderer_context_create_internal(uint32_t handle, uint32_t nlen,
dec_ctx[handle] = dctx;
}
void vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *debug_name)
int vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *debug_name)
{
if (handle > VREND_MAX_CTX)
return;
return EINVAL;
/* context 0 is always available with no guarantees */
if (handle == 0)
return;
return EINVAL;
vrend_renderer_context_create_internal(handle, nlen, debug_name);
return 0;
}
void vrend_renderer_context_destroy(uint32_t handle)
{
struct vrend_decode_ctx *ctx;
bool ret;
if (handle > VREND_MAX_CTX)
return;
ctx = dec_ctx[handle];
if (!ctx)
return;
dec_ctx[handle] = NULL;
ret = vrend_destroy_context(ctx->grctx);
free(ctx);

@ -124,7 +124,7 @@ void vrend_flush(struct vrend_context *ctx);
void vrend_flush_frontbuffer(uint32_t res_handle);
struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name);
bool vrend_destroy_context(struct vrend_context *ctx);
void vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name);
int vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name);
void vrend_renderer_context_create_internal(uint32_t handle, uint32_t nlen, const char *name);
void vrend_renderer_context_destroy(uint32_t handle);

Loading…
Cancel
Save