diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 8f9c90b..0589920 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -326,22 +326,19 @@ int virgl_renderer_resource_get_info(int res_handle, struct virgl_renderer_resource_info *info) { struct virgl_resource *res = virgl_resource_lookup(res_handle); - int ret; if (!res || !res->pipe_resource) return EINVAL; if (!info) return EINVAL; - ret = vrend_renderer_resource_get_info(res->pipe_resource, - (struct vrend_renderer_resource_info *)info); + vrend_renderer_resource_get_info(res->pipe_resource, + (struct vrend_renderer_resource_info *)info); info->handle = res_handle; -#ifdef HAVE_EPOXY_EGL_H - if (ret == 0 && use_context == CONTEXT_EGL) - return virgl_egl_get_fourcc_for_texture(egl, info->tex_id, info->virgl_format, &info->drm_fourcc); -#endif - return ret; + return vrend_winsys_get_fourcc_for_texture(info->tex_id, + info->virgl_format, + &info->drm_fourcc); } void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver, diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index d3e9158..a282c28 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -10302,8 +10302,8 @@ void vrend_context_set_debug_flags(struct vrend_context *ctx, const char *flagst } } -int vrend_renderer_resource_get_info(struct pipe_resource *pres, - struct vrend_renderer_resource_info *info) +void vrend_renderer_resource_get_info(struct pipe_resource *pres, + struct vrend_renderer_resource_info *info) { struct vrend_resource *res = (struct vrend_resource *)pres; int elsize; @@ -10317,8 +10317,6 @@ int vrend_renderer_resource_get_info(struct pipe_resource *pres, info->format = res->base.format; info->flags = res->y_0_top ? VIRGL_RESOURCE_Y_0_TOP : 0; info->stride = util_format_get_nblocksx(res->base.format, u_minify(res->base.width0, 0)) * elsize; - - return 0; } void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver, diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index 8497221..1e36eaf 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -418,8 +418,8 @@ struct vrend_renderer_resource_info { uint32_t stride; }; -int vrend_renderer_resource_get_info(struct pipe_resource *pres, - struct vrend_renderer_resource_info *info); +void vrend_renderer_resource_get_info(struct pipe_resource *pres, + struct vrend_renderer_resource_info *info); #define VREND_CAP_SET 1 #define VREND_CAP_SET2 2 diff --git a/src/vrend_winsys.c b/src/vrend_winsys.c index 062ca90..f3c3073 100644 --- a/src/vrend_winsys.c +++ b/src/vrend_winsys.c @@ -90,3 +90,12 @@ int vrend_winsys_has_gl_colorspace(void) use_context == CONTEXT_GLX || (use_context == CONTEXT_EGL && egl_colorspace); } + +int vrend_winsys_get_fourcc_for_texture(uint32_t tex_id, uint32_t format, int *fourcc) +{ +#ifdef HAVE_EPOXY_EGL_H + if (use_context == CONTEXT_EGL) + return virgl_egl_get_fourcc_for_texture(egl, tex_id, format, fourcc); +#endif + return 0; +} diff --git a/src/vrend_winsys.h b/src/vrend_winsys.h index 7bc08e4..246ff53 100644 --- a/src/vrend_winsys.h +++ b/src/vrend_winsys.h @@ -63,4 +63,6 @@ int vrend_winsys_make_context_current(virgl_renderer_gl_context ctx); int vrend_winsys_has_gl_colorspace(void); +int vrend_winsys_get_fourcc_for_texture(uint32_t tex_id, uint32_t format, int *fourcc); + #endif /* VREND_WINSYS_H */