summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-03-03 18:46:48 +0100
committerDave Airlie <airlied@redhat.com>2016-03-07 13:47:50 +1000
commit2cef5fdfe4f3a7d303e706e39b301954107c87e2 (patch)
treecf6dae5f6ecfaf93f58ff80670dda420a4072786
parent6762e547db406ca7d99f7c342cf608b42875b58a (diff)
renderer: fix compilation if egl isn't supported
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r--src/Makefile.am6
-rw-r--r--src/virglrenderer.c25
2 files changed, 29 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9128ec5..0b564f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,9 +29,13 @@ libvrend_la_SOURCES = \
vrend_formats.c \
vrend_blitter.c \
vrend_blitter.h \
- iov.c \
+ iov.c
+
+if !OS_WIN32
+libvrend_la_SOURCES += \
virgl_egl.h \
virgl_egl_context.c
+endif
lib_LTLIBRARIES = libvirglrenderer.la
noinst_LTLIBRARIES = libvrend.la
diff --git a/src/virglrenderer.c b/src/virglrenderer.c
index 05a922b..c40a1ed 100644
--- a/src/virglrenderer.c
+++ b/src/virglrenderer.c
@@ -41,10 +41,12 @@
#include "vrend_renderer.h"
#include "virglrenderer.h"
-#include "virgl_egl.h"
+#ifdef HAVE_EPOXY_EGL_H
+#include "virgl_egl.h"
static struct virgl_egl *egl_info;
static int use_egl_context;
+#endif
/* new API - just wrap internal API for now */
@@ -164,8 +166,11 @@ 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);
+#ifdef HAVE_EPOXY_EGL_H
if (ret == 0 && use_egl_context)
return virgl_egl_get_fourcc_for_texture(egl_info, info->tex_id, info->virgl_format, &info->drm_fourcc);
+#endif
+
return ret;
}
@@ -196,8 +201,11 @@ static void virgl_write_fence(uint32_t fence_id)
static virgl_renderer_gl_context create_gl_context(int scanout_idx, struct virgl_gl_ctx_param *param)
{
struct virgl_renderer_gl_ctx_param vparam;
+
+#ifdef HAVE_EPOXY_EGL_H
if (use_egl_context)
return virgl_egl_create_context(egl_info, param);
+#endif
vparam.version = 1;
vparam.shared = param->shared;
vparam.major_ver = param->major_ver;
@@ -207,15 +215,19 @@ static virgl_renderer_gl_context create_gl_context(int scanout_idx, struct virgl
static void destroy_gl_context(virgl_renderer_gl_context ctx)
{
+#ifdef HAVE_EPOXY_EGL_H
if (use_egl_context)
return virgl_egl_destroy_context(egl_info, ctx);
+#endif
return rcbs->destroy_gl_context(dev_cookie, ctx);
}
static int make_current(int scanout_idx, virgl_renderer_gl_context ctx)
{
+#ifdef HAVE_EPOXY_EGL_H
if (use_egl_context)
return virgl_egl_make_context_current(egl_info, ctx);
+#endif
return rcbs->make_current(dev_cookie, scanout_idx, ctx);
}
@@ -240,11 +252,13 @@ void virgl_renderer_poll(void)
void virgl_renderer_cleanup(void *cookie)
{
vrend_renderer_fini();
+#ifdef HAVE_EPOXY_EGL_H
if (use_egl_context) {
virgl_egl_destroy(egl_info);
egl_info = NULL;
use_egl_context = 0;
}
+#endif
}
int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cbs)
@@ -260,10 +274,15 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
rcbs = cbs;
if (flags & VIRGL_RENDERER_USE_EGL) {
+#ifdef HAVE_EPOXY_EGL_H
egl_info = virgl_egl_init();
if (!egl_info)
return -1;
use_egl_context = 1;
+#else
+ fprintf(stderr, "EGL is not supported on this platform\n");
+ return -1;
+#endif
}
if (flags & VIRGL_RENDERER_THREAD_SYNC)
@@ -274,7 +293,11 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
int virgl_renderer_get_fd_for_texture(uint32_t tex_id, int *fd)
{
+#ifdef HAVE_EPOXY_EGL_H
return virgl_egl_get_fd_for_texture(egl_info, tex_id, fd);
+#else
+ return -1;
+#endif
}
void virgl_renderer_reset(void)