vrend: add vrend_winsys_get_fourcc_for_texture

It is a wrapper for virgl_egl_get_fourcc_for_texture.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent 5df70a5abe
commit 7fc8530bf3
  1. 13
      src/virglrenderer.c
  2. 6
      src/vrend_renderer.c
  3. 4
      src/vrend_renderer.h
  4. 9
      src/vrend_winsys.c
  5. 2
      src/vrend_winsys.h

@ -326,22 +326,19 @@ int virgl_renderer_resource_get_info(int res_handle,
struct virgl_renderer_resource_info *info) struct virgl_renderer_resource_info *info)
{ {
struct virgl_resource *res = virgl_resource_lookup(res_handle); struct virgl_resource *res = virgl_resource_lookup(res_handle);
int ret;
if (!res || !res->pipe_resource) if (!res || !res->pipe_resource)
return EINVAL; return EINVAL;
if (!info) if (!info)
return EINVAL; return EINVAL;
ret = vrend_renderer_resource_get_info(res->pipe_resource, vrend_renderer_resource_get_info(res->pipe_resource,
(struct vrend_renderer_resource_info *)info); (struct vrend_renderer_resource_info *)info);
info->handle = res_handle; 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, void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,

@ -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, void vrend_renderer_resource_get_info(struct pipe_resource *pres,
struct vrend_renderer_resource_info *info) struct vrend_renderer_resource_info *info)
{ {
struct vrend_resource *res = (struct vrend_resource *)pres; struct vrend_resource *res = (struct vrend_resource *)pres;
int elsize; int elsize;
@ -10317,8 +10317,6 @@ int vrend_renderer_resource_get_info(struct pipe_resource *pres,
info->format = res->base.format; info->format = res->base.format;
info->flags = res->y_0_top ? VIRGL_RESOURCE_Y_0_TOP : 0; 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; 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, void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,

@ -418,8 +418,8 @@ struct vrend_renderer_resource_info {
uint32_t stride; uint32_t stride;
}; };
int vrend_renderer_resource_get_info(struct pipe_resource *pres, void vrend_renderer_resource_get_info(struct pipe_resource *pres,
struct vrend_renderer_resource_info *info); struct vrend_renderer_resource_info *info);
#define VREND_CAP_SET 1 #define VREND_CAP_SET 1
#define VREND_CAP_SET2 2 #define VREND_CAP_SET2 2

@ -90,3 +90,12 @@ int vrend_winsys_has_gl_colorspace(void)
use_context == CONTEXT_GLX || use_context == CONTEXT_GLX ||
(use_context == CONTEXT_EGL && egl_colorspace); (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;
}

@ -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_has_gl_colorspace(void);
int vrend_winsys_get_fourcc_for_texture(uint32_t tex_id, uint32_t format, int *fourcc);
#endif /* VREND_WINSYS_H */ #endif /* VREND_WINSYS_H */

Loading…
Cancel
Save