diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2018-03-15 13:34:08 +0100 |
---|---|---|
committer | Boram Park <boram1288.park@samsung.com> | 2018-03-29 17:20:34 +0900 |
commit | b59be207365d10efd489e6f71c8a045b558c44fe (patch) | |
tree | dfc7282ce63fc6f534fd4165f33732889d14a4ad | |
parent | 473cb25d01c8161675a2a5e20fb3eb42c2bc31b5 (diff) | |
download | libtdm-exynos-b59be207365d10efd489e6f71c8a045b558c44fe.tar.gz libtdm-exynos-b59be207365d10efd489e6f71c8a045b558c44fe.tar.bz2 libtdm-exynos-b59be207365d10efd489e6f71c8a045b558c44fe.zip |
libtdm-exynos: initial port to Exynos DRM IPPv2 userspace API
PP function has been ported to the new Exynos DRM IPPv2 API.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Id7eab00c4d8dcb366448d746844850f7b0eaa4e4
-rw-r--r-- | src/tdm_exynos.c | 15 | ||||
-rw-r--r-- | src/tdm_exynos_pp.c | 418 | ||||
-rw-r--r-- | src/tdm_exynos_pp.h | 7 | ||||
-rw-r--r-- | src/tdm_exynos_types.h | 2 |
4 files changed, 207 insertions, 235 deletions
diff --git a/src/tdm_exynos.c b/src/tdm_exynos.c index ffb3e6d..85c0be2 100644 --- a/src/tdm_exynos.c +++ b/src/tdm_exynos.c @@ -189,17 +189,14 @@ close_l: static int _tdm_exynos_drm_user_handler(struct drm_event *event) { - struct drm_exynos_ipp_event *ipp; + struct drm_exynos_ipp2_event *ipp; - if (event->type != DRM_EXYNOS_IPP_EVENT) + if (event->type != DRM_EXYNOS_IPP2_EVENT) return -1; - TDM_DBG("got ipp event"); + ipp = (struct drm_exynos_ipp2_event *)event; - ipp = (struct drm_exynos_ipp_event *)event; - - tdm_exynos_pp_handler(ipp->prop_id, ipp->buf_id, ipp->tv_sec, ipp->tv_usec, - (void *)(unsigned long)ipp->user_data); + tdm_exynos_pp_handler(ipp->tv_sec, ipp->tv_usec, (void *)(unsigned long)ipp->user_data); return 0; } @@ -445,6 +442,10 @@ tdm_exynos_init(tdm_display *dpy, tdm_error *error) } else TDM_DBG("plane doesn't have zpos info"); + ret = tdm_exynos_pp_init(exynos_data); + if (ret != TDM_ERROR_NONE) + goto failed; + ret = tdm_exynos_display_create_output_list(exynos_data); if (ret != TDM_ERROR_NONE) goto failed; diff --git a/src/tdm_exynos_pp.c b/src/tdm_exynos_pp.c index 2310f90..1f9e4f2 100644 --- a/src/tdm_exynos_pp.c +++ b/src/tdm_exynos_pp.c @@ -4,21 +4,10 @@ #include "tdm_exynos.h" -typedef struct _tdm_exynos_pp_buffer { - int index; - tbm_surface_h src; - tbm_surface_h dst; - - struct list_head link; -} tdm_exynos_pp_buffer; - typedef struct _tdm_exynos_pp_data { tdm_exynos_data *exynos_data; - unsigned int prop_id; - tdm_info_pp info; - int info_changed; struct list_head pending_buffer_list; struct list_head buffer_list; @@ -26,202 +15,134 @@ typedef struct _tdm_exynos_pp_data { tdm_pp_done_handler done_func; void *done_user_data; - int startd; int first_event; struct list_head link; } tdm_exynos_pp_data; +typedef struct _tdm_exynos_pp_buffer { + tdm_exynos_pp_data *pp_data; + tbm_surface_h src; + tbm_surface_h dst; -static tbm_format pp_formats[] = { - TBM_FORMAT_ARGB8888, - TBM_FORMAT_XRGB8888, - TBM_FORMAT_NV12, - TBM_FORMAT_NV21, - TBM_FORMAT_YUV420, - TBM_FORMAT_YVU420, -#ifdef HAVE_TILED_FORMAT - TBM_FORMAT_NV12MT, -#endif -}; + struct list_head link; +} tdm_exynos_pp_buffer; -#define NUM_PP_FORMAT (sizeof(pp_formats) / sizeof(pp_formats[0])) static int pp_list_init; static struct list_head pp_list; -static int -_get_index(tdm_exynos_pp_data *pp_data) +struct exynos_drm_ipp_std_task { + struct drm_exynos_ipp_task_buffer buf[2]; + struct drm_exynos_ipp_task_rect rect[2]; + struct drm_exynos_ipp_task_transform transform; +} __packed; + +static unsigned int tdm_transform_to_drm(tdm_transform t) { - tdm_exynos_pp_buffer *buffer = NULL; - int ret = 0; - - while (1) { - int found = 0; - LIST_FOR_EACH_ENTRY(buffer, &pp_data->pending_buffer_list, link) { - if (ret == buffer->index) { - found = 1; - break; - } - } - if (!found) - LIST_FOR_EACH_ENTRY(buffer, &pp_data->buffer_list, link) { - if (ret == buffer->index) { - found = 1; - break; - } - } - if (!found) - break; - ret++; + switch (t) { + case TDM_TRANSFORM_NORMAL: + return DRM_MODE_ROTATE_0; + case TDM_TRANSFORM_90: + return DRM_MODE_ROTATE_90; + case TDM_TRANSFORM_180: + return DRM_MODE_ROTATE_180; + case TDM_TRANSFORM_270: + return DRM_MODE_ROTATE_270; + case TDM_TRANSFORM_FLIPPED: + return DRM_MODE_REFLECT_X; + case TDM_TRANSFORM_FLIPPED_90: + return DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_90; + case TDM_TRANSFORM_FLIPPED_180: + return DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_180; + case TDM_TRANSFORM_FLIPPED_270: + return DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_270; } - - return ret; + return 0; } static tdm_error -_tdm_exynos_pp_set(tdm_exynos_pp_data *pp_data) +_tdm_exynos_pp_process(tdm_exynos_pp_data *pp_data, tdm_exynos_pp_buffer *buffer) { tdm_exynos_data *exynos_data = pp_data->exynos_data; tdm_info_pp *info = &pp_data->info; - struct drm_exynos_ipp_property property; - int ret = 0; - - CLEAR(property); - property.config[0].ops_id = EXYNOS_DRM_OPS_SRC; - property.config[0].fmt = tdm_exynos_format_to_drm_format(info->src_config.format); - memcpy(&property.config[0].sz, &info->src_config.size, sizeof(tdm_size)); - memcpy(&property.config[0].pos, &info->src_config.pos, sizeof(tdm_pos)); - property.config[1].ops_id = EXYNOS_DRM_OPS_DST; - property.config[1].degree = info->transform % 4; - property.config[1].flip = (info->transform > 3) ? EXYNOS_DRM_FLIP_HORIZONTAL : 0; - property.config[1].fmt = tdm_exynos_format_to_drm_format(info->dst_config.format); - memcpy(&property.config[1].sz, &info->dst_config.size, sizeof(tdm_size)); - memcpy(&property.config[1].pos, &info->dst_config.pos, sizeof(tdm_pos)); - property.cmd = IPP_CMD_M2M; - property.prop_id = pp_data->prop_id; - - TDM_DBG("src : flip(%x) deg(%d) fmt(%c%c%c%c) sz(%dx%d) pos(%d,%d %dx%d) ", - property.config[0].flip, property.config[0].degree, - FOURCC_STR(property.config[0].fmt), - property.config[0].sz.hsize, property.config[0].sz.vsize, - property.config[0].pos.x, property.config[0].pos.y, property.config[0].pos.w, - property.config[0].pos.h); - TDM_DBG("dst : flip(%x) deg(%d) fmt(%c%c%c%c) sz(%dx%d) pos(%d,%d %dx%d) ", - property.config[1].flip, property.config[1].degree, - FOURCC_STR(property.config[1].fmt), - property.config[1].sz.hsize, property.config[1].sz.vsize, - property.config[1].pos.x, property.config[1].pos.y, property.config[1].pos.w, - property.config[1].pos.h); - - ret = ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY, &property); - if (ret) { - TDM_ERR("failed: %m"); - return TDM_ERROR_OPERATION_FAILED; - } + int i, bo_num, ret = 0; - TDM_DBG("success. prop_id(%d) ", property.prop_id); - pp_data->prop_id = property.prop_id; - return TDM_ERROR_NONE; -} + struct exynos_drm_ipp_std_task task; + struct drm_exynos_ioctl_ipp_commit arg; -static tdm_error -_tdm_exynos_pp_queue(tdm_exynos_pp_data *pp_data, tdm_exynos_pp_buffer *buffer, - enum drm_exynos_ipp_buf_type type) -{ - tdm_exynos_data *exynos_data = pp_data->exynos_data; - struct drm_exynos_ipp_queue_buf buf; - int i, bo_num, ret = 0; + CLEAR(task); + + task.buf[0].id = DRM_EXYNOS_IPP_TASK_BUFFER | DRM_EXYNOS_IPP_TASK_TYPE_SOURCE; + task.buf[0].fourcc = tdm_exynos_format_to_drm_format(tbm_surface_get_format(buffer->src)); + task.buf[0].width = tbm_surface_get_width(buffer->src); + task.buf[0].height = tbm_surface_get_height(buffer->src); - CLEAR(buf); - buf.prop_id = pp_data->prop_id; - buf.ops_id = EXYNOS_DRM_OPS_SRC; - buf.buf_type = type; - buf.buf_id = buffer->index; - buf.user_data = (__u64)(uintptr_t)pp_data; bo_num = tbm_surface_internal_get_num_bos(buffer->src); for (i = 0; i < EXYNOS_DRM_PLANAR_MAX && i < bo_num; i++) { tbm_bo bo = tbm_surface_internal_get_bo(buffer->src, i); - buf.handle[i] = (__u32)tbm_bo_get_handle(bo, TBM_DEVICE_DEFAULT).u32; - } + uint32_t size, offset, pitch; - TDM_DBG("prop_id(%d) ops_id(%d) ctrl(%d) id(%d) handles(%x %x %x). ", - buf.prop_id, buf.ops_id, buf.buf_type, buf.buf_id, - buf.handle[0], buf.handle[1], buf.handle[2]); - - ret = ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF, &buf); - if (ret) { - TDM_ERR("src failed. prop_id(%d) op(%d) buf(%d) id(%d). %m", - buf.prop_id, buf.ops_id, buf.buf_type, buf.buf_id); - return TDM_ERROR_OPERATION_FAILED; + tbm_surface_internal_get_plane_data(buffer->src, i, &size, &offset, &pitch); + task.buf[0].gem_id[i] = tbm_bo_get_handle(bo, TBM_DEVICE_DEFAULT).u32; + task.buf[0].pitch[i] = pitch; + task.buf[0].offset[i] = offset; } - CLEAR(buf); - buf.prop_id = pp_data->prop_id; - buf.ops_id = EXYNOS_DRM_OPS_DST; - buf.buf_type = type; - buf.buf_id = buffer->index; - buf.user_data = (__u64)(uintptr_t)pp_data; + task.buf[1].id = DRM_EXYNOS_IPP_TASK_BUFFER | DRM_EXYNOS_IPP_TASK_TYPE_DESTINATION; + task.buf[1].fourcc = tdm_exynos_format_to_drm_format(tbm_surface_get_format(buffer->dst)); + task.buf[1].width = tbm_surface_get_width(buffer->dst); + task.buf[1].height = tbm_surface_get_height(buffer->dst); + bo_num = tbm_surface_internal_get_num_bos(buffer->dst); for (i = 0; i < EXYNOS_DRM_PLANAR_MAX && i < bo_num; i++) { tbm_bo bo = tbm_surface_internal_get_bo(buffer->dst, i); - buf.handle[i] = (__u32)tbm_bo_get_handle(bo, TBM_DEVICE_DEFAULT).u32; - } + uint32_t size, offset, pitch; - TDM_DBG("prop_id(%d) ops_id(%d) ctrl(%d) id(%d) handles(%x %x %x). ", - buf.prop_id, buf.ops_id, buf.buf_type, buf.buf_id, - buf.handle[0], buf.handle[1], buf.handle[2]); - - ret = ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF, &buf); - if (ret) { - TDM_ERR("dst failed. prop_id(%d) op(%d) buf(%d) id(%d). %m", - buf.prop_id, buf.ops_id, buf.buf_type, buf.buf_id); - return TDM_ERROR_OPERATION_FAILED; + tbm_surface_internal_get_plane_data(buffer->dst, i, &size, &offset, &pitch); + task.buf[1].gem_id[i] = tbm_bo_get_handle(bo, TBM_DEVICE_DEFAULT).u32; + task.buf[1].pitch[i] = pitch; + task.buf[1].offset[i] = offset; } - TDM_DBG("success. prop_id(%d)", buf.prop_id); - - return TDM_ERROR_NONE; -} - -static tdm_error -_tdm_exynos_pp_cmd(tdm_exynos_pp_data *pp_data, enum drm_exynos_ipp_ctrl cmd) -{ - tdm_exynos_data *exynos_data = pp_data->exynos_data; - struct drm_exynos_ipp_cmd_ctrl ctrl; - int ret = 0; - - ctrl.prop_id = pp_data->prop_id; - ctrl.ctrl = cmd; - - TDM_DBG("prop_id(%d) ctrl(%d). ", ctrl.prop_id, ctrl.ctrl); - - ret = ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_CMD_CTRL, &ctrl); + task.rect[0].id = DRM_EXYNOS_IPP_TASK_RECTANGLE | DRM_EXYNOS_IPP_TASK_TYPE_SOURCE; + task.rect[0].x = info->src_config.pos.x; + task.rect[0].y = info->src_config.pos.y; + task.rect[0].w = info->src_config.pos.w; + task.rect[0].h = info->src_config.pos.h; + + task.rect[1].id = DRM_EXYNOS_IPP_TASK_RECTANGLE | DRM_EXYNOS_IPP_TASK_TYPE_DESTINATION; + task.rect[1].x = info->dst_config.pos.x; + task.rect[1].y = info->dst_config.pos.y; + task.rect[1].w = info->dst_config.pos.w; + task.rect[1].h = info->dst_config.pos.h; + + task.transform.id = DRM_EXYNOS_IPP_TASK_TRANSFORM; + task.transform.rotation = tdm_transform_to_drm(info->transform); + + CLEAR(arg); + arg.flags = DRM_EXYNOS_IPP_FLAG_EVENT | DRM_EXYNOS_IPP_FLAG_NONBLOCK; + arg.ipp_id = exynos_data->ipp_module_id; + arg.params_size = sizeof(task); + arg.params_ptr = (unsigned long)(&task); + arg.user_data = (__u64)(uintptr_t)buffer; + + ret = ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_COMMIT, &arg); if (ret) { - TDM_ERR("failed. prop_id(%d) ctrl(%d). %m", ctrl.prop_id, ctrl.ctrl); + TDM_ERR("ipp commit failed. %xx pp_data(%p), buffer(%p). %m", DRM_IOCTL_EXYNOS_IPP_COMMIT, pp_data, buffer); return TDM_ERROR_OPERATION_FAILED; } - TDM_DBG("success. prop_id(%d) ", ctrl.prop_id); - return TDM_ERROR_NONE; } void -tdm_exynos_pp_cb(int fd, unsigned int prop_id, unsigned int *buf_idx, - unsigned int tv_sec, unsigned int tv_usec, void *user_data) +tdm_exynos_pp_handler(unsigned int tv_sec, unsigned int tv_usec, void *data) { - tdm_exynos_pp_handler(prop_id, buf_idx, tv_sec, tv_usec, user_data); -} - -void -tdm_exynos_pp_handler(unsigned int prop_id, unsigned int *buf_idx, - unsigned int tv_sec, unsigned int tv_usec, void *data) -{ - tdm_exynos_pp_data *found = NULL, *d = NULL, *pp_data = data; - tdm_exynos_pp_buffer *b = NULL, *bb = NULL, *dequeued_buffer = NULL; + tdm_exynos_pp_buffer *b, *bb, *dequeued_buffer = data; + tdm_exynos_pp_data *pp_data; - if (!pp_data || !buf_idx) { + if (!dequeued_buffer) { TDM_ERR("invalid params"); return; } @@ -229,31 +150,18 @@ tdm_exynos_pp_handler(unsigned int prop_id, unsigned int *buf_idx, if (!pp_list_init) return; - LIST_FOR_EACH_ENTRY(d, &pp_list, link) { - if (d == pp_data) { - found = d; - break; - } - } - if (!found) - return; + pp_data = dequeued_buffer->pp_data; - TDM_DBG("pp_data(%p) index(%d, %d)", pp_data, buf_idx[0], buf_idx[1]); + TDM_DBG("pp_data(%p) buffer(%p)", pp_data, dequeued_buffer); LIST_FOR_EACH_ENTRY_SAFE(b, bb, &pp_data->buffer_list, link) { - if (buf_idx[0] == b->index) { - dequeued_buffer = b; + if (b == dequeued_buffer) { LIST_DEL(&dequeued_buffer->link); - TDM_DBG("dequeued: %d", dequeued_buffer->index); + TDM_DBG("dequeued: %p", dequeued_buffer); break; } } - if (!dequeued_buffer) { - TDM_ERR("not found buffer index: %d", buf_idx[0]); - return; - } - if (!pp_data->first_event) { TDM_DBG("pp(%p) got a first event. ", pp_data); pp_data->first_event = 1; @@ -261,34 +169,128 @@ tdm_exynos_pp_handler(unsigned int prop_id, unsigned int *buf_idx, if (pp_data->done_func) pp_data->done_func(pp_data, - dequeued_buffer->src, - dequeued_buffer->dst, - pp_data->done_user_data); + dequeued_buffer->src, + dequeued_buffer->dst, + pp_data->done_user_data); free(dequeued_buffer); } +static enum drm_exynos_ipp_capability required_exynos_ipp_caps = + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | + DRM_EXYNOS_IPP_CAP_SCALE | DRM_EXYNOS_IPP_CAP_CONVERT; + tdm_error -tdm_exynos_pp_get_capability(tdm_exynos_data *exynos_data, tdm_caps_pp *caps) +tdm_exynos_pp_init(tdm_exynos_data *exynos_data) { + struct drm_exynos_ioctl_ipp_get_caps caps_arg; + struct drm_exynos_ioctl_ipp_get_res res_arg; + uint32_t *ipps; int i; + exynos_data->ipp_module_id = -1; + + CLEAR(res_arg); + if (ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES, + &res_arg)) { + TDM_ERR("failed to get Exynos IPP resources"); + return TDM_ERROR_NO_CAPABILITY; + } + + ipps = calloc(res_arg.count_ipps, sizeof(*ipps)); + if (!ipps) { + TDM_ERR("alloc failed"); + return TDM_ERROR_OUT_OF_MEMORY; + } + + res_arg.ipp_id_ptr = (unsigned long)ipps; + if (ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES, + &res_arg)) { + TDM_ERR("failed to get Exynos IPP resources"); + free(ipps); + return TDM_ERROR_NO_CAPABILITY; + } + + for (i = 0; i < res_arg.count_ipps; i++) { + CLEAR(caps_arg); + caps_arg.ipp_id = ipps[i]; + if (ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_GET_CAPS, + &caps_arg)) { + TDM_ERR("failed to get IPP capabilities"); + free(ipps); + return TDM_ERROR_NO_CAPABILITY; + } + if ((caps_arg.capabilities & required_exynos_ipp_caps) == + required_exynos_ipp_caps) + break; + } + if (i == res_arg.count_ipps) { + free(ipps); + return TDM_ERROR_NO_CAPABILITY; + } + + TDM_INFO("selected Exynos IPP module id %d", ipps[i]); + exynos_data->ipp_module_id = ipps[i]; + free(ipps); + + return TDM_ERROR_NONE; +} + +tdm_error +tdm_exynos_pp_get_capability(tdm_exynos_data *exynos_data, tdm_caps_pp *caps) +{ + struct drm_exynos_ioctl_ipp_get_caps caps_arg; + struct drm_exynos_ipp_format *formats; + int i, pp_formats; + if (!caps) { TDM_ERR("invalid params"); return TDM_ERROR_INVALID_PARAMETER; } - caps->capabilities = TDM_PP_CAPABILITY_ASYNC; + CLEAR(caps_arg); + caps_arg.ipp_id = exynos_data->ipp_module_id; + if (ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_GET_CAPS, + &caps_arg)) { + TDM_ERR("failed to get IPP capabilities"); + return TDM_ERROR_NO_CAPABILITY; + } + + formats = calloc(caps_arg.formats_count, sizeof(*formats)); + if (!formats) { + TDM_ERR("alloc failed"); + return TDM_ERROR_OUT_OF_MEMORY; + } + + caps_arg.formats_ptr = (unsigned long) formats; + if (ioctl(exynos_data->drm_fd, DRM_IOCTL_EXYNOS_IPP_GET_CAPS, + &caps_arg)) { + TDM_ERR("failed to get IPP capabilities"); + free(formats); + return TDM_ERROR_NO_CAPABILITY; + } - caps->format_count = NUM_PP_FORMAT; + for (pp_formats = 0, i = 0; i < caps_arg.formats_count; i++) + if (formats[i].modifier == 0 && + tdm_exynos_format_to_tbm_format(formats[i].fourcc)) + pp_formats++; + + caps->capabilities = TDM_PP_CAPABILITY_ASYNC; + caps->format_count = pp_formats; /* will be freed in frontend */ - caps->formats = calloc(1, sizeof pp_formats); + caps->formats = calloc(pp_formats, sizeof(tbm_format)); if (!caps->formats) { TDM_ERR("alloc failed"); + free(formats); return TDM_ERROR_OUT_OF_MEMORY; } - for (i = 0; i < caps->format_count; i++) - caps->formats[i] = pp_formats[i]; + + for (pp_formats = 0, i = 0; i < caps_arg.formats_count; i++) { + tbm_format f; + f = tdm_exynos_format_to_tbm_format(formats[i].fourcc); + if (formats[i].modifier == 0 && f) + caps->formats[pp_formats++] = f; + } caps->min_w = 16; caps->min_h = 8; @@ -298,6 +300,8 @@ tdm_exynos_pp_get_capability(tdm_exynos_data *exynos_data, tdm_caps_pp *caps) caps->max_attach_count = -1; + free(formats); + return TDM_ERROR_NONE; } @@ -339,16 +343,6 @@ exynos_pp_destroy(tdm_pp *pp) LIST_DEL(&b->link); free(b); } - - LIST_FOR_EACH_ENTRY_SAFE(b, bb, &pp_data->buffer_list, link) { - LIST_DEL(&b->link); - _tdm_exynos_pp_queue(pp_data, b, IPP_BUF_DEQUEUE); - free(b); - } - - if (pp_data->prop_id) - _tdm_exynos_pp_cmd(pp_data, IPP_CTRL_STOP); - LIST_DEL(&pp_data->link); free(pp_data); @@ -368,7 +362,6 @@ exynos_pp_set_info(tdm_pp *pp, tdm_info_pp *info) } pp_data->info = *info; - pp_data->info_changed = 1; return TDM_ERROR_NONE; } @@ -390,9 +383,9 @@ exynos_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst) } LIST_ADDTAIL(&buffer->link, &pp_data->pending_buffer_list); - buffer->index = _get_index(pp_data); buffer->src = src; buffer->dst = dst; + buffer->pp_data = pp_data; return TDM_ERROR_NONE; } @@ -402,36 +395,15 @@ exynos_pp_commit(tdm_pp *pp) { tdm_exynos_pp_data *pp_data = pp; tdm_exynos_pp_buffer *b = NULL, *bb = NULL; - tdm_error ret; RETURN_VAL_IF_FAIL(pp_data, TDM_ERROR_INVALID_PARAMETER); - if (pp_data->info_changed) { - if (pp_data->startd) - _tdm_exynos_pp_cmd(pp_data, IPP_CTRL_PAUSE); - - ret = _tdm_exynos_pp_set(pp_data); - if (ret < 0) - return TDM_ERROR_OPERATION_FAILED; - } - LIST_FOR_EACH_ENTRY_SAFE(b, bb, &pp_data->pending_buffer_list, link) { LIST_DEL(&b->link); - _tdm_exynos_pp_queue(pp_data, b, IPP_BUF_ENQUEUE); - TDM_DBG("queued: %d", b->index); + _tdm_exynos_pp_process(pp_data, b); LIST_ADDTAIL(&b->link, &pp_data->buffer_list); } - if (pp_data->info_changed) { - pp_data->info_changed = 0; - - if (!pp_data->startd) { - pp_data->startd = 1; - _tdm_exynos_pp_cmd(pp_data, IPP_CTRL_PLAY); - } else - _tdm_exynos_pp_cmd(pp_data, IPP_CTRL_RESUME); - } - return TDM_ERROR_NONE; } diff --git a/src/tdm_exynos_pp.h b/src/tdm_exynos_pp.h index 0f54287..07d3d34 100644 --- a/src/tdm_exynos_pp.h +++ b/src/tdm_exynos_pp.h @@ -3,11 +3,8 @@ #include "tdm_exynos.h" +tdm_error tdm_exynos_pp_init(tdm_exynos_data *exynos_data); tdm_error tdm_exynos_pp_get_capability(tdm_exynos_data *exynos_data, tdm_caps_pp *caps); tdm_pp* tdm_exynos_pp_create(tdm_exynos_data *exynos_data, tdm_error *error); -void tdm_exynos_pp_handler(unsigned int prop_id, unsigned int *buf_idx, - unsigned int tv_sec, unsigned int tv_usec, void *data); -void tdm_exynos_pp_cb(int fd, unsigned int prop_id, unsigned int *buf_idx, - unsigned int tv_sec, unsigned int tv_usec, - void *user_data); +void tdm_exynos_pp_handler(unsigned int tv_sec, unsigned int tv_usec, void *data); #endif /* _TDM_EXYNOS_PP_H_ */ diff --git a/src/tdm_exynos_types.h b/src/tdm_exynos_types.h index 6e7affd..000a2ac 100644 --- a/src/tdm_exynos_types.h +++ b/src/tdm_exynos_types.h @@ -108,6 +108,8 @@ struct _tdm_exynos_data { struct list_head output_list; struct list_head buffer_list; + + int ipp_module_id; }; struct _tdm_exynos_output_data { |