From: jinhyung.jo Date: Tue, 14 Jul 2015 04:36:23 +0000 (+0900) Subject: emul_state: Modified the functions for the GPU acceleration X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e3736b4fa3b66a3d2a63c651316ad13246b7386;p=sdk%2Femulator%2Fqemu.git emul_state: Modified the functions for the GPU acceleration 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 --- diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 434219b252..11bc77b2cb 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -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; +} diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 7727f26f26..4dcf2815fa 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -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 71aba3ba9b..b4ac178a52 100644 --- 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");