summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinhyung.jo <jinhyung.jo@samsung.com>2015-04-09 15:22:23 +0900
committerjinhyung.jo <jinhyung.jo@samsung.com>2015-04-09 15:30:03 +0900
commitd67510cd88d5a03da0a8733638772ebf9947f8d0 (patch)
tree5d1916d1e51bf5b60e7bec918844a48e499f1243
parentdae5bfabe0b9061e1245ac339a53b7d142ff3f45 (diff)
downloadqemu-features/camera.tar.gz
qemu-features/camera.tar.bz2
qemu-features/camera.zip
maru-camera: bug fix & some modificationfeatures/camera
fixed bugs, removed unnecessary member variables in argument strcut and modification thereon. Change-Id: Ib58370e55cdcfe6f83d9c74da16b1af300fa5f3b Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
-rw-r--r--tizen/src/hw/pci/maru_camera.c10
-rw-r--r--tizen/src/hw/pci/maru_camera.h7
-rw-r--r--tizen/src/hw/pci/maru_camera_linux.c105
-rw-r--r--tizen/src/hw/pci/maru_camera_win32.c84
4 files changed, 79 insertions, 127 deletions
diff --git a/tizen/src/hw/pci/maru_camera.c b/tizen/src/hw/pci/maru_camera.c
index 4103f2698d..163d24e1f8 100644
--- a/tizen/src/hw/pci/maru_camera.c
+++ b/tizen/src/hw/pci/maru_camera.c
@@ -47,10 +47,12 @@ MULTI_DEBUG_CHANNEL(tizen, camera);
#define MARU_PCI_CAMERA_DEVICE_NAME "maru-camera"
-/* WQXGA(2560x1600) * RGBA(4Byte) */
-#define MARUCAM_MEM_SIZE (2560 * 1600 * 4)
-#define MARUCAM_REG_SIZE (256) /* 64 * 4Byte */
-#define MARUCAM_IOMEM_SIZE (512) /* 512Byte */
+/* WQXGA(2560x1600) * RGBA(4Byte) = 16,384,000 */
+/* PCI region size must be pow2. */
+/* set to 2048(2^11) * 2048(2^11) * 4(2^2) = 16,777,216(2^24) */
+#define MARUCAM_MEM_SIZE (1 << 24)
+#define MARUCAM_REG_SIZE (1 << 8) /* 64 * 4Byte = 256(2^8) */
+#define MARUCAM_IOMEM_SIZE (1 << 9) /* 512Byte(2^9) */
/*
* I/O functions
diff --git a/tizen/src/hw/pci/maru_camera.h b/tizen/src/hw/pci/maru_camera.h
index c321f0849f..1f19693ef4 100644
--- a/tizen/src/hw/pci/maru_camera.h
+++ b/tizen/src/hw/pci/maru_camera.h
@@ -34,6 +34,7 @@
#include "qemu/thread.h"
#define MARUCAM_SKIPFRAMES 2
+#define MARUCAM_MAX_ARGS 480
#define MARUCAM_THREAD_NAME "marucam_worker_thread"
@@ -97,12 +98,8 @@ typedef struct MaruCamBackend {
} MaruCamBackend;
typedef struct ArgsMem {
- uint32_t index;
- uint32_t type;
- size_t size;
int32_t ret_val;
- int32_t err_code;
- void *data;
+ char data[MARUCAM_MAX_ARGS];
} ArgsMem;
struct MaruCamState {
diff --git a/tizen/src/hw/pci/maru_camera_linux.c b/tizen/src/hw/pci/maru_camera_linux.c
index 818f796f46..c57f0782a4 100644
--- a/tizen/src/hw/pci/maru_camera_linux.c
+++ b/tizen/src/hw/pci/maru_camera_linux.c
@@ -98,7 +98,7 @@ struct MCStoredFrame {
typedef struct MCBackendV4l2 {
MaruCamBackend base;
- char *dev_name;
+ char dev_name[16];
int fd;
int convert_trial;
int ready_count;
@@ -328,26 +328,26 @@ static void set_maxframeinterval(int fd, uint32_t pixel_format,
}
}
-static uint32_t stop_capturing(MCBackendV4l2 *backend)
+static int32_t stop_capturing(MCBackendV4l2 *backend)
{
enum v4l2_buf_type type;
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl(backend->fd, VIDIOC_STREAMOFF, &type) < 0) {
ERR("Failed to ioctl() with VIDIOC_STREAMOFF: %s\n", strerror(errno));
- return errno;
+ return -errno;
}
return 0;
}
-static uint32_t start_capturing(MCBackendV4l2 *backend)
+static int32_t start_capturing(MCBackendV4l2 *backend)
{
enum v4l2_buf_type type;
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl(backend->fd, VIDIOC_STREAMON, &type) < 0) {
ERR("Failed to ioctl() with VIDIOC_STREAMON: %s\n", strerror(errno));
- return errno;
+ return -errno;
}
return 0;
}
@@ -409,7 +409,7 @@ static void free_framebuffers(MCBackendV4l2 *backend)
backend->fb_num = 0;
}
-static uint32_t
+static int32_t
mmap_framebuffers(MCBackendV4l2 *backend)
{
struct v4l2_requestbuffers req;
@@ -427,17 +427,17 @@ mmap_framebuffers(MCBackendV4l2 *backend)
} else {
ERR("Failed to request bufs: %s\n", strerror(errno));
}
- return errno;
+ return -errno;
}
if (req.count == 0) {
ERR("Insufficient buffer memory on %s\n", backend->dev_name);
- return EINVAL;
+ return -EINVAL;
}
*fb = g_new0(MCBuffer, req.count);
if (*fb == NULL) {
ERR("Not enough memory to allocate framebuffers\n");
- return ENOMEM;
+ return -ENOMEM;
}
for (*buf_num = 0; *buf_num < req.count; ++*buf_num) {
@@ -449,7 +449,7 @@ mmap_framebuffers(MCBackendV4l2 *backend)
if (xioctl(backend->fd, VIDIOC_QUERYBUF, &buf) < 0) {
ERR("Failed to ioctl() with VIDIOC_QUERYBUF: %s\n",
strerror(errno));
- return errno;
+ return -errno;
}
(*fb)[*buf_num].size = buf.length;
@@ -460,7 +460,7 @@ mmap_framebuffers(MCBackendV4l2 *backend)
backend->fd, buf.m.offset);
if (MAP_FAILED == (*fb)[*buf_num].data) {
ERR("Failed to mmap: %s\n", strerror(errno));
- return errno;
+ return -errno;
}
/* Queue the mapped buffer. */
@@ -470,7 +470,7 @@ mmap_framebuffers(MCBackendV4l2 *backend)
buf.index = *buf_num;
if (xioctl(backend->fd, VIDIOC_QBUF, &buf) < 0) {
ERR("Failed to ioctl() with VIDIOC_QBUF: %s\n", strerror(errno));
- return errno;
+ return -errno;
}
}
return 0;
@@ -867,11 +867,15 @@ static void backend_v4l2_open(MaruCamState *state)
{
MCBackendV4l2 *backend = (MCBackendV4l2 *)(state->backend);
+ if (backend->dev_name[0] == '\0') {
+ const char *dev_name = "/dev/video0";
+ pstrcpy(backend->dev_name, sizeof(backend->dev_name), dev_name);
+ }
+
backend->fd = v4l2_open(backend->dev_name, O_RDWR | O_NONBLOCK, 0);
if (backend->fd < 0) {
ERR("The v4l2 device open failed: %s\n", backend->dev_name);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
INFO("Opened\n");
@@ -934,22 +938,20 @@ static void backend_v4l2_stream_on(MaruCamState *state)
backend->dst_fmt.fmt.pix.height,
backend->dst_fmt.fmt.pix.sizeimage);
- state->io_ptr->err_code = mmap_framebuffers(backend);
- if (state->io_ptr->err_code) {
+ state->io_ptr->ret_val = mmap_framebuffers(backend);
+ if (state->io_ptr->ret_val) {
ERR("Failed to mmap framebuffers\n");
if (backend->fbs != NULL) {
free_framebuffers(backend);
}
- state->io_ptr->ret_val = -1;
return;
}
- state->io_ptr->err_code = start_capturing(backend);
- if (state->io_ptr->err_code) {
+ state->io_ptr->ret_val = start_capturing(backend);
+ if (state->io_ptr->ret_val) {
if (backend->fbs != NULL) {
free_framebuffers(backend);
}
- state->io_ptr->ret_val = -1;
return;
}
@@ -988,10 +990,10 @@ static void backend_v4l2_stream_off(MaruCamState *state)
backend_v4l2_storedframe_set(backend);
}
- state->io_ptr->err_code = stop_capturing(backend);
- if (state->io_ptr->err_code) {
+ state->io_ptr->ret_val = stop_capturing(backend);
+ if (state->io_ptr->ret_val) {
ERR("Try again to turn off streaming\n");
- state->io_ptr->err_code = stop_capturing(backend);
+ state->io_ptr->ret_val = stop_capturing(backend);
}
if (backend->fbs != NULL) {
free_framebuffers(backend);
@@ -1006,10 +1008,6 @@ static void backend_v4l2_stream_off(MaruCamState *state)
strerror(errno));
}
- if (state->io_ptr->err_code) {
- state->io_ptr->ret_val = -1;
- }
-
INFO("Stopping preview\n");
}
@@ -1048,8 +1046,7 @@ static void backend_v4l2_s_fmt(MaruCamState *state)
ERR("Failed to set video format: format(0x%x), w:h(%d:%d), "
"errstr(%s)\n", f->fmt.pix.pixelformat, f->fmt.pix.width,
f->fmt.pix.height, strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
@@ -1068,8 +1065,7 @@ static void backend_v4l2_g_fmt(MaruCamState *state)
if (xioctl(backend->fd, VIDIOC_G_FMT, f) < 0) {
ERR("Failed to get video format: %s\n", strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
TRACE("Get the format: w:h(%dx%d), fmt(0x%x), "
@@ -1088,8 +1084,7 @@ static void backend_v4l2_try_fmt(MaruCamState *state)
ERR("Failed to check video format: format(0x%x), w:h(%d:%d),"
" errstr(%s)\n", f->fmt.pix.pixelformat, f->fmt.pix.width,
f->fmt.pix.height, strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
TRACE("Check the format: w:h(%dx%d), pix_fmt(0x%x), "
@@ -1104,8 +1099,7 @@ static void backend_v4l2_enum_fmt(MaruCamState *state)
struct v4l2_fmtdesc *f = (struct v4l2_fmtdesc *)state->io_ptr->data;
if (f->index >= ARRAY_SIZE(support_fmts)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
@@ -1125,8 +1119,7 @@ static void backend_v4l2_enum_fmt(MaruCamState *state)
break;
default:
ERR("Invalid fixel format\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
break;
}
}
@@ -1163,8 +1156,7 @@ static void backend_v4l2_query_ctrl(MaruCamState *state)
break;
default:
ERR("Invalid control ID\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
@@ -1172,8 +1164,7 @@ static void backend_v4l2_query_ctrl(MaruCamState *state)
if (errno != EINVAL) {
ERR("Failed to query video controls: %s\n", strerror(errno));
}
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
} else {
struct v4l2_control sctrl, gctrl;
@@ -1184,8 +1175,7 @@ static void backend_v4l2_query_ctrl(MaruCamState *state)
ERR("[%s] Failed to get video control value: id(0x%x), "
"errstr(%s)\n",
__func__, gctrl.id, strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
@@ -1205,14 +1195,12 @@ static void backend_v4l2_query_ctrl(MaruCamState *state)
ERR("[%s] Failed to set control value: id(0x%x), value(%d), "
"errstr(%s)\n",
__func__, sctrl.id, sctrl.value, strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
- INFO("Query Control: id(0x%x), name(%s), min(%d), max(%d), "
- "step(%d), def_value(%d)\n"
- "flags(0x%x), get_value(%d), set_value(%d)\n",
+ INFO("Query Control: id(0x%x), name(%s), min(%d), max(%d), step(%d), "
+ "def_value(%d), flags(0x%x), get_value(%d), set_value(%d)\n",
qc->id, qc->name, qc->minimum, qc->maximum,
qc->step, qc->default_value, qc->flags,
gctrl.value, sctrl.value);
@@ -1250,8 +1238,7 @@ static void backend_v4l2_s_ctrl(MaruCamState *state)
break;
default:
ERR("Our emulator does not support this control: 0x%x\n", ctrl->id);
- state->io_ptr->err_code= EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val= EINVAL;
return;
}
@@ -1260,8 +1247,7 @@ static void backend_v4l2_s_ctrl(MaruCamState *state)
if (xioctl(backend->fd, VIDIOC_S_CTRL, ctrl) < 0) {
ERR("Failed to set control value: id(0x%x), value(%d), errstr(%s)\n",
ctrl->id, ctrl->value, strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
}
@@ -1291,15 +1277,13 @@ static void backend_v4l2_g_ctrl(MaruCamState *state)
break;
default:
ERR("Our emulator does not support this control: 0x%x\n", ctrl->id);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
if (xioctl(backend->fd, VIDIOC_G_CTRL, ctrl) < 0) {
ERR("Failed to get video control value: %s\n", strerror(errno));
- state->io_ptr->err_code = errno;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -errno;
return;
}
ctrl->value = value_convert_to_guest(ctrl_tbl[i].min,
@@ -1313,8 +1297,7 @@ static void backend_v4l2_enum_fsizes(MaruCamState *state)
uint32_t i;
if (fsize->index >= ARRAY_SIZE(support_frames)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
for (i = 0; i < ARRAY_SIZE(support_fmts); i++) {
@@ -1324,8 +1307,7 @@ static void backend_v4l2_enum_fsizes(MaruCamState *state)
}
if (i == ARRAY_SIZE(support_fmts)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
@@ -1347,8 +1329,7 @@ static void backend_v4l2_enum_fintv(MaruCamState *state)
fival->discrete.denominator = 30;
break;
default:
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
}
diff --git a/tizen/src/hw/pci/maru_camera_win32.c b/tizen/src/hw/pci/maru_camera_win32.c
index 60ce5580b3..8d0d5d7258 100644
--- a/tizen/src/hw/pci/maru_camera_win32.c
+++ b/tizen/src/hw/pci/maru_camera_win32.c
@@ -1938,8 +1938,7 @@ static void backend_win_open(MaruCamState *state)
if (FAILED(hr)) {
ERR("CoInitailizeEx failure\n");
ERR("Device open failed: HRESULT(0x%x)\n", hr);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -1951,8 +1950,7 @@ static void backend_win_open(MaruCamState *state)
RemoveFilters(backend);
CloseInterfaces(backend);
CoUninitialize();
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -1964,8 +1962,7 @@ static void backend_win_open(MaruCamState *state)
RemoveFilters(backend);
CloseInterfaces(backend);
CoUninitialize();
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -1977,8 +1974,7 @@ static void backend_win_open(MaruCamState *state)
RemoveFilters(backend);
CloseInterfaces(backend);
CoUninitialize();
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -1990,8 +1986,7 @@ static void backend_win_open(MaruCamState *state)
RemoveFilters(backend);
CloseInterfaces(backend);
CoUninitialize();
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2008,8 +2003,7 @@ static void backend_win_open(MaruCamState *state)
RemoveFilters(backend);
CloseInterfaces(backend);
CoUninitialize();
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2060,8 +2054,7 @@ static void backend_win_stream_on(MaruCamState *state)
hr = HWCPin_SetCallback(backend->pInPin, backend->pCallback);
if (FAILED(hr)) {
ERR("Failed to set IGrabCallback interface.\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2071,16 +2064,14 @@ static void backend_win_stream_on(MaruCamState *state)
}
backend->buf = (void *)g_malloc0(state->buf_size);
if (backend->buf == NULL) {
- state->io_ptr->err_code = ENOMEM;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -ENOMEM;
return;
}
hr = IMediaControl_Run(backend->pMC);
if (FAILED(hr)) {
ERR("Failed to run media control. hr=0x%x\n", hr);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2104,16 +2095,14 @@ static void backend_win_stream_off(MaruCamState *state)
hr = HWCPin_SetCallback(backend->pInPin, NULL);
if (FAILED(hr)) {
ERR("Failed to set IGrabCallback interface.\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
hr = backend->pMC->lpVtbl->Stop(backend->pMC);
if (FAILED(hr)) {
ERR("Failed to stop media control.\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2156,8 +2145,7 @@ static void backend_win_s_fmt(MaruCamState *state)
}
}
if (fidx == ARRAY_SIZE(support_frames)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
for (pidx = 0; pidx < ARRAY_SIZE(support_fmts); pidx++) {
@@ -2166,8 +2154,7 @@ static void backend_win_s_fmt(MaruCamState *state)
}
}
if (pidx == ARRAY_SIZE(support_fmts)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2176,8 +2163,7 @@ static void backend_win_s_fmt(MaruCamState *state)
HRESULT hr = SetFormat(backend, f->fmt.pix.width, f->fmt.pix.height,
f->fmt.pix.pixelformat);
if (FAILED(hr)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
}
@@ -2238,8 +2224,7 @@ static void backend_win_try_fmt(MaruCamState *state)
}
}
if (i == ARRAY_SIZE(support_frames)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
for (i = 0; i < ARRAY_SIZE(support_fmts); i++) {
@@ -2248,8 +2233,7 @@ static void backend_win_try_fmt(MaruCamState *state)
}
}
if (i == ARRAY_SIZE(support_fmts)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2274,8 +2258,7 @@ static void backend_win_enum_fmt(MaruCamState *state)
struct v4l2_fmtdesc *f = (struct v4l2_fmtdesc *)state->io_ptr->data;
if (f->index >= ARRAY_SIZE(support_fmts)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2295,8 +2278,7 @@ static void backend_win_enum_fmt(MaruCamState *state)
break;
default:
ERR("Invalid fixel format\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
break;
}
}
@@ -2339,15 +2321,13 @@ static void backend_win_query_ctrl(MaruCamState *state)
break;
default:
ERR("Invalid control ID\n");
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
hr = QueryVideoProcAmp(backend, property, &min, &max, &step, &def_val);
if (FAILED(hr)) {
ERR("Failed to query video controls: HRESULT(0x%x)\n", hr);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
} else {
ctrl_tbl[i].hit = 1;
@@ -2365,8 +2345,7 @@ static void backend_win_query_ctrl(MaruCamState *state)
if (FAILED(hr)) {
ERR("Failed to set video control value when query controls: "
"HRESULT(0x%x)\n", hr);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;
return;
}
INFO("Query Control: id(0x%x), name(%s), "
@@ -2415,8 +2394,7 @@ static void backend_win_s_ctrl(MaruCamState *state)
break;
default:
ERR("Our emulator does not support this control: 0x%x\n", ctrl->id);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
set_val = value_convert_from_guest(ctrl_tbl[i].min,
@@ -2424,8 +2402,7 @@ static void backend_win_s_ctrl(MaruCamState *state)
hr = SetVideoProcAmp(backend, property, set_val);
if (FAILED(hr)) {
ERR("Failed to set video control value: HRESULT(0x%x)\n", hr);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
}
@@ -2461,16 +2438,14 @@ static void backend_win_g_ctrl(MaruCamState *state)
break;
default:
ERR("Our emulator does not support this control: 0x%x\n", ctrl->id);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
hr = GetVideoProcAmp(backend, property, &get_val);
if (FAILED(hr)) {
ERR("Failed to get video control value: HRESULT(0x%x)\n", hr);
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2486,8 +2461,7 @@ static void backend_win_enum_fsizes(MaruCamState *state)
uint32_t i;
if (fsize->index >= ARRAY_SIZE(support_frames)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
for (i = 0; i < ARRAY_SIZE(support_fmts); i++) {
@@ -2497,8 +2471,7 @@ static void backend_win_enum_fsizes(MaruCamState *state)
}
if (i == ARRAY_SIZE(support_fmts)) {
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
@@ -2521,8 +2494,7 @@ static void backend_win_enum_fintv(MaruCamState *state)
fival->discrete.denominator = 30;
break;
default:
- state->io_ptr->err_code = EINVAL;
- state->io_ptr->ret_val = -1;
+ state->io_ptr->ret_val = -EINVAL;;
return;
}
}