diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 8458b21..5c57233 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -774,7 +774,13 @@ int virgl_renderer_resource_get_map_info(uint32_t res_handle, uint32_t *map_info if (!res || !res->pipe_resource) return -EINVAL; - return vrend_renderer_resource_get_map_info(res->pipe_resource, map_info); + uint32_t info = vrend_renderer_resource_get_map_info(res->pipe_resource); + if ((info & VIRGL_RENDERER_MAP_CACHE_MASK) == + VIRGL_RENDERER_MAP_CACHE_NONE) + return -EINVAL; + + *map_info = info; + return 0; } int diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index b76c771..d1b1cd6 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -10638,14 +10638,10 @@ struct pipe_resource *vrend_get_blob_pipe(struct vrend_context *ctx, uint64_t bl return NULL; } -int vrend_renderer_resource_get_map_info(struct pipe_resource *pres, uint32_t *map_info) +uint32_t vrend_renderer_resource_get_map_info(struct pipe_resource *pres) { struct vrend_resource *res = (struct vrend_resource *)pres; - if (!res->map_info) - return -EINVAL; - - *map_info = res->map_info; - return 0; + return res->map_info; } int vrend_renderer_resource_map(struct pipe_resource *pres, void **map, uint64_t *out_size) diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index 3195f94..ba4bc54 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -492,7 +492,7 @@ vrend_renderer_pipe_resource_create(struct vrend_context *ctx, uint32_t blob_id, struct pipe_resource *vrend_get_blob_pipe(struct vrend_context *ctx, uint64_t blob_id); -int vrend_renderer_resource_get_map_info(struct pipe_resource *pres, uint32_t *map_info); +uint32_t vrend_renderer_resource_get_map_info(struct pipe_resource *pres); int vrend_renderer_resource_map(struct pipe_resource *pres, void **map, uint64_t *out_size);