renderer: return values from submit_cmd/decode block

makes easier to write unit tests.
macos/master
Dave Airlie 10 years ago
parent bc975ef808
commit cccbc3b5e4
  1. 8
      src/virglrenderer.c
  2. 6
      src/virglrenderer.h
  3. 16
      src/vrend_decode.c
  4. 2
      src/vrend_renderer.c
  5. 2
      src/vrend_renderer.h

@ -72,11 +72,11 @@ void virgl_renderer_context_destroy(uint32_t handle)
vrend_renderer_context_destroy(handle);
}
void virgl_renderer_submit_cmd(void *buffer,
int ctx_id,
int ndw)
int virgl_renderer_submit_cmd(void *buffer,
int ctx_id,
int ndw)
{
vrend_decode_block(ctx_id, buffer, ndw);
return vrend_decode_block(ctx_id, buffer, ndw);
}
int virgl_renderer_transfer_write_iov(uint32_t handle,

@ -92,9 +92,9 @@ VIRGL_EXPORT void virgl_renderer_resource_unref(uint32_t res_handle);
VIRGL_EXPORT int virgl_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name);
VIRGL_EXPORT void virgl_renderer_context_destroy(uint32_t handle);
VIRGL_EXPORT void virgl_renderer_submit_cmd(void *buffer,
int ctx_id,
int ndw);
VIRGL_EXPORT int virgl_renderer_submit_cmd(void *buffer,
int ctx_id,
int ndw);
VIRGL_EXPORT int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_id,
uint32_t level, uint32_t stride,

@ -1033,22 +1033,22 @@ struct vrend_context *vrend_lookup_renderer_ctx(uint32_t ctx_id)
return dec_ctx[ctx_id]->grctx;
}
void vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
{
struct vrend_decode_ctx *gdctx;
boolean bret;
int ret;
if (ctx_id > VREND_MAX_CTX)
return;
return EINVAL;
if (dec_ctx[ctx_id] == NULL)
return;
return EINVAL;
gdctx = dec_ctx[ctx_id];
bret = vrend_hw_switch_context(gdctx->grctx, TRUE);
if (bret == FALSE)
return;
return EINVAL;
gdctx->ds->buf = block;
gdctx->ds->buf_total = ndw;
@ -1161,13 +1161,15 @@ void vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
if (ret == EINVAL) {
vrend_report_buffer_error(gdctx->grctx, header);
break;
goto out;
}
if (ret == ENOMEM)
break;
goto out;
gdctx->ds->buf_offset += (len) + 1;
}
return 0;
out:
return ret;
}
void vrend_decode_reset(bool ctx_0_only)

@ -393,7 +393,7 @@ static inline const char *pipe_shader_to_prefix(int shader_type)
return NULL;
}
static const char *vrend_ctx_error_strings[] = { "None", "Unknown", "Illegal shader", "Illegal handle", "Illegal resource", "Illegal surface", "Illegal vertex format" };
static const char *vrend_ctx_error_strings[] = { "None", "Unknown", "Illegal shader", "Illegal handle", "Illegal resource", "Illegal surface", "Illegal vertex format", "Illegal command buffer" };
static void __report_context_error(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value)
{

@ -281,7 +281,7 @@ void vrend_transfer_write_tex_return(struct pipe_resource *res,
void vrend_renderer_fini(void);
void vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw);
int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw);
struct vrend_context *vrend_lookup_renderer_ctx(uint32_t ctx_id);
int vrend_renderer_create_fence(int client_fence_id, uint32_t ctx_id);

Loading…
Cancel
Save