emul_state: Modified the functions for the GPU acceleration
authorjinhyung.jo <jinhyung.jo@samsung.com>
Tue, 14 Jul 2015 04:36:23 +0000 (13:36 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 16 Jul 2015 06:43:52 +0000 (15:43 +0900)
Currently the gpu accel status is set only in the '-enable-yagl' option,
so the status is ignored when using new start-up configuation.
Instead, get the result of the attachment state of the YaGL device using the QMP.
Removed the setting function for the state of the GPU acceleration.

Change-Id: I6652575086df3563dd2da635f186950d045d615f
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
tizen/src/emul_state.c
tizen/src/emul_state.h
vl.c

index 434219b252f2e0904a06649a68c7aa1a594565e1..11bc77b2cbe170eaf20f06d3fdcbeec388ccb55c 100644 (file)
@@ -48,6 +48,7 @@ extern bool hax_allowed;
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "net/net.h"
+#include "qmp-commands.h"
 
 #include "emulator_options.h"
 #include "skin/maruskin_server.h"
@@ -456,17 +457,6 @@ const char* get_emul_skin_path(void)
     return _emul_info.skin_path;
 }
 
-/* GPU virtualization */
-void set_emul_gpu_accel(bool enable)
-{
-    _emul_info.gpu_accel_enable = enable;
-}
-
-bool get_emul_gpu_accel(void)
-{
-    return _emul_info.gpu_accel_enable;
-}
-
 /* CPU virtualization */
 bool get_emul_cpu_accel(void)
 {
@@ -652,3 +642,43 @@ const char* get_vm_data_path(void)
 
     return vm_data_path;
 }
+
+/* GPU virtualization */
+static bool is_gpu_accel;
+
+bool get_emul_gpu_accel(void)
+{
+    static bool is_done;
+    PciInfoList *info_list, *info;
+    Error *err = NULL;
+
+    if (is_done) {
+        return is_gpu_accel;
+    }
+
+    info_list = qmp_query_pci(&err);
+    if (err) {
+        LOG_WARNING("PCI devices not supported\n");
+        error_free(err);
+        is_done = true;
+        return false;
+    }
+
+    for (info = info_list; info; info = info->next) {
+        PciDeviceInfoList *dev;
+
+        for (dev = info->value->devices; dev; dev = dev->next) {
+            /* TODO: use defines in the pci_regs.h
+                     instead of the hard coding */
+            if (dev->value->id.vendor == 0x19B1
+                && dev->value->id.device == 0x1010) {
+                is_gpu_accel = true;
+            }
+        }
+    }
+
+    qapi_free_PciInfoList(info_list);
+    is_done = true;
+
+    return is_gpu_accel;
+}
index 7727f26f261f9f549e700b69b9a70b17e0249fc1..4dcf2815faed062f46b05fa0c26b0155209d435a 100644 (file)
@@ -104,7 +104,6 @@ typedef  struct EmulatorConfigInfo {
 
     int spice_port;
     const char *skin_path;
-    bool gpu_accel_enable;
     const char *file_sharing_path;
     const char *vm_ram_size;
     int serial_port;
@@ -144,7 +143,6 @@ void set_emul_vm_base_port(int port);
 void set_emul_ecs_port(int port);
 void set_emul_guest_ip(char *ip);
 void set_emul_host_ip(char *ip);
-void set_emul_gpu_accel(bool enable);
 void set_emul_file_sharing_path(const char *path);
 void set_emul_ram_size(const char *size);
 
diff --git a/vl.c b/vl.c
index 71aba3ba9bb8660581113315b87ab53e0d99a6f0..b4ac178a52ec80c544ea366ded858b30c2cb3544 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -3626,9 +3626,6 @@ int main(int argc, char **argv, char **envp)
            case QEMU_OPTION_enable_yagl:
 #if defined(CONFIG_YAGL)
                 enable_yagl = 1;
-#ifdef CONFIG_MARU
-                set_emul_gpu_accel(true);
-#endif
 #else
                 fprintf(stderr, "YaGL openGLES passthrough support is disabled,"
                     " ignoring -enable-yagl\n");