From: Evgeny Voevodin Date: Mon, 17 Sep 2012 05:26:04 +0000 (+0400) Subject: Merge remote-tracking branch 'score/develop' into tizen-arm-develop X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1405^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c17bc667c6d98922ef0e29282d3f8ca262f14efd;p=sdk%2Femulator%2Fqemu.git Merge remote-tracking branch 'score/develop' into tizen-arm-develop Conflicts: vl.c Signed-off-by: Evgeny Voevodin --- diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index d7e53af49c..1fb7ba66a1 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version: 1.3.54 +Version: 1.3.56 Maintainer: Yeong-Kyoon Lee Source: emulator diff --git a/tizen/src/VERSION b/tizen/src/VERSION index d2afcae6aa..82c30a1333 100644 --- a/tizen/src/VERSION +++ b/tizen/src/VERSION @@ -1 +1 @@ -2.0.0b +2.0.0a2 diff --git a/tizen/src/hw/gloffscreen.h b/tizen/src/hw/gloffscreen.h index 88bb2b2fdf..05e377a583 100644 --- a/tizen/src/hw/gloffscreen.h +++ b/tizen/src/hw/gloffscreen.h @@ -81,7 +81,7 @@ extern GloContext *glo_context_create(int formatFlags, GloContext *shareLists); extern void glo_context_destroy(GloContext *context); /* Update the context in surface and free previous light-weight context */ -extern void glo_surface_update_context(GloSurface *surface, GloContext *context); +extern int glo_surface_update_context(GloSurface *surface, GloContext *context); /* Link the pixmap associated with surface as texture */ extern void glo_surface_as_texture(GloSurface *surface); diff --git a/tizen/src/hw/gloffscreen_glx.c b/tizen/src/hw/gloffscreen_glx.c index f3c6757a43..f649a0ff3e 100644 --- a/tizen/src/hw/gloffscreen_glx.c +++ b/tizen/src/hw/gloffscreen_glx.c @@ -224,13 +224,24 @@ static void glo_surface_try_alloc_xshm_image(GloSurface *surface) { /* ------------------------------------------------------------------------ */ -/* Update the context in surface and free previous light-weight context */ -void glo_surface_update_context(GloSurface *surface, GloContext *context) -{ - if ( surface->context && (surface->context->context == 0)) - qemu_free(surface->context); +/* Update the context in surface and handle previous context */ +int glo_surface_update_context(GloSurface *surface, GloContext *context) + { + /* If previous context is light-weight context, just free it. If previous + * context is valid one binded with surface via MakeCurrent, we need unbind + * from original glstate */ + int prev_context_valid = 0; + + if ( surface->context ) + { + prev_context_valid = (surface->context->context != 0); + if ( !prev_context_valid ) /* light-weight context */ + g_free(surface->context); + } surface->context = context; + return prev_context_valid; } + /* Create a surface with given width and height, formatflags are from the * GLO_ constants */ diff --git a/tizen/src/hw/gloffscreen_wgl.c b/tizen/src/hw/gloffscreen_wgl.c index a833b9e897..626ea0e028 100644 --- a/tizen/src/hw/gloffscreen_wgl.c +++ b/tizen/src/hw/gloffscreen_wgl.c @@ -798,12 +798,22 @@ void glo_context_destroy(GloContext *context) { /* ------------------------------------------------------------------------ */ -/* Update the context in surface and free previous light-weight context */ -void glo_surface_update_context(GloSurface *surface, GloContext *context) +/* Update the context in surface and handle previous context */ +int glo_surface_update_context(GloSurface *surface, GloContext *context) { - if ( surface->context && !surface->context->hDC) - g_free(surface->context); + /* If previous context is light-weight context, just free it. If previous + * context is valid one binded with surface via MakeCurrent, we need unbind + * from original glstate */ + int prev_context_valid = 0; + + if ( surface->context ) + { + prev_context_valid = (surface->context->hContext != 0); + if ( !prev_context_valid ) /* light-weight context */ + g_free(surface->context); + } surface->context = context; + return prev_context_valid; } /* Create a surface with given width and height, formatflags are from the diff --git a/tizen/src/hw/gloffscreen_xcomposite.c b/tizen/src/hw/gloffscreen_xcomposite.c index 24c98f5e77..c7a221fc82 100644 --- a/tizen/src/hw/gloffscreen_xcomposite.c +++ b/tizen/src/hw/gloffscreen_xcomposite.c @@ -259,12 +259,22 @@ static void glo_surface_try_alloc_xshm_image(GloSurface *surface) { /* ------------------------------------------------------------------------ */ -/* Update the context in surface and free previous light-weight context */ -void glo_surface_update_context(GloSurface *surface, GloContext *context) -{ - if ( surface->context && (surface->context->context == 0)) - g_free(surface->context); +/* Update the context in surface and handle previous context */ +int glo_surface_update_context(GloSurface *surface, GloContext *context) + { + /* If previous context is light-weight context, just free it. If previous + * context is valid one binded with surface via MakeCurrent, we need unbind + * from original glstate */ + int prev_context_valid = 0; + + if ( surface->context ) + { + prev_context_valid = (surface->context->context != 0); + if ( !prev_context_valid ) /* light-weight context */ + g_free(surface->context); + } surface->context = context; + return prev_context_valid; } /* Create a surface with given width and height, formatflags are from the diff --git a/tizen/src/hw/maru_camera_common.h b/tizen/src/hw/maru_camera_common.h index 3c8e9902fd..deb0f11c45 100644 --- a/tizen/src/hw/maru_camera_common.h +++ b/tizen/src/hw/maru_camera_common.h @@ -89,7 +89,7 @@ struct MaruCamState { /* ----------------------------------------------------------------------------- */ /* Fucntion prototype */ /* ----------------------------------------------------------------------------- */ -int marucam_device_check(void); +int marucam_device_check(int log_flag); void marucam_device_init(MaruCamState *state); void marucam_device_open(MaruCamState *state); void marucam_device_close(MaruCamState *state); diff --git a/tizen/src/hw/maru_camera_linux_pci.c b/tizen/src/hw/maru_camera_linux_pci.c index 193354c3c8..1fa375b014 100644 --- a/tizen/src/hw/maru_camera_linux_pci.c +++ b/tizen/src/hw/maru_camera_linux_pci.c @@ -58,6 +58,17 @@ static struct v4l2_format dst_fmt; #define CLEAR(x) memset(&(x), 0, sizeof(x)) +static int yioctl(int fd, int req, void *arg) +{ + int r; + + do { + r = ioctl(fd, req, arg); + } while ( r < 0 && errno == EINTR); + + return r; +} + static int xioctl(int fd, int req, void *arg) { int r; @@ -358,39 +369,102 @@ wait_worker_thread: return NULL; } -int marucam_device_check(void) +int marucam_device_check(int log_flag) { int tmp_fd; + struct timeval t1, t2; struct stat st; + struct v4l2_fmtdesc format; + struct v4l2_frmsizeenum size; struct v4l2_capability cap; + int ret = 0; + gettimeofday(&t1, NULL); if (stat(dev_name, &st) < 0) { - INFO("Cannot identify '%s': %s\n", dev_name, strerror(errno)); + fprintf(stdout, "[Webcam] Cannot identify '%s': %s\n", + dev_name, strerror(errno)); } else { if (!S_ISCHR(st.st_mode)) { - INFO("%s is no character device.\n", dev_name); + fprintf(stdout, "[Webcam] %s is no character device.\n", + dev_name); } } tmp_fd = open(dev_name, O_RDWR | O_NONBLOCK, 0); if (tmp_fd < 0) { - ERR("Camera device open failed.(%s)\n", dev_name); - return 0; + fprintf(stdout, "[Webcam] Camera device open failed.(%s)\n", dev_name); + goto error; } if (ioctl(tmp_fd, VIDIOC_QUERYCAP, &cap) < 0) { - ERR("Could not qeury video capabilities\n"); - close(tmp_fd); - return 0; + fprintf(stdout, "[Webcam] Could not qeury video capabilities\n"); + goto error; } if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) || !(cap.capabilities & V4L2_CAP_STREAMING)) { - ERR("Not supported video driver.\n"); - close(tmp_fd); - return 0; + fprintf(stdout, "[Webcam] Not supported video driver.\n"); + goto error; } + ret = 1; + if (log_flag) { + fprintf(stdout, "[Webcam] Driver : %s\n", cap.driver); + fprintf(stdout, "[Webcam] Card : %s\n", cap.card); + fprintf(stdout, "[Webcam] Bus info : %s\n", cap.bus_info); + + CLEAR(format); + format.index = 0; + format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + if (yioctl(tmp_fd, VIDIOC_ENUM_FMT, &format) < 0) { + goto error; + } + + do { + CLEAR(size); + size.index = 0; + size.pixel_format = format.pixelformat; + + fprintf(stdout, "[Webcam] PixelFormat : %c%c%c%c\n", + (char)(format.pixelformat), + (char)(format.pixelformat >> 8), + (char)(format.pixelformat >> 16), + (char)(format.pixelformat >> 24)); + + if (yioctl(tmp_fd, VIDIOC_ENUM_FRAMESIZES, &size) < 0) { + goto error; + } + + if (size.type == V4L2_FRMSIZE_TYPE_DISCRETE) { + do { + fprintf(stdout, "[Webcam] got discrete frame size %dx%d\n", + size.discrete.width, size.discrete.height); + size.index++; + } while (yioctl(tmp_fd, VIDIOC_ENUM_FRAMESIZES, &size) >= 0); + } else if (size.type == V4L2_FRMSIZE_TYPE_STEPWISE) { + fprintf(stdout, "[Webcam] we have stepwise frame sizes:\n"); + fprintf(stdout, "[Webcam] min width: %d, min height: %d\n", + size.stepwise.min_width, size.stepwise.min_height); + fprintf(stdout, "[Webcam] max width: %d, max height: %d\n", + size.stepwise.max_width, size.stepwise.max_height); + fprintf(stdout, "[Webcam] step width: %d, step height: %d\n", + size.stepwise.step_width, size.stepwise.step_height); + } else if (size.type == V4L2_FRMSIZE_TYPE_CONTINUOUS) { + fprintf(stdout, "[Webcam] we have continuous frame sizes:\n"); + fprintf(stdout, "[Webcam] min width: %d, min height: %d\n", + size.stepwise.min_width, size.stepwise.min_height); + fprintf(stdout, "[Webcam] max width: %d, max height: %d\n", + size.stepwise.max_width, size.stepwise.max_height); + + } + format.index++; + } while (yioctl(tmp_fd, VIDIOC_ENUM_FMT, &format) >= 0); + } +error: close(tmp_fd); - return 1; + gettimeofday(&t2, NULL); + fprintf(stdout, "[Webcam] Elapsed time : %lu:%06lu\n", + t2.tv_sec-t1.tv_sec, t2.tv_usec-t1.tv_usec); + return ret; } void marucam_device_init(MaruCamState* state) @@ -420,8 +494,15 @@ void marucam_device_start_preview(MaruCamState* state) struct timespec req; req.tv_sec = 0; req.tv_nsec = 10000000; - - INFO("Starting preview!\n"); + INFO("Pixfmt(%c%c%c%C), W:H(%d:%d), buf size(%u)\n", + (char)(dst_fmt.fmt.pix.pixelformat), + (char)(dst_fmt.fmt.pix.pixelformat >> 8), + (char)(dst_fmt.fmt.pix.pixelformat >> 16), + (char)(dst_fmt.fmt.pix.pixelformat >> 24), + dst_fmt.fmt.pix.width, + dst_fmt.fmt.pix.height, + dst_fmt.fmt.pix.sizeimage); + INFO("Starting preview\n"); qemu_mutex_lock(&state->thread_mutex); qemu_cond_signal(&state->thread_cond); qemu_mutex_unlock(&state->thread_mutex); @@ -446,7 +527,7 @@ void marucam_device_stop_preview(MaruCamState* state) while (!is_stream_paused(state)) nanosleep(&req, NULL); - INFO("Stopping preview!\n"); + INFO("Stopping preview\n"); } void marucam_device_s_param(MaruCamState* state) diff --git a/tizen/src/hw/maru_camera_win32_pci.c b/tizen/src/hw/maru_camera_win32_pci.c index 71320f39b8..14f0c203e1 100644 --- a/tizen/src/hw/maru_camera_win32_pci.c +++ b/tizen/src/hw/maru_camera_win32_pci.c @@ -187,11 +187,14 @@ static STDMETHODIMP HWCPin_QueryInterface(IPin *iface, REFIID riid, void **ppv) { HWCInPin *This = impl_from_IPin(iface); - if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) { - *ppv = &This->IPin_iface; + if (IsEqualIID(riid, &IID_IUnknown)) { + *ppv = (IUnknown *)(&This->IPin_iface); + IPin_AddRef((IPin*)*ppv); + } else if (IsEqualIID(riid, &IID_IPin)) { + *ppv = (IPin *)(&This->IPin_iface); IPin_AddRef((IPin*)*ppv); } else if (IsEqualIID(riid, &IID_IMemInputPin)) { - *ppv = &This->IMemInputPin_iface; + *ppv = (IMemInputPin *)(&This->IMemInputPin_iface); IPin_AddRef((IMemInputPin*)*ppv); } else { *ppv = NULL; @@ -221,6 +224,7 @@ static STDMETHODIMP_(ULONG) HWCPin_Release(IPin *iface) SAFE_RELEASE(This->m_pConnectedPin); } if (This->m_pAllocator) { + IMemAllocator_Decommit(This->m_pAllocator); SAFE_RELEASE(This->m_pAllocator); } g_free((void*)This); @@ -232,6 +236,16 @@ static STDMETHODIMP_(ULONG) HWCPin_Release(IPin *iface) static STDMETHODIMP HWCPin_Connect(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) { + HWCInPin *This = impl_from_IPin(iface); + + if (!pReceivePin) { + return E_POINTER; + } + + if (This->m_pConnectedPin) { + return VFW_E_ALREADY_CONNECTED; + } + if (!pmt) return S_OK; return S_FALSE; @@ -268,26 +282,39 @@ static STDMETHODIMP HWCPin_Disconnect(IPin *iface) HWCInPin *This = impl_from_IPin(iface); HRESULT hr; + FILTER_STATE fs; + IBaseFilter_GetState(This->m_pCFilter, 0, &fs); + if (fs != State_Stopped) { + return VFW_E_NOT_STOPPED; + } if (This->m_pConnectedPin == NULL) { hr = S_FALSE; } else { + if (This->m_pAllocator) { + hr = IMemAllocator_Decommit(This->m_pAllocator); + if (FAILED(hr)) { + return hr; + } + SAFE_RELEASE(This->m_pAllocator); + } SAFE_RELEASE(This->m_pConnectedPin); hr = S_OK; } return hr; } -static STDMETHODIMP HWCPin_ConnectedTo(IPin *iface, IPin **pPin) +static STDMETHODIMP HWCPin_ConnectedTo(IPin *iface, IPin **ppPin) { HWCInPin *This = impl_from_IPin(iface); - if (pPin == NULL) + if (ppPin == NULL) return E_POINTER; if (This->m_pConnectedPin == NULL) { + *ppPin = NULL; return VFW_E_NOT_CONNECTED; } else { - *pPin = This->m_pConnectedPin; + *ppPin = This->m_pConnectedPin; IPin_AddRef(This->m_pConnectedPin); } return S_OK; @@ -379,12 +406,15 @@ static STDMETHODIMP HWCMemInputPin_QueryInterface(IMemInputPin *iface, REFIID ri { HWCInPin *This = impl_from_IMemInputPin(iface); - if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMemInputPin)) { - *ppv = &This->IMemInputPin_iface; - IMemInputPin_AddRef((IMemInputPin*)*ppv); + if (IsEqualIID(riid, &IID_IUnknown)) { + *ppv = (IUnknown *)(&This->IMemInputPin_iface); + IPin_AddRef((IPin*)*ppv); } else if (IsEqualIID(riid, &IID_IPin)) { - *ppv = &This->IPin_iface; + *ppv = (IPin *)(&This->IPin_iface); IPin_AddRef((IPin*)*ppv); + } else if (IsEqualIID(riid, &IID_IMemInputPin)) { + *ppv = (IMemInputPin *)(&This->IMemInputPin_iface); + IPin_AddRef((IMemInputPin*)*ppv); } else { *ppv = NULL; return E_NOINTERFACE; @@ -413,6 +443,7 @@ static STDMETHODIMP_(ULONG) HWCMemInputPin_Release(IMemInputPin *iface) SAFE_RELEASE(This->m_pConnectedPin); } if (This->m_pAllocator) { + IMemAllocator_Decommit(This->m_pAllocator); SAFE_RELEASE(This->m_pAllocator); } g_free((void*)This); @@ -1555,69 +1586,208 @@ static STDMETHODIMP SetVideoProcAmp(long nProperty, long value) return hr; } -int marucam_device_check(void) +static char* __wchar_to_char(const WCHAR *pwstr) { + char *pstr = NULL; + int len = 0; + + len = wcslen(pwstr) + 1; + pstr = (char *)g_malloc0(sizeof(char) * len); + wcstombs(pstr, pwstr, len + 1); + + return pstr; +} + +int marucam_device_check(int log_flag) +{ + struct timeval t1, t2; int ret = 0; + char *device_name = NULL; HRESULT hr = E_FAIL; ICreateDevEnum *pCreateDevEnum = NULL; + IGraphBuilder *pGB = NULL; + ICaptureGraphBuilder2 *pCGB = NULL; + IBaseFilter *pSrcFilter = NULL; IEnumMoniker *pEnumMK = NULL; IMoniker *pMoniKer = NULL; + IAMStreamConfig *pSConfig = NULL; + int iCount = 0, iSize = 0; + gettimeofday(&t1, NULL); hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(hr)) { - ERR("[%s] failed to CoInitailizeEx\n", __func__); - goto error; + fprintf(stdout, "[Webcam] failed to CoInitailizeEx\n"); + goto leave_check; } - hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, &IID_ICreateDevEnum, (void**)&pCreateDevEnum); + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, + CLSCTX_INPROC, + &IID_IGraphBuilder, + (void**)&pGB); if (FAILED(hr)) { - ERR("[%s] failed to create instance of CLSID_SystemDeviceEnum\n", __func__); - goto error; + fprintf(stdout, "[Webcam] Failed to create GraphBuilder, 0x%x\n", hr); + goto leave_check; } - hr = pCreateDevEnum->lpVtbl->CreateClassEnumerator(pCreateDevEnum, &CLSID_VideoInputDeviceCategory, &pEnumMK, 0); - if (FAILED(hr)) - { - ERR("[%s] failed to create class enumerator\n", __func__); - goto error; + hr = CoCreateInstance(&CLSID_CaptureGraphBuilder2, NULL, + CLSCTX_INPROC, + &IID_ICaptureGraphBuilder2, + (void**)&pCGB); + if (FAILED(hr)) { + fprintf(stdout, + "[Webcam] Failed to create CaptureGraphBuilder2, 0x%x\n", hr); + goto leave_check; } - if (!pEnumMK) - { - ERR("[%s] class enumerator is NULL!!\n", __func__); - goto error; + hr = pCGB->lpVtbl->SetFiltergraph(pCGB, pGB); + if (FAILED(hr)) { + fprintf(stdout, "[Webcam] Failed to SetFiltergraph, 0x%x\n", hr); + goto leave_check; + } + + hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, + CLSCTX_INPROC, + &IID_ICreateDevEnum, + (void**)&pCreateDevEnum); + if (FAILED(hr)) { + fprintf(stdout, + "[Webcam] failed to create instance of CLSID_SystemDeviceEnum\n"); + goto leave_check; + } + + hr = pCreateDevEnum->lpVtbl->CreateClassEnumerator(pCreateDevEnum, + &CLSID_VideoInputDeviceCategory, &pEnumMK, 0); + if (FAILED(hr)) { + fprintf(stdout, "[Webcam] failed to create class enumerator\n"); + goto leave_check; + } + + if (!pEnumMK) { + fprintf(stdout, "[Webcam] class enumerator is NULL!!\n"); + goto leave_check; } pEnumMK->lpVtbl->Reset(pEnumMK); hr = pEnumMK->lpVtbl->Next(pEnumMK, 1, &pMoniKer, NULL); - if (hr == S_FALSE) + if (FAILED(hr) || (hr == S_FALSE)) { + fprintf(stdout, "[Webcam] enum moniker returns a invalid value.\n"); + goto leave_check; + } + + IPropertyBag *pBag = NULL; + hr = pMoniKer->lpVtbl->BindToStorage(pMoniKer, 0, 0, + &IID_IPropertyBag, + (void **)&pBag); + if (FAILED(hr)) { + fprintf(stdout, "[Webcam] failed to bind to storage.\n"); + goto leave_check; + } else { + VARIANT var; + var.vt = VT_BSTR; + hr = pBag->lpVtbl->Read(pBag, L"FriendlyName", &var, NULL); + if (hr == S_OK) { + ret = 1; + if (!log_flag) { + SysFreeString(var.bstrVal); + SAFE_RELEASE(pBag); + SAFE_RELEASE(pMoniKer); + goto leave_check; + } + device_name = __wchar_to_char(var.bstrVal); + fprintf(stdout, "[Webcam] Device name : %s\n", device_name); + g_free(device_name); + hr = pMoniKer->lpVtbl->BindToObject(pMoniKer, NULL, NULL, + &IID_IBaseFilter, + (void**)&pSrcFilter); + if (FAILED(hr)) { + fprintf(stdout, + "[Webcam] Counldn't bind moniker to filter object!!\n"); + goto leave_check; + } else { + pSrcFilter->lpVtbl->AddRef(pSrcFilter); + } + SysFreeString(var.bstrVal); + } + SAFE_RELEASE(pBag); + } + SAFE_RELEASE(pMoniKer); + + hr = pGB->lpVtbl->AddFilter(pGB, pSrcFilter, L"Video Capture"); + if (hr != S_OK && hr != S_FALSE) { + fprintf(stdout, + "[Webcam] Counldn't add Video Capture filter to our graph!\n"); + goto leave_check; + } + + hr = pCGB->lpVtbl->FindInterface(pCGB, &PIN_CATEGORY_CAPTURE, 0, + pSrcFilter, &IID_IAMStreamConfig, + (void**)&pSConfig); + if (FAILED(hr)) { + fprintf(stdout, "[Webcam] failed to FindInterface method\n"); + goto leave_check; + } + + hr = pSConfig->lpVtbl->GetNumberOfCapabilities(pSConfig, &iCount, &iSize); + if (FAILED(hr)) { - ERR("[%s] enum moniker returns a invalid value.\n", __func__); - hr = E_FAIL; + fprintf(stdout, "[Webcam] failed to GetNumberOfCapabilities method\n"); + goto leave_check; } - if (SUCCEEDED(hr)) + + if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS)) { - IPropertyBag *pBag = NULL; - hr = pMoniKer->lpVtbl->BindToStorage(pMoniKer, 0, 0, &IID_IPropertyBag, (void **)&pBag); - if (SUCCEEDED(hr)) + int iFormat = 0; + for (iFormat = 0; iFormat < iCount; iFormat++) { - VARIANT var; - var.vt = VT_BSTR; - hr = pBag->lpVtbl->Read(pBag, L"FriendlyName", &var, NULL); - if (hr == NOERROR) + VIDEO_STREAM_CONFIG_CAPS scc; + AM_MEDIA_TYPE *pmtConfig; + + hr = pSConfig->lpVtbl->GetStreamCaps(pSConfig, iFormat, &pmtConfig, + (BYTE*)&scc); + if (hr == S_OK) { - ret = 1; - SysFreeString(var.bstrVal); + if (IsEqualIID(&pmtConfig->formattype, &FORMAT_VideoInfo)) + { + VIDEOINFOHEADER *pvi = + (VIDEOINFOHEADER *)pmtConfig->pbFormat; + if (pvi->bmiHeader.biCompression == BI_RGB) { + fprintf(stdout, "[Webcam] RGB BitCount: %d, %ux%u\n", + pvi->bmiHeader.biBitCount, + pvi->bmiHeader.biWidth, + pvi->bmiHeader.biHeight); + } else { + fprintf(stdout, + "[Webcam] PixelFormat: %c%c%c%c, %ux%u\n", + (char)(pvi->bmiHeader.biCompression), + (char)(pvi->bmiHeader.biCompression >> 8), + (char)(pvi->bmiHeader.biCompression >> 16), + (char)(pvi->bmiHeader.biCompression >> 24), + pvi->bmiHeader.biWidth, + pvi->bmiHeader.biHeight); + } + } + DeleteMediaType(pmtConfig); } - SAFE_RELEASE(pBag); } - SAFE_RELEASE(pMoniKer); } -error: + hr = pGB->lpVtbl->RemoveFilter(pGB, pSrcFilter); + if (FAILED(hr)) { + fprintf(stdout, "[Webcam] Failed to remove source filer. 0x%x\n", hr); + } + +leave_check: + SAFE_RELEASE(pSConfig); + SAFE_RELEASE(pSrcFilter); + SAFE_RELEASE(pCGB); + SAFE_RELEASE(pGB); SAFE_RELEASE(pEnumMK); SAFE_RELEASE(pCreateDevEnum); CoUninitialize(); + gettimeofday(&t2, NULL); + fprintf(stdout, "[Webcam] Elapsed time : %lu.%06lu\n", + t2.tv_sec-t1.tv_sec, t2.tv_usec-t1.tv_usec); + return ret; } @@ -1678,7 +1848,7 @@ void marucam_device_open(MaruCamState* state) goto error_failed; } - INFO("Open successfully!!!\n"); + INFO("Opened\n"); return; error_failed: @@ -1700,7 +1870,7 @@ void marucam_device_close(MaruCamState* state) RemoveFilters(); CloseInterfaces(); CoUninitialize(); - INFO("Close successfully!!!\n"); + INFO("Closed\n"); } /* MARUCAM_CMD_START_PREVIEW */ @@ -1717,8 +1887,11 @@ void marucam_device_start_preview(MaruCamState* state) pixfmt = supported_dst_pixfmts[cur_fmt_idx].fmt; state->buf_size = get_sizeimage(pixfmt, width, height); - INFO("Pixfmt(0x%x), Width:Height(%d:%d), buffer size(%u)\n", - pixfmt, width, height, state->buf_size); + INFO("Pixfmt(%c%c%c%c), W:H(%d:%d), buf size(%u)\n", + (char)(pixfmt), (char)(pixfmt >> 8), + (char)(pixfmt >> 16), (char)(pixfmt >> 24), + width, height, state->buf_size); + INFO("Starting preview\n"); assert(g_pCallback != NULL); hr = ((HWCInPin*)g_pInputPin)->SetGrabCallbackIF(g_pInputPin, g_pCallback); @@ -1739,7 +1912,7 @@ void marucam_device_start_preview(MaruCamState* state) state->streamon = 1; qemu_mutex_unlock(&state->thread_mutex); - INFO("Start preview!!!\n"); + INFO("Streaming on ......\n"); } /* MARUCAM_CMD_STOP_PREVIEW */ @@ -1749,6 +1922,7 @@ void marucam_device_stop_preview(MaruCamState* state) MaruCamParam *param = state->param; param->top = 0; + INFO("...... Streaming off\n"); qemu_mutex_lock(&state->thread_mutex); state->streamon = 0; qemu_mutex_unlock(&state->thread_mutex); @@ -1769,7 +1943,7 @@ void marucam_device_stop_preview(MaruCamState* state) state->buf_size = 0; - INFO("Stop preview!!!\n"); + INFO("Stopping preview\n"); } /* MARUCAM_CMD_S_PARAM */ diff --git a/tizen/src/hw/maru_device_ids.h b/tizen/src/hw/maru_device_ids.h index 46b81d8a4c..9d61c6e3e0 100644 --- a/tizen/src/hw/maru_device_ids.h +++ b/tizen/src/hw/maru_device_ids.h @@ -47,10 +47,37 @@ #define PCI_DEVICE_ID_VIRTUAL_BRIGHTNESS 0x1014 #define PCI_DEVICE_ID_VIRTUAL_CAMERA 0x1018 #define PCI_DEVICE_ID_VIRTUAL_CODEC 0x101C +// Device ID 0x1000 through 0x103F inclusive is a virtio device #define PCI_DEVICE_ID_VIRTIO_TOUCHSCREEN 0x101D -/* virtio */ -#define VIRTIO_ID_TOUCHSCREEN 10 +/* Virtio */ +/* ++----------------------+--------------------+---------------+ +| Subsystem Device ID | Virtio Device | Specification | ++----------------------+--------------------+---------------+ ++----------------------+--------------------+---------------+ +| 1 | network card | Appendix C | ++----------------------+--------------------+---------------+ +| 2 | block device | Appendix D | ++----------------------+--------------------+---------------+ +| 3 | console | Appendix E | ++----------------------+--------------------+---------------+ +| 4 | entropy source | Appendix F | ++----------------------+--------------------+---------------+ +| 5 | memory ballooning | Appendix G | ++----------------------+--------------------+---------------+ +| 6 | ioMemory | - | ++----------------------+--------------------+---------------+ +| 7 | rpmsg | Appendix H | ++----------------------+--------------------+---------------+ +| 8 | SCSI host | Appendix I | ++----------------------+--------------------+---------------+ +| 9 | 9P transport | - | ++----------------------+--------------------+---------------+ +| 10 | mac80211 wlan | - | ++----------------------+--------------------+---------------+ +*/ +#define VIRTIO_ID_TOUCHSCREEN 11 #endif /* MARU_DEVICE_IDS_H_ */ diff --git a/tizen/src/hw/opengl_exec.c b/tizen/src/hw/opengl_exec.c index f0582d4adb..f886f2b22a 100644 --- a/tizen/src/hw/opengl_exec.c +++ b/tizen/src/hw/opengl_exec.c @@ -608,6 +608,18 @@ static void bind_qsurface(GLState *state, state->current_qsurface = qsurface; } +/* Unbind a qsurface from a context (GLState) */ +static void unbind_qsurface(GLState *state, + QGloSurface *qsurface) +{ + qsurface->glstate = NULL; + + QTAILQ_REMOVE(&state->qsurfaces, qsurface, next); + + if ( state->current_qsurface == qsurface ) + state->current_qsurface = NULL; +} + /* Find the qsurface with required drawable in active & pending qsurfaces */ QGloSurface* find_qsurface_from_client_drawable(ProcessState *process, ClientGLXDrawable client_drawable) { @@ -711,7 +723,8 @@ static int link_qsurface(ProcessState *process, GLState *glstate, ClientGLXDrawa /* process->pending_qsurfaces[i] = NULL;*/ qsurface->ref = 1; /* qsurface->surface->context = glstate->context;*/ - glo_surface_update_context(qsurface->surface, glstate->context); + if ( glo_surface_update_context(qsurface->surface, glstate->context) ) + unbind_qsurface(qsurface->glstate, qsurface); bind_qsurface(glstate, qsurface); return 1; } diff --git a/tizen/src/maru_shm.c b/tizen/src/maru_shm.c index 248445ce55..dc9e9619a9 100644 --- a/tizen/src/maru_shm.c +++ b/tizen/src/maru_shm.c @@ -47,7 +47,7 @@ void qemu_ds_shm_resize(DisplayState *ds) void qemu_ds_shm_refresh(DisplayState *ds) { - //TODO: + vga_hw_update(); } void maruskin_shm_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize) diff --git a/tizen/src/skin/client/build.xml b/tizen/src/skin/client/build.xml index bebeec7f8c..47fa89330a 100644 --- a/tizen/src/skin/client/build.xml +++ b/tizen/src/skin/client/build.xml @@ -30,7 +30,7 @@ - + diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java index 14820cd688..628464c654 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java @@ -166,29 +166,6 @@ public class DetailInfoDialog extends SkinDialog { return; } - ProcessBuilder procBrowser = new ProcessBuilder(); - - if (SwtUtil.isLinuxPlatform()) { - procBrowser.command("nautilus", "--browser", openPath); - } else if (SwtUtil.isWindowsPlatform()) { - procBrowser.command("explorer", "\"" + openPath + "\""); - } else if (SwtUtil.isMacPlatform()) { - //TODO: - logger.warning( "not supported yet" ); - } - - if (procBrowser.command().isEmpty() == false) { - try { - procBrowser.start(); - } catch (Exception e) { - logger.log( Level.SEVERE, e.getMessage(), e); - } - } - - if (openPath.compareTo(VALUE_NONE) == 0 || openPath.compareTo("") == 0) { - return; - } - Program.launch(openPath); /*ProcessBuilder procBrowser = new ProcessBuilder(); diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index 9042a0587c..9a58e6a357 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -253,16 +253,16 @@ void do_rotation_event( int rotation_type) switch ( rotation_type ) { case ROTATION_PORTRAIT: - sprintf( send_buf, "1\n3\n0\n-9.80665\n0\n" ); + sprintf( send_buf, "1\n3\n0\n9.80665\n0\n" ); break; case ROTATION_LANDSCAPE: - sprintf( send_buf, "1\n3\n-9.80665\n0\n0\n" ); + sprintf( send_buf, "1\n3\n9.80665\n0\n0\n" ); break; case ROTATION_REVERSE_PORTRAIT: - sprintf( send_buf, "1\n3\n0\n9.80665\n0\n" ); + sprintf( send_buf, "1\n3\n0\n-9.80665\n0\n" ); break; case ROTATION_REVERSE_LANDSCAPE: - sprintf(send_buf, "1\n3\n9.80665\n0\n0\n"); + sprintf(send_buf, "1\n3\n-9.80665\n0\n0\n"); break; default: diff --git a/vl.c b/vl.c index d9db2efe40..f78cd3dc62 100644 --- a/vl.c +++ b/vl.c @@ -265,8 +265,10 @@ extern int gl_acceleration_capability_check(void); int enable_gl = 0; int capability_check_gl = 0; #endif -#if defined(CONFIG_MARU) -extern int marucam_device_check(void); +#if defined(CONFIG_MARU) && (!defined(CONFIG_DARWIN)) +#define WEBCAM_INFO_IGNORE 0x00 +#define WEBCAM_INFO_WRITE 0x04 +extern int marucam_device_check(int log_flag); int is_webcam_enabled = 0; #endif @@ -1910,7 +1912,7 @@ static int device_init_func(QemuOpts *opts, void *opaque) } #endif #endif -#if defined(CONFIG_MARU) +#if defined(CONFIG_MARU) && (!defined(CONFIG_DARWIN)) if (!is_webcam_enabled) { const char *driver = qemu_opt_get(opts, "driver"); if (driver && (strcmp (driver, MARUCAM_DEV_NAME) == 0)) { @@ -3425,26 +3427,27 @@ int main(int argc, char **argv, char **envp) #endif #endif -#if defined(CONFIG_MARU) - is_webcam_enabled = marucam_device_check(); +#if defined(CONFIG_MARU) && (!defined(CONFIG_DARWIN)) + is_webcam_enabled = marucam_device_check(WEBCAM_INFO_WRITE); if (!is_webcam_enabled) { - fprintf (stderr, "WARNING: Webcam support was disabled due to " - "the fail of webcam capability check!\n"); + fprintf (stderr, "[Webcam] Webcam support was disabled " + "due to the fail of webcam capability check!\n"); } gchar *tmp_cam_kcmd = kernel_cmdline; kernel_cmdline = g_strdup_printf("%s enable_cam=%d", tmp_cam_kcmd, is_webcam_enabled); - fprintf(stdout, "kernel command : %s\n", kernel_cmdline); g_free(tmp_cam_kcmd); if (is_webcam_enabled) { device_opt_finding_t devp = {MARUCAM_DEV_NAME, 0}; qemu_opts_foreach(qemu_find_opts("device"), find_device_opt, &devp, 0); if (devp.found == 0) { - if (!qemu_opts_parse(qemu_find_opts("device"), MARUCAM_DEV_NAME, "driver")) { + if (!qemu_opts_parse(qemu_find_opts("device"), MARUCAM_DEV_NAME, 1)) { + fprintf(stderr, "Failed to initialize the marucam device.\n"); exit(1); } } + fprintf(stdout, "[Webcam] Webcam support was enabled.\n"); } #endif