vrend: Move virgl_has_gl_colorspace and dependencies to vrend_renderer.c

The function is used from vrend_renderer.c, so it also should be
part of the libvrend.la conveniance library. This requires that the
CONTEXT enums and the variable egl are also part of this library.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
macos/master
Gert Wollny 5 years ago
parent 72ef431508
commit dcf1408c97
  1. 21
      src/virglrenderer.c
  2. 19
      src/vrend_renderer.c
  3. 12
      src/vrend_renderer.h

@ -42,7 +42,6 @@
#include "virgl_gbm.h"
#include "virgl_egl.h"
struct virgl_gbm *gbm = NULL;
struct virgl_egl *egl = NULL;
#endif
#ifdef HAVE_EPOXY_GLX_H
@ -50,14 +49,6 @@ struct virgl_egl *egl = NULL;
static struct virgl_glx *glx_info;
#endif
enum {
CONTEXT_NONE,
CONTEXT_EGL,
CONTEXT_GLX
};
static int use_context = CONTEXT_NONE;
/* new API - just wrap internal API for now */
int virgl_renderer_resource_create(struct virgl_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs)
@ -207,18 +198,6 @@ int virgl_renderer_resource_get_info(int res_handle,
return ret;
}
int virgl_has_gl_colorspace(void)
{
bool egl_colorspace = false;
#ifdef HAVE_EPOXY_EGL_H
if (egl)
egl_colorspace = virgl_has_egl_khr_gl_colorspace(egl);
#endif
return use_context == CONTEXT_NONE ||
use_context == CONTEXT_GLX ||
(use_context == CONTEXT_EGL && egl_colorspace);
}
void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,
uint32_t *max_size)
{

@ -68,6 +68,8 @@ extern struct virgl_egl *egl;
/* debugging via KHR_debug extension */
int vrend_use_debug_cb = 0;
int use_context = CONTEXT_NONE;
static const uint32_t fake_occlusion_query_samples_passed_default = 1024;
struct vrend_if_cbs *vrend_clicbs;
@ -9913,6 +9915,23 @@ void vrend_print_context_name(struct vrend_context *ctx)
vrend_printf("HOST: ");
}
#ifdef HAVE_EPOXY_EGL_H
struct virgl_egl *egl = NULL;
#endif
int virgl_has_gl_colorspace(void)
{
bool egl_colorspace = false;
#ifdef HAVE_EPOXY_EGL_H
if (egl)
egl_colorspace = virgl_has_egl_khr_gl_colorspace(egl);
#endif
return use_context == CONTEXT_NONE ||
use_context == CONTEXT_GLX ||
(use_context == CONTEXT_EGL && egl_colorspace);
}
void vrend_renderer_destroy_sub_ctx(struct vrend_context *ctx, int sub_ctx_id)
{
struct vrend_sub_context *sub, *tofree = NULL;

@ -61,6 +61,18 @@ enum vrend_resource_storage_type {
VREND_RESOURCE_STORAGE_GBM_ONLY,
};
enum {
CONTEXT_NONE,
CONTEXT_EGL,
CONTEXT_GLX
};
extern int use_context;
#ifdef HAVE_EPOXY_EGL_H
extern struct virgl_egl *egl;
#endif
struct vrend_resource {
struct pipe_resource base;
GLuint id;

Loading…
Cancel
Save