From 3ba4d3144e599d2b260e2b8246efc5e69d1a3518 Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Wed, 21 Dec 2011 19:45:31 +0900 Subject: [PATCH] [Title]add checking mesa library routine [Type]Enhancement [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- tizen/src/vtm.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tizen/src/vtm.h | 5 ++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/tizen/src/vtm.c b/tizen/src/vtm.c index e58210e..3167921 100644 --- a/tizen/src/vtm.c +++ b/tizen/src/vtm.c @@ -2333,6 +2333,65 @@ void construct_main_window(void) } +void set_mesa_lib(void) +{ + char *s_out = NULL; + char *s_err = NULL; + char *s_out2 = NULL; + char *s_err2 = NULL; + + int exit_status; + GError *err = NULL; + + if (!g_spawn_command_line_sync("cat /etc/issue", &s_out, &s_err, &exit_status, &err)) { + TRACE( "Failed to invoke command: %s\n", err->message); + show_message("Failed to invoke command", err->message); + g_error_free(err); + g_free(s_out); + g_free(s_err); + return ; + } + if (exit_status != 0) { + TRACE( "Command returns error: %s\n", s_out); + g_free(s_out); + g_free(s_err); + return; + } + + if (!g_spawn_command_line_sync("lspci", &s_out2, &s_err2, &exit_status, &err)) { + TRACE( "Failed to invoke command: %s\n", err->message); + show_message("Failed to invoke command", err->message); + g_error_free(err); + g_free(s_out); + g_free(s_err); + g_free(s_out2); + g_free(s_err2); + return ; + } + if (exit_status != 0) { + TRACE( "Command returns error: %s\n", s_out); + g_free(s_out); + g_free(s_err); + g_free(s_out2); + g_free(s_err2); + return; + } + + if(strstr(s_out, "10.10") && strstr(s_out2, "nVidia")) + { + INFO( "linux version :%s Set to use mesa lib\n", s_out); + g_setenv("LD_LIBRARY_PATH","/usr/lib/mesa:$LD_LIBRARY_PATH",1); + } + + g_free(s_out); + g_free(s_err); + g_free(s_out2); + g_free(s_err2); + return ; + +} + + int main(int argc, char** argv) { char* working_dir; @@ -2353,6 +2412,10 @@ int main(int argc, char** argv) INFO( "virtual target manager start \n"); socket_init(); + //if ubuntu 10.10 use mesa lib for opengl +#ifdef __linux__ + set_mesa_lib(); +#endif g_builder = gtk_builder_new(); skin = (char*)get_skin_path(); diff --git a/tizen/src/vtm.h b/tizen/src/vtm.h index 39c779d..09a1542 100644 --- a/tizen/src/vtm.h +++ b/tizen/src/vtm.h @@ -114,5 +114,8 @@ void entry_changed(GtkEditable *entry, gpointer data); void make_default_image(void); int check_shdmem(char *target_name, int type); int socket_init(void); -char* check_kvm(char *info_file, int *status); +char *check_kvm(char *info_file, int *status); +#ifdef __linux__ +void set_mesa_lib(void); +#endif #endif -- 2.7.4