summaryrefslogtreecommitdiff
path: root/hw/yagl
diff options
context:
space:
mode:
authorjinhyung.jo <jinhyung.jo@samsung.com>2015-07-03 20:36:10 +0900
committerjinhyung.jo <jinhyung.jo@samsung.com>2015-07-06 13:28:11 +0900
commitfa9eafde5ed0c25dd861891a657433247ad3b86a (patch)
treedb687482872bea671aece5672f8598ee481d993c /hw/yagl
parent79730592c22ad52d090cbe4699b2f3f50f9bd26c (diff)
downloadqemu-fa9eafde5ed0c25dd861891a657433247ad3b86a.tar.gz
qemu-fa9eafde5ed0c25dd861891a657433247ad3b86a.tar.bz2
qemu-fa9eafde5ed0c25dd861891a657433247ad3b86a.zip
VIGS/YaGL: gl_version property added
Modified to use the device property instead of using the environment variable, GL_VERSION. Change-Id: I16eaa1b5d4775bf45fe7eb38c6a980c031a55768 Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
Diffstat (limited to 'hw/yagl')
-rw-r--r--hw/yagl/yagl_device.c4
-rw-r--r--hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c19
-rw-r--r--hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c25
-rw-r--r--hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c25
-rw-r--r--hw/yagl/yagl_egl_driver.h3
5 files changed, 41 insertions, 35 deletions
diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c
index 60fbfc8c9f..a2a3b50c96 100644
--- a/hw/yagl/yagl_device.c
+++ b/hw/yagl/yagl_device.c
@@ -72,6 +72,7 @@ typedef struct YaGLState
char *display;
char *render_queue;
char *wsi;
+ char *gl_version;
MemoryRegion iomem;
struct yagl_server_state *ss;
struct yagl_user users[YAGL_MAX_USERS];
@@ -293,7 +294,7 @@ static int yagl_device_init(PCIDevice *dev)
yagl_handle_gen_init();
- egl_driver = yagl_egl_driver_create(dobj->dpy);
+ egl_driver = yagl_egl_driver_create(dobj->dpy, s->gl_version);
if (!egl_driver) {
goto fail;
@@ -399,6 +400,7 @@ static Property yagl_properties[] = {
DEFINE_PROP_STRING("display", YaGLState, display),
DEFINE_PROP_STRING("render_queue", YaGLState, render_queue),
DEFINE_PROP_STRING("wsi", YaGLState, wsi),
+ DEFINE_PROP_STRING("gl_version", YaGLState, gl_version),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c
index 3baf505f03..75b0462665 100644
--- a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c
+++ b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c
@@ -147,30 +147,28 @@ static CGLError yagl_egl_cgl_choose_pixel_format(const CGLPixelFormatAttribute p
}
static bool yagl_egl_cgl_get_gl_version(struct yagl_egl_cgl *egl_cgl,
+ const char *gl_version,
yagl_gl_version *version)
{
CGLError error;
bool res = false;
- const char *tmp;
CGLPixelFormatObj pixel_format;
int n;
unsigned int i;
YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_get_gl_version, NULL);
- tmp = getenv("GL_VERSION");
-
- if (tmp) {
- if (strcmp(tmp, "2") == 0) {
+ if (gl_version) {
+ if (strcmp(gl_version, "2") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 2.1");
*version = yagl_gl_2;
res = true;
- } else if (strcmp(tmp, "3_2") == 0) {
+ } else if (strcmp(gl_version, "3_2") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.2");
*version = yagl_gl_3_2;
res = true;
} else {
- YAGL_LOG_CRITICAL("Bad GL_VERSION value = %s", tmp);
+ YAGL_LOG_CRITICAL("Bad GL_VERSION value = %s", gl_version);
}
goto out;
@@ -510,7 +508,8 @@ static void yagl_egl_cgl_destroy(struct yagl_egl_driver *driver)
YAGL_LOG_FUNC_EXIT(NULL);
}
-struct yagl_egl_driver *yagl_egl_driver_create(void *display)
+struct yagl_egl_driver *yagl_egl_driver_create(void *display,
+ const char *gl_version)
{
CGLError error;
struct yagl_egl_cgl *egl_cgl;
@@ -534,7 +533,9 @@ struct yagl_egl_driver *yagl_egl_driver_create(void *display)
goto fail;
}
- if (!yagl_egl_cgl_get_gl_version(egl_cgl, &egl_cgl->base.gl_version)) {
+ if (!yagl_egl_cgl_get_gl_version(egl_cgl,
+ gl_version,
+ &egl_cgl->base.gl_version)) {
goto fail;
}
diff --git a/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c b/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c
index 08afac4892..9ce4bfdb93 100644
--- a/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c
+++ b/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c
@@ -134,6 +134,7 @@ static const char *gl_3_2_check_funcs[] =
};
static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
+ const char *gl_version,
yagl_gl_version *version)
{
int config_attribs[] =
@@ -174,7 +175,6 @@ static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
None
};
bool res = false;
- const char *tmp;
int n = 0;
GLXFBConfig *configs = NULL;
GLXContext ctx = NULL;
@@ -186,27 +186,25 @@ static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
YAGL_EGL_GLX_ENTER(yagl_egl_glx_get_gl_version, NULL);
- tmp = getenv("GL_VERSION");
-
- if (tmp) {
- if (strcmp(tmp, "2") == 0) {
+ if (gl_version) {
+ if (strcmp(gl_version, "2") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 2.1");
*version = yagl_gl_2;
res = true;
- } else if (strcmp(tmp, "3_1") == 0) {
+ } else if (strcmp(gl_version, "3_1") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.1");
*version = yagl_gl_3_1;
res = true;
- } else if (strcmp(tmp, "3_1_es3") == 0) {
+ } else if (strcmp(gl_version, "3_1_es3") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.1 ES3");
*version = yagl_gl_3_1_es3;
res = true;
- } else if (strcmp(tmp, "3_2") == 0) {
+ } else if (strcmp(gl_version, "3_2") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.2");
*version = yagl_gl_3_2;
res = true;
} else {
- YAGL_LOG_CRITICAL("Bad GL_VERSION value = %s", tmp);
+ YAGL_LOG_CRITICAL("Bad GL_VERSION value = %s", gl_version);
}
goto out;
@@ -284,7 +282,7 @@ static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
GetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
for (i = 0; i < num_extensions; ++i) {
- tmp = (const char*)GetStringi(GL_EXTENSIONS, i);
+ const char *tmp = (const char *)GetStringi(GL_EXTENSIONS, i);
if (strcmp(tmp, "GL_ARB_ES3_compatibility") == 0) {
YAGL_LOG_INFO("GL_ARB_ES3_compatibility supported, using OpenGL 3.1 ES3");
*version = yagl_gl_3_1_es3;
@@ -729,7 +727,8 @@ static void yagl_egl_glx_destroy(struct yagl_egl_driver *driver)
YAGL_LOG_FUNC_EXIT(NULL);
}
-struct yagl_egl_driver *yagl_egl_driver_create(void *display)
+struct yagl_egl_driver *yagl_egl_driver_create(void *display,
+ const char *gl_version)
{
struct yagl_egl_driver *egl_driver;
struct yagl_egl_glx *egl_glx;
@@ -805,7 +804,9 @@ struct yagl_egl_driver *yagl_egl_driver_create(void *display)
/* GLX_ARB_create_context */
YAGL_EGL_GLX_GET_PROC(PFNGLXCREATECONTEXTATTRIBSARBPROC, glXCreateContextAttribsARB);
- if (!yagl_egl_glx_get_gl_version(egl_glx, &egl_glx->base.gl_version)) {
+ if (!yagl_egl_glx_get_gl_version(egl_glx,
+ gl_version,
+ &egl_glx->base.gl_version)) {
goto fail;
}
diff --git a/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c b/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c
index 0c6ca47da6..ca64baa9cc 100644
--- a/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c
+++ b/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c
@@ -137,6 +137,7 @@ static const char *gl_3_2_check_funcs[] =
};
static bool yagl_egl_wgl_get_gl_version(YaglEglWglDriver *egl_wgl,
+ const char *gl_version,
yagl_gl_version *version)
{
int config_attribs[] = {
@@ -176,7 +177,6 @@ static bool yagl_egl_wgl_get_gl_version(YaglEglWglDriver *egl_wgl,
0
};
bool res = false;
- const char *tmp;
HWND win;
HDC dc;
int config_id = 0;
@@ -192,27 +192,25 @@ static bool yagl_egl_wgl_get_gl_version(YaglEglWglDriver *egl_wgl,
YAGL_EGL_WGL_ENTER(yagl_egl_wgl_get_gl_version, NULL);
- tmp = getenv("GL_VERSION");
-
- if (tmp) {
- if (strcmp(tmp, "2") == 0) {
+ if (gl_version) {
+ if (strcmp(gl_version, "2") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 2.1");
*version = yagl_gl_2;
res = true;
- } else if (strcmp(tmp, "3_1") == 0) {
+ } else if (strcmp(gl_version, "3_1") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.1");
*version = yagl_gl_3_1;
res = true;
- } else if (strcmp(tmp, "3_1_es3") == 0) {
+ } else if (strcmp(gl_version, "3_1_es3") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.1 ES3");
*version = yagl_gl_3_1_es3;
res = true;
- } else if (strcmp(tmp, "3_2") == 0) {
+ } else if (strcmp(gl_version, "3_2") == 0) {
YAGL_LOG_INFO("GL_VERSION forces OpenGL version to 3.2");
*version = yagl_gl_3_2;
res = true;
} else {
- YAGL_LOG_CRITICAL("Bad GL_VERSION value = %s", tmp);
+ YAGL_LOG_CRITICAL("Bad GL_VERSION value = %s", gl_version);
}
goto out1;
@@ -320,7 +318,7 @@ static bool yagl_egl_wgl_get_gl_version(YaglEglWglDriver *egl_wgl,
GetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
for (i = 0; i < num_extensions; ++i) {
- tmp = (const char*)GetStringi(GL_EXTENSIONS, i);
+ const char *tmp = (const char *)GetStringi(GL_EXTENSIONS, i);
if (strcmp(tmp, "GL_ARB_ES3_compatibility") == 0) {
YAGL_LOG_INFO("GL_ARB_ES3_compatibility supported, using OpenGL 3.1 ES3");
*version = yagl_gl_3_1_es3;
@@ -1132,7 +1130,8 @@ out:
return ext_initialized;
}
-struct yagl_egl_driver *yagl_egl_driver_create(void *display)
+struct yagl_egl_driver *yagl_egl_driver_create(void *display,
+ const char *gl_version)
{
YaglEglWglDriver *egl_wgl;
struct yagl_egl_driver *egl_driver;
@@ -1198,7 +1197,9 @@ struct yagl_egl_driver *yagl_egl_driver_create(void *display)
goto fail;
}
- if (!yagl_egl_wgl_get_gl_version(egl_wgl, &egl_wgl->base.gl_version)) {
+ if (!yagl_egl_wgl_get_gl_version(egl_wgl,
+ gl_version,
+ &egl_wgl->base.gl_version)) {
goto fail;
}
diff --git a/hw/yagl/yagl_egl_driver.h b/hw/yagl/yagl_egl_driver.h
index cbee5dac79..5c886364e6 100644
--- a/hw/yagl/yagl_egl_driver.h
+++ b/hw/yagl/yagl_egl_driver.h
@@ -111,7 +111,8 @@ struct yagl_egl_driver
/*
* 'display' is Display* on linux and HWND on windows.
*/
-struct yagl_egl_driver *yagl_egl_driver_create(void *display);
+struct yagl_egl_driver *yagl_egl_driver_create(void *display,
+ const char *gl_version);
void yagl_egl_driver_init(struct yagl_egl_driver *driver);
void yagl_egl_driver_cleanup(struct yagl_egl_driver *driver);