renderer: fixup get_info interface

don't overwrite memory if we get a bad res or info,
return the gbm and virgl formats
use errno return values
macos/master
Dave Airlie 10 years ago
parent c396c1af7e
commit 8b423dc28a
  1. 5
      src/virglrenderer.c
  2. 3
      src/virglrenderer.h
  3. 7
      src/vrend_renderer.c

@ -141,8 +141,9 @@ int virgl_renderer_resource_get_info(int res_handle,
{
int ret;
ret = vrend_renderer_resource_get_info(res_handle, (struct vrend_renderer_resource_info *)info);
info->format = virgl_egl_get_gbm_format(info->format);
return ret;
if (ret == 0)
info->gbm_format = virgl_egl_get_gbm_format(info->virgl_format);
return ret;
}
void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,

@ -134,13 +134,14 @@ VIRGL_EXPORT void virgl_renderer_ctx_detach_resource(int ctx_id, int res_handle)
struct virgl_renderer_resource_info {
uint32_t handle;
uint32_t format;
uint32_t virgl_format;
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t flags;
uint32_t tex_id;
uint32_t stride;
uint32_t gbm_format;
};
VIRGL_EXPORT int virgl_renderer_resource_get_info(int res_handle,

@ -5383,11 +5383,14 @@ static struct vrend_resource *vrend_renderer_ctx_res_lookup(struct vrend_context
int vrend_renderer_resource_get_info(int res_handle,
struct vrend_renderer_resource_info *info)
{
struct vrend_resource *res = vrend_resource_lookup(res_handle, 0);
struct vrend_resource *res;
int elsize;
if (!info)
return EINVAL;
res = vrend_resource_lookup(res_handle, 0);
if (!res)
return -1;
return EINVAL;
elsize = util_format_get_blocksize(res->base.format);

Loading…
Cancel
Save