diff --git a/drivers/media/video/msm_vidc/msm_v4l2_vidc.c b/drivers/media/video/msm_vidc/msm_v4l2_vidc.c index 1c646dda450..6cd9e6bc450 100644 --- a/drivers/media/video/msm_vidc/msm_v4l2_vidc.c +++ b/drivers/media/video/msm_vidc/msm_v4l2_vidc.c @@ -28,6 +28,7 @@ #include "msm_smem.h" #define BASE_DEVICE_NUMBER 32 +#define MAX_EVENTS 30 struct msm_vidc_drv *vidc_driver; @@ -215,21 +216,20 @@ int msm_v4l2_reqbufs(struct file *file, void *fh, int rc; struct buffer_info *bi; struct v4l2_buffer buffer_info; + struct v4l2_plane plane; v4l2_inst = get_v4l2_inst(file, NULL); if (b->count == 0) { list_for_each_safe(ptr, next, &v4l2_inst->registered_bufs) { bi = list_entry(ptr, struct buffer_info, list); if (bi->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { buffer_info.type = bi->type; - buffer_info.m.planes[0].reserved[0] = - bi->fd; - buffer_info.m.planes[0].reserved[1] = - bi->buff_off; - buffer_info.m.planes[0].length = bi->size; - buffer_info.m.planes[0].m.userptr = - bi->uvaddr; + plane.reserved[0] = bi->fd; + plane.reserved[1] = bi->buff_off; + plane.length = bi->size; + plane.m.userptr = bi->uvaddr; + buffer_info.m.planes = &plane; buffer_info.length = 1; - pr_err("Releasing buffer: %d, %d, %d\n", + pr_info("Releasing buffer: %d, %d, %d\n", buffer_info.m.planes[0].reserved[0], buffer_info.m.planes[0].reserved[1], buffer_info.m.planes[0].length); @@ -359,9 +359,7 @@ static int msm_v4l2_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscription *sub) { int rc = 0; - if (sub->type == V4L2_EVENT_ALL) - sub->type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - rc = v4l2_event_subscribe(fh, sub, 0); + rc = v4l2_event_subscribe(fh, sub, MAX_EVENTS); return rc; } @@ -445,7 +443,7 @@ static int msm_vidc_initialize_core(struct platform_device *pdev, INIT_LIST_HEAD(&core->instances); mutex_init(&core->sync_lock); spin_lock_init(&core->lock); - core->base_addr = 0x34f00000; + core->base_addr = 0x14f00000; core->state = VIDC_CORE_UNINIT; for (i = SYS_MSG_INDEX(SYS_MSG_START); i <= SYS_MSG_INDEX(SYS_MSG_END); i++) { diff --git a/drivers/media/video/msm_vidc/msm_venc.c b/drivers/media/video/msm_vidc/msm_venc.c index ed99d354e3a..ec93628967b 100644 --- a/drivers/media/video/msm_vidc/msm_venc.c +++ b/drivers/media/video/msm_vidc/msm_venc.c @@ -348,7 +348,7 @@ static const struct msm_vidc_ctrl msm_venc_ctrls[] = { { .id = V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, .name = "H.264 Loop Filter Mode", - .type = V4L2_CTRL_TYPE_INTEGER, + .type = V4L2_CTRL_TYPE_MENU, .minimum = V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED, .maximum = L_MODE, .default_value = V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED, @@ -375,7 +375,9 @@ static u32 get_frame_size_nv21(int plane, u32 height, u32 width) static u32 get_frame_size_compressed(int plane, u32 height, u32 width) { - return ((height + 31) & (~31)) * ((width + 31) & (~31)) * 3/2; + int sz = ((height + 31) & (~31)) * ((width + 31) & (~31)) * 3/2; + sz = (sz + 4095) & (~4095); + return sz; } static struct hal_quantization diff --git a/drivers/media/video/msm_vidc/msm_vidc.c b/drivers/media/video/msm_vidc/msm_vidc.c index a11f8170eff..11fbcf40957 100644 --- a/drivers/media/video/msm_vidc/msm_vidc.c +++ b/drivers/media/video/msm_vidc/msm_vidc.c @@ -186,7 +186,7 @@ int msm_vidc_streamoff(void *instance, enum v4l2_buf_type i) void *vidc_get_userptr(void *alloc_ctx, unsigned long vaddr, unsigned long size, int write) { - return NULL; + return (void *)0xdeadbeef; } void vidc_put_userptr(void *buf_priv) diff --git a/drivers/media/video/msm_vidc/msm_vidc_common.c b/drivers/media/video/msm_vidc/msm_vidc_common.c index 52f1dca8438..9b617aa3059 100644 --- a/drivers/media/video/msm_vidc/msm_vidc_common.c +++ b/drivers/media/video/msm_vidc/msm_vidc_common.c @@ -183,21 +183,9 @@ static void handle_session_init_done(enum command_response cmd, void *data) { struct msm_vidc_cb_cmd_done *response = data; struct msm_vidc_inst *inst; - struct video_device *vdev; - struct v4l2_event dqevent; - struct msm_vidc_core *core; if (response) { inst = (struct msm_vidc_inst *)response->session_id; signal_session_msg_receipt(cmd, inst); - core = inst->core; - if (inst->session_type == MSM_VIDC_ENCODER) - vdev = &core->vdev[MSM_VIDC_ENCODER].vdev; - else - vdev = &core->vdev[MSM_VIDC_DECODER].vdev; - dqevent.type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - dqevent.u.data[0] = (uint8_t)MSM_VIDC_OPEN_DONE; - v4l2_event_queue(vdev, &dqevent); - return; } else { pr_err("Failed to get valid response for session init\n"); } @@ -207,24 +195,17 @@ static void handle_event_change(enum command_response cmd, void *data) { struct msm_vidc_cb_cmd_done *response = data; struct msm_vidc_inst *inst; - struct video_device *vdev; struct v4l2_event dqevent; struct msm_vidc_cb_event *event_notify; - struct msm_vidc_core *core; if (response) { inst = (struct msm_vidc_inst *)response->session_id; - core = inst->core; - if (inst->session_type == MSM_VIDC_ENCODER) - vdev = &core->vdev[MSM_VIDC_ENCODER].vdev; - else - vdev = &core->vdev[MSM_VIDC_DECODER].vdev; - dqevent.type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - dqevent.u.data[0] = (uint8_t)MSM_VIDC_DECODER_EVENT_CHANGE; + dqevent.type = V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED; + dqevent.id = 0; event_notify = (struct msm_vidc_cb_event *) response->data; inst->reconfig_height = event_notify->height; inst->reconfig_width = event_notify->width; inst->in_reconfig = true; - v4l2_event_queue(vdev, &dqevent); + v4l2_event_queue_fh(&inst->event_handler, &dqevent); return; } else { pr_err("Failed to get valid response for event_change\n"); @@ -262,20 +243,9 @@ static void handle_start_done(enum command_response cmd, void *data) { struct msm_vidc_cb_cmd_done *response = data; struct msm_vidc_inst *inst; - struct video_device *vdev; - struct v4l2_event dqevent; - struct msm_vidc_core *core; if (response) { inst = (struct msm_vidc_inst *)response->session_id; signal_session_msg_receipt(cmd, inst); - core = inst->core; - if (inst->session_type == MSM_VIDC_ENCODER) - vdev = &core->vdev[MSM_VIDC_ENCODER].vdev; - else - vdev = &core->vdev[MSM_VIDC_DECODER].vdev; - dqevent.type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - dqevent.u.data[0] = (uint8_t)MSM_VIDC_START_DONE; - v4l2_event_queue(vdev, &dqevent); } else { pr_err("Failed to get valid response for start\n"); } @@ -285,20 +255,9 @@ static void handle_stop_done(enum command_response cmd, void *data) { struct msm_vidc_cb_cmd_done *response = data; struct msm_vidc_inst *inst; - struct video_device *vdev; - struct v4l2_event dqevent; - struct msm_vidc_core *core; if (response) { inst = (struct msm_vidc_inst *)response->session_id; signal_session_msg_receipt(cmd, inst); - core = inst->core; - if (inst->session_type == MSM_VIDC_ENCODER) - vdev = &core->vdev[MSM_VIDC_ENCODER].vdev; - else - vdev = &core->vdev[MSM_VIDC_DECODER].vdev; - dqevent.type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - dqevent.u.data[0] = (uint8_t)MSM_VIDC_STOP_DONE; - v4l2_event_queue(vdev, &dqevent); } else { pr_err("Failed to get valid response for stop\n"); } @@ -320,19 +279,12 @@ static void handle_session_flush(enum command_response cmd, void *data) { struct msm_vidc_cb_cmd_done *response = data; struct msm_vidc_inst *inst; - struct video_device *vdev; struct v4l2_event dqevent; - struct msm_vidc_core *core; if (response) { inst = (struct msm_vidc_inst *)response->session_id; - core = inst->core; - if (inst->session_type == MSM_VIDC_ENCODER) - vdev = &core->vdev[MSM_VIDC_ENCODER].vdev; - else - vdev = &core->vdev[MSM_VIDC_DECODER].vdev; - dqevent.type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - dqevent.u.data[0] = (uint8_t)MSM_VIDC_DECODER_FLUSH_DONE; - v4l2_event_queue(vdev, &dqevent); + dqevent.type = V4L2_EVENT_MSM_VIDC_FLUSH_DONE; + dqevent.id = 0; + v4l2_event_queue_fh(&inst->event_handler, &dqevent); } else { pr_err("Failed to get valid response for flush\n"); } @@ -343,20 +295,13 @@ static void handle_session_close(enum command_response cmd, void *data) { struct msm_vidc_cb_cmd_done *response = data; struct msm_vidc_inst *inst; - struct video_device *vdev; struct v4l2_event dqevent; - struct msm_vidc_core *core; if (response) { inst = (struct msm_vidc_inst *)response->session_id; signal_session_msg_receipt(cmd, inst); - core = inst->core; - if (inst->session_type == MSM_VIDC_ENCODER) - vdev = &core->vdev[MSM_VIDC_ENCODER].vdev; - else - vdev = &core->vdev[MSM_VIDC_DECODER].vdev; - dqevent.type = V4L2_EVENT_PRIVATE_START + V4L2_EVENT_VIDC_BASE; - dqevent.u.data[0] = (uint8_t)MSM_VIDC_CLOSE_DONE; - v4l2_event_queue(vdev, &dqevent); + dqevent.type = V4L2_EVENT_MSM_VIDC_CLOSE_DONE; + dqevent.id = 0; + v4l2_event_queue_fh(&inst->event_handler, &dqevent); } else { pr_err("Failed to get valid response for session close\n"); } diff --git a/drivers/media/video/msm_vidc/msm_vidc_internal.h b/drivers/media/video/msm_vidc/msm_vidc_internal.h index fb1ab586751..fb8fbc4e332 100644 --- a/drivers/media/video/msm_vidc/msm_vidc_internal.h +++ b/drivers/media/video/msm_vidc/msm_vidc_internal.h @@ -75,11 +75,6 @@ enum instance_state { MSM_VIDC_CORE_UNINIT, }; -enum vidc_resposes_id { - MSM_VIDC_DECODER_FLUSH_DONE = 0x11, - MSM_VIDC_DECODER_EVENT_CHANGE, -}; - struct buf_info { struct list_head list; struct vb2_buffer *buf; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index f18fafd55de..63ebdeadec3 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -2295,11 +2295,11 @@ struct v4l2_streamparm { #define V4L2_EVENT_FRAME_SYNC 4 #define V4L2_EVENT_PRIVATE_START 0x08000000 -#define V4L2_EVENT_MSM_VIDC_START { V4L2_EVENT_PRIVATE_START + 0x00001000} -#define V4L2_EVENT_MSM_VIDC_FLUSH_DONE {V4L2_EVENT_PRIVATE_START + 1} +#define V4L2_EVENT_MSM_VIDC_START (V4L2_EVENT_PRIVATE_START + 0x00001000) +#define V4L2_EVENT_MSM_VIDC_FLUSH_DONE (V4L2_EVENT_PRIVATE_START + 1) #define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED \ - {V4L2_EVENT_PRIVATE_START + 2} -#define V4L2_EVENT_MSM_VIDC_CLOSE_DONE {V4L2_EVENT_PRIVATE_START + 3} + (V4L2_EVENT_PRIVATE_START + 2) +#define V4L2_EVENT_MSM_VIDC_CLOSE_DONE (V4L2_EVENT_PRIVATE_START + 3) /* Payload for V4L2_EVENT_VSYNC */ struct v4l2_event_vsync {