[Title] add open gl for windows
authorjihye kim <jihye1128.kim@samsung.com>
Mon, 16 Jul 2012 07:03:18 +0000 (16:03 +0900)
committerjihye kim <jihye1128.kim@samsung.com>
Mon, 16 Jul 2012 07:03:18 +0000 (16:03 +0900)
[Type] enhancement
[Module] emulator
[Priority] major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

hw/virtio-pci.c
package/pkginfo.manifest
tizen/src/Makefile.tizen
tizen/src/hw/gloffscreen_test.c
tizen/src/hw/gloffscreen_wgl.c
tizen/src/hw/helper_opengl.c
tizen/src/hw/opengl_exec.c
vl.c

index 8fb8b9f1d2809c9a1ce4279869fd6d4973797f0d..ce14a0d3521872622a262f1512e9f786c36ce393 100644 (file)
@@ -779,7 +779,7 @@ static int virtio_balloon_exit_pci(PCIDevice *pci_dev)
     return virtio_exit_pci(pci_dev);
 }
 
-#ifndef _WIN32\r
+//#ifndef _WIN32
 extern VirtIODevice *virtio_gl_init(DeviceState *dev);
 static int virtio_gl_init_pci(PCIDevice *pci_dev)
 {
@@ -793,7 +793,7 @@ static int virtio_gl_init_pci(PCIDevice *pci_dev)
     virtio_init_pci(proxy, vdev);
     return 0;
 }
-#endif\r
+//#endif
 
 static PCIDeviceInfo virtio_info[] = {
     {
@@ -880,7 +880,7 @@ static PCIDeviceInfo virtio_info[] = {
         },
         .qdev.reset = virtio_pci_reset,
     },{
-#ifndef _WIN32\r
+//#ifndef _WIN32
                .qdev.name = "virtio-gl-pci",
         .qdev.alias = "virtio-gl",
                .qdev.size = sizeof(VirtIOPCIProxy),
@@ -895,7 +895,7 @@ static PCIDeviceInfo virtio_info[] = {
                },
                .qdev.reset = virtio_pci_reset,
        },{
-#endif\r
+//#endif
         /* end of list */
     }
 };
index 41869745b2c58bffbd453eb584ae6ad37babdbe9..50ff5fff2be14b75c1051f1a02114f7410ae2a29 100644 (file)
@@ -1,5 +1,5 @@
 Package: emulator
-Version:1.2.107
+Version:1.2.108
 OS: linux
 Build-host-os: linux
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
@@ -8,7 +8,7 @@ Source: emulator
 Description: Tizen Emulator
 
 Package: emulator
-Version:1.2.107
+Version:1.2.108
 OS: windows
 Build-host-os: windows
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
index 4626a194219eaf745484eebac11fee7ff8390a89..7a3eb5fac8114d11cfab92aac46bb30b9ae2d11f 100755 (executable)
@@ -12,7 +12,7 @@ QEMU_CFLAGS += $(GLIB_CFLAGS)
 CFLAGS += -g -O2
 
 ifdef CONFIG_WIN32
-LIBS += -lavformat -lavcodec -lavutil -lm
+LIBS += -lavformat -lavcodec -lavutil -lm -lopengl32 -lglu32 -lgdi32
 else
 LIBS += -lavformat -lavcodec -lavutil -lm -lGL
 endif
@@ -23,7 +23,7 @@ else
 GL_CFLAGS := -Wall -g -O2 -fno-strict-aliasing
 endif
 
-ifndef CONFIG_WIN32
+#ifndef CONFIG_WIN32
 ###########################################################
 ## Build openGL
 # i386
@@ -51,7 +51,7 @@ opengl_exec.o : opengl_exec.c server_stub.c opengl_func.h gl_beginend.h opengl_p
 
 endif #($(TARGET_ARCH), i386)
 ###########################################################
-endif #CONFIG_WIN32
+#endif #CONFIG_WIN32
        
 # maru loader
 obj-y += emulator.o emul_state.o option.o maru_err_table.o
@@ -94,9 +94,9 @@ obj-i386-y += maruskin_client.o maruskin_server.o maruskin_operation.o maruskin_
 # guest server
 obj-i386-y += guest_server.o 
 
-ifndef CONFIG_WIN32
+#ifndef CONFIG_WIN32
 ###########################################################
 ## opengl library for i386
 obj-i386-y += virtio-gl.o helper_opengl.o opengl_exec.o mesa_mipmap.o gloffscreen_common.o gloffscreen_xcomposite.o gloffscreen_wgl.o gloffscreen_test.o
 ###########################################################
-endif
+#endif
index a685125d25af5431ba07a6b9b26bf60e252929cb..1e9e9bc9a0f09d11b1d3e626245ac2b984877818 100755 (executable)
@@ -87,12 +87,12 @@ int gl_acceleration_capability_check (void) {
     int bufferFlags = glo_flags_get_from_glx(bufferAttributes, 0);
     int bpp = glo_flags_get_bytes_per_pixel(bufferFlags);
     int glFormat, glType;
-
+/*
     if (glo_sanity_test () != 0) {
         // test failed.
         return 1;
     }
-
+*/
     memset(datain_flip, 0, TX*TY*4);
     memset(datain, 0, TX*TY*4);
     p = datain;
index ec86cebec770612d2ef0e83255dbd0a103c8550d..491af01c6a52b8a4c7d97470911252f7f784df69 100755 (executable)
@@ -213,7 +213,7 @@ int glo_init(void) {
 
     glo_inited = 1;
 
-       return 0
+       return 0;
 }
 
 /* Uninitialise gloffscreen */
@@ -639,7 +639,13 @@ void *glo_getprocaddress(const char *procName) {
     opengl_exec), so all we need to do is return a nunzero value...
 
     But we also have to check for 'standard' GL function names
-    too as wgl doesn't return those either! */ 
+    too as wgl doesn't return those either! */
+       /* Caller in opengl_exec.c may query some base GL API, then call them
+       * directly. On windows, wglGetProcAddress usually return NULL in such
+       * case, then we return 1, which casue segfault when accessing (void*)1. We
+       * should call base GL API directly instead of GET_EXT_PTR + ptr_func_*.
+       * TODO: add LoadLibrary + GetProcAddress as call back.
+       */ 
     if (procAddr==0) {
         const char *p = STANDARD_GL_FUNCTIONS;
         while (*p) {
index c5cd4fa313e211a5c092f7d71a059d1b408222dd..a13ca40df088feb262d8a09c9e151fee123a028d 100755 (executable)
@@ -190,9 +190,24 @@ static inline int do_decode_call_int(ProcessStruct *process, void *args_in, int
             r_buffer[0] = 0; // In case high bits are set.
 
         ret = do_function_call(process, func_number, args, r_buffer);
-
+       switch(signature->ret_type) {
+        case TYPE_INT:
+        case TYPE_UNSIGNED_INT:
+            memcpy(r_buffer, &ret, sizeof(int));
+            break;
+        case TYPE_CHAR:
+        case TYPE_UNSIGNED_CHAR:
+            *r_buffer = ret & 0xff;
+            break;
+        case TYPE_CONST_CHAR:
+        case TYPE_NONE:
+            break;
+        default:
+           DEBUGF("Unsupported GL API return type %i!\n", signature->ret_type);
+           exit (-1);
+        }
     }  // endwhile
-
+/*
     switch(signature->ret_type) {
         case TYPE_INT:
         case TYPE_UNSIGNED_INT:
@@ -209,7 +224,7 @@ static inline int do_decode_call_int(ProcessStruct *process, void *args_in, int
            DEBUGF("Unsupported GL API return type %i!\n", signature->ret_type);
            exit (-1);
     }
-
+*/
     return 1;
 }
 #define GL_PASSINGTHROUGH_ABI 1
index 118380d972aa04f2ac18d561346adca3ea110cc9..001a20290853a950d258b402dd226f26fe8f3ba9 100755 (executable)
@@ -1741,7 +1741,7 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
 
     case glGenTextures_fake_func:
         {
-            GET_EXT_PTR(void, glGenTextures, (GLsizei n, GLuint *textures));
+            //GET_EXT_PTR(void, glGenTextures, (GLsizei n, GLuint *textures));
             int i;
             int n = args[0];
             unsigned int *clientTabTextures = g_malloc(n * sizeof(int));
@@ -1750,7 +1750,8 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
             alloc_range(process->current_state->textureAllocator, n,
                         clientTabTextures);
 
-            ptr_func_glGenTextures(n, serverTabTextures);
+            //ptr_func_glGenTextures(n, serverTabTextures);
+               glGenTextures(n, serverTabTextures);
             for (i = 0; i < n; i++) {
                 process->current_state->tabTextures[clientTabTextures[i]] =
                     serverTabTextures[i];
@@ -1764,8 +1765,8 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
 
     case glDeleteTextures_func:
         {
-            GET_EXT_PTR(void, glDeleteTextures,
-                        (GLsizei n, const GLuint *textures));
+            //GET_EXT_PTR(void, glDeleteTextures,
+            //            (GLsizei n, const GLuint *textures));
             int i;
             int n = args[0];
             unsigned int *clientTabTextures = (unsigned int *) args[1];
@@ -1779,7 +1780,8 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
                 serverTabTextures[i] =
                     get_server_texture(process, clientTabTextures[i]);
             }
-            ptr_func_glDeleteTextures(n, serverTabTextures);
+            //ptr_func_glDeleteTextures(n, serverTabTextures);
+               glDeleteTextures(n, serverTabTextures);
             for (i = 0; i < n; i++) {
                 process->current_state->tabTextures[clientTabTextures[i]] = 0;
             }
@@ -1825,12 +1827,13 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
     case glIsTexture_func:
     case glIsTextureEXT_func:
         {
-            GET_EXT_PTR(GLboolean, glIsTexture, (GLuint texture));
+            //GET_EXT_PTR(GLboolean, glIsTexture, (GLuint texture));
             unsigned int client_texture = args[0];
             unsigned int server_texture =
                 get_server_texture(process, client_texture);
             if (server_texture)
-                ret.c = ptr_func_glIsTexture(server_texture);
+            //    ret.c = ptr_func_glIsTexture(server_texture);
+               ret.c = glIsTexture(server_texture);
             else
                 ret.c = 0;
             break;
diff --git a/vl.c b/vl.c
index 9ec81c6cdb94286e821b9b04ea287d7dd963fc92..e713bb7e517360fd86b117bbc1d229faeb706fe8 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -263,10 +263,10 @@ int boot_splash_filedata_size;
 uint8_t qemu_extra_params_fw[2];
 
 //virtio-gl
-#ifndef _WIN32
+//#ifndef _WIN32
 extern int gl_acceleration_capability_check (void);
 int enable_gl = 0;
-#endif
+//#endif
 
 typedef struct FWBootEntry FWBootEntry;
 
@@ -1791,7 +1791,7 @@ static int device_init_func(QemuOpts *opts, void *opaque)
 {
     DeviceState *dev;
 
-#ifndef _WIN32
+//#ifndef _WIN32
        // virtio-gl pci device
        if (!enable_gl) {
                // ignore virtio-gl-pci device, even if users set it in option.
@@ -1800,7 +1800,7 @@ static int device_init_func(QemuOpts *opts, void *opaque)
                        return 0;
                }
        }
-#endif
+//#endif
        
     dev = qdev_device_add(opts);
     if (!dev)
@@ -2960,9 +2960,9 @@ int main(int argc, char **argv, char **envp)
                 qemu_opts_parse(olist, "accel=kvm", 0);
                 break;
                        case QEMU_OPTION_enable_gl:
-#ifndef _WIN32
+//#ifndef _WIN32
                                enable_gl = 1;
-#endif
+//#endif
                                break;
             case QEMU_OPTION_machine:
                 olist = qemu_find_opts("machine");
@@ -3216,7 +3216,7 @@ int main(int argc, char **argv, char **envp)
     }
     loc_set_none();
 
-#ifndef _WIN32
+//#ifndef _WIN32
        if (enable_gl && (gl_acceleration_capability_check () != 0)) {
                enable_gl = 0;
                fprintf (stderr, "Warn: GL acceleration was disabled due to the fail of GL check!\n");
@@ -3237,7 +3237,7 @@ int main(int argc, char **argv, char **envp)
                        }
                }
        }
-#endif
+//#endif
        
        
     /* Open the logfile at this point, if necessary. We can't open the logfile