From: Varinder Pratap Date: Mon, 8 Aug 2022 06:10:38 +0000 (+0530) Subject: Fixes Hax page fault issue for Yagl driver in windows. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F279370%2F1;p=sdk%2Femulator%2Fqemu.git Fixes Hax page fault issue for Yagl driver in windows. Change-Id: I3654d22ca8343b5918d1ee63e6a6ee676403be25 Signed-off-by: Varinder Pratap --- diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c index 2af93083ed..2d52864a4b 100644 --- a/hw/yagl/yagl_device.c +++ b/hw/yagl/yagl_device.c @@ -199,10 +199,15 @@ static uint64_t yagl_device_read(void *opaque, hwaddr offset, static void yagl_device_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { + YAGL_LOG_NO_TS; + + YAGL_LOG_FUNC_ENTER(yagl_device_trigger, "%d, %d, %d", offset, value, size); YaGLState *s = (YaGLState*)opaque; int user_index = (offset / YAGL_REGS_SIZE); offset -= user_index * YAGL_REGS_SIZE; + YAGL_LOG_CRITICAL("yagl_device_write user_index = %d, offset=%d", user_index, offset); + assert(user_index < YAGL_MAX_USERS); if (user_index >= YAGL_MAX_USERS) { @@ -310,6 +315,8 @@ static void yagl_device_init(PCIDevice *dev, Error **err) TYPE_YAGL_DEVICE, YAGL_MEM_SIZE); + pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->iomem); + yagl_handle_gen_init(); egl_driver = yagl_egl_driver_create(dobj->dpy, s->gl_version); @@ -358,8 +365,6 @@ static void yagl_device_init(PCIDevice *dev, Error **err) goto fail; } - pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->iomem); - YAGL_LOG_FUNC_EXIT(NULL); return; @@ -435,8 +440,9 @@ static void yagl_class_init(ObjectClass *klass, void *data) k->exit = yagl_device_exit; k->vendor_id = PCI_VENDOR_ID_YAGL; k->device_id = PCI_DEVICE_ID_YAGL; - k->class_id = PCI_CLASS_OTHERS; + k->class_id = PCI_CLASS_DISPLAY_OTHER; dc->reset = yagl_device_reset; + set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); device_class_set_props(dc, yagl_properties); dc->desc = "YaGL device"; } diff --git a/hw/yagl/yagl_process.h b/hw/yagl/yagl_process.h index bbf4568b58..7d55c0eab0 100644 --- a/hw/yagl/yagl_process.h +++ b/hw/yagl/yagl_process.h @@ -55,7 +55,7 @@ struct yagl_process_state QLIST_HEAD(, yagl_thread_state) threads; -#if defined (CONFIG_KVM) || defined (CONFIG_HAX) +#if defined (CONFIG_KVM) || defined (CONFIG_HAX) || defined (CONFIG_WHPX) target_ulong cr[5]; uint32_t hflags; #endif diff --git a/hw/yagl/yagl_thread.c b/hw/yagl/yagl_thread.c index 332628216e..ca1f98827a 100644 --- a/hw/yagl/yagl_thread.c +++ b/hw/yagl/yagl_thread.c @@ -38,6 +38,7 @@ #include "hw/vigs/winsys.h" #include "sysemu/kvm.h" #include "sysemu/hax.h" +#include "sysemu/whpx.h" struct yagl_thread_work_item { @@ -51,10 +52,10 @@ struct yagl_thread_work_item uint32_t out_arrays_size; }; -#if defined (CONFIG_KVM) || defined (CONFIG_HAX) +#if defined (CONFIG_KVM) || defined (CONFIG_HAX) || defined (CONFIG_WHPX) static __inline void yagl_cpu_synchronize_state(struct yagl_process_state *ps) { - if (kvm_enabled() || hax_enabled()) { + if (kvm_enabled() || hax_enabled() || whpx_enabled()) { CPUX86State *env = current_cpu->env_ptr; memcpy(&((CPUX86State *)current_cpu->env_ptr)->cr[0], &ps->cr[0], diff --git a/hw/yagl/yagl_transport.c b/hw/yagl/yagl_transport.c index 0ae51d2736..365d8698f4 100644 --- a/hw/yagl/yagl_transport.c +++ b/hw/yagl/yagl_transport.c @@ -149,6 +149,10 @@ uint8_t *yagl_transport_begin(struct yagl_transport *t, uint32_t num_out_da, i; uint8_t *batch_data, *tmp; + YAGL_LOG_NO_TS; + + YAGL_LOG_FUNC_ENTER(yagl_transport_begin, NULL); + *fence_seq = yagl_transport_uint32_t_at(t, 1 * 8); *batch_size = yagl_transport_uint32_t_at(t, 2 * 8); num_out_da = yagl_transport_uint32_t_at(t, 3 * 8); @@ -166,6 +170,9 @@ uint8_t *yagl_transport_begin(struct yagl_transport *t, tmp += header_size + YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size; + + YAGL_LOG_CRITICAL("yagl_transport_begin - batch_size=%d, out_arrays_size=%d, fence_seq=%d, num_out_da=%d", *batch_size, *out_arrays_size, + *fence_seq, num_out_da); for (i = 0; i < num_out_da; ++i) { target_ulong va = yagl_transport_va_at(t, YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size + ((2 * i + 0) * 8)); @@ -175,6 +182,8 @@ uint8_t *yagl_transport_begin(struct yagl_transport *t, if (!yagl_mem_get(t->ts, va, size, tmp)) { yagl_transport_uint32_t_to(t, 0, yagl_call_result_retry); g_free(batch_data); + + YAGL_LOG_FUNC_EXIT(NULL); return NULL; } @@ -188,6 +197,8 @@ uint8_t *yagl_transport_begin(struct yagl_transport *t, yagl_transport_uint32_t_to(t, 0, yagl_call_result_ok); + YAGL_LOG_FUNC_EXIT(NULL); + return batch_data; } diff --git a/tizen/src/hw/pci/maru_camera_win32.c b/tizen/src/hw/pci/maru_camera_win32.c index 210d27d28d..0aa2a02625 100644 --- a/tizen/src/hw/pci/maru_camera_win32.c +++ b/tizen/src/hw/pci/maru_camera_win32.c @@ -32,6 +32,7 @@ #include "qemu-common.h" #include "qemu/cutils.h" #include "sysemu/hax.h" +#include "sysemu/whpx.h" #include "maru_camera.h" #include "debug_ch.h" @@ -1524,18 +1525,9 @@ static STDMETHODIMP SetFormat(MCBackendWin *backend, uint32_t dwWidth, } /* use minimum FPS(maximum frameinterval) with non-VT system */ -#ifdef CONFIG_HAX - if (!hax_enabled()) { - pvi->AvgTimePerFrame = - (REFERENCE_TIME)scc.MaxFrameInterval; - } else { - pvi->AvgTimePerFrame = - (REFERENCE_TIME)MARUCAM_DEFAULT_FRAMEINTERVAL; - } -#else pvi->AvgTimePerFrame = (REFERENCE_TIME)scc.MaxFrameInterval; -#endif + hr = IAMStreamConfig_SetFormat(pSConfig, pmtConfig); DeleteMediaType(pmtConfig); break;