diff options
author | Paras Nagda <pnagda@codeaurora.org> | 2018-09-21 12:34:33 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-09-28 23:18:35 -0700 |
commit | b35dd997b16a33d675c75582af5ceed43420f22b (patch) | |
tree | 863235fa4cd8c6d0607d9244f2bfb44cbe45b3f6 /drivers | |
parent | 070bf44aba13d672db9295f2ef2e98204c8e70ff (diff) |
msm: vidc: copy the crop info during dequeue buf
User-space expects the crop data to be notified from the
driver as it was done in kernel 3.16 as part-of
reserved field of v4l2planes.
On 4.4 kernel, as the v4l2planes are removed this
change is required for indicating the crop info
to user client.
Change-Id: I065e514cdd45bfe17206e0e18416a2313bc6a344
Signed-off-by: Paras Nagda <pnagda@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc.c | 9 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_common.c | 21 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_internal.h | 9 |
3 files changed, 39 insertions, 0 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c index c288568edfbd..81ce5813cec4 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_vidc.c @@ -1091,6 +1091,15 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b) b->m.planes[i].m.userptr = buffer_info->uvaddr[i]; b->m.planes[i].reserved[0] = buffer_info->fd[i]; b->m.planes[i].reserved[1] = buffer_info->buff_off[i]; + + b->m.planes[i].reserved[2] = buffer_info->crop_data.nLeft; + b->m.planes[i].reserved[3] = buffer_info->crop_data.nTop; + b->m.planes[i].reserved[4] = buffer_info->crop_data.nWidth; + b->m.planes[i].reserved[5] = buffer_info->crop_data.nHeight; + b->m.planes[i].reserved[6] = + buffer_info->crop_data.width_height[0]; + b->m.planes[i].reserved[7] = + buffer_info->crop_data.width_height[1]; if (!(inst->flags & VIDC_SECURE) && !b->m.planes[i].m.userptr) { dprintk(VIDC_ERR, "%s: Failed to find user virtual address, %#lx, %d, %d\n", diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index ee3cfb88855c..610ed9c6fed9 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -2061,6 +2061,7 @@ static void handle_fbd(enum hal_command_response cmd, void *data) int extra_idx = 0; int64_t time_usec = 0; struct vb2_v4l2_buffer *vbuf = NULL; + struct buffer_info *buffer_info = NULL; if (!response) { dprintk(VIDC_ERR, "Invalid response from vidc_hal\n"); @@ -2102,6 +2103,26 @@ static void handle_fbd(enum hal_command_response cmd, void *data) "fbd:Overflow bytesused = %d; length = %d\n", vb->planes[0].bytesused, vb->planes[0].length); + + buffer_info = device_to_uvaddr(&inst->registeredbufs, + fill_buf_done->packet_buffer1); + + if (!buffer_info) { + dprintk(VIDC_ERR, + "%s buffer not found in registered list\n", + __func__); + return; + } + + buffer_info->crop_data.nLeft = fill_buf_done->start_x_coord; + buffer_info->crop_data.nTop = fill_buf_done->start_y_coord; + buffer_info->crop_data.nWidth = fill_buf_done->frame_width; + buffer_info->crop_data.nHeight = fill_buf_done->frame_height; + buffer_info->crop_data.width_height[0] = + inst->prop.width[CAPTURE_PORT]; + buffer_info->crop_data.width_height[1] = + inst->prop.height[CAPTURE_PORT]; + if (!(fill_buf_done->flags1 & HAL_BUFFERFLAG_TIMESTAMPINVALID)) { time_usec = fill_buf_done->timestamp_hi; diff --git a/drivers/media/platform/msm/vidc/msm_vidc_internal.h b/drivers/media/platform/msm/vidc/msm_vidc_internal.h index 2a4033598bd2..08dad912bd57 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_internal.h +++ b/drivers/media/platform/msm/vidc/msm_vidc_internal.h @@ -329,6 +329,14 @@ int msm_vidc_check_session_supported(struct msm_vidc_inst *inst); int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst); void msm_vidc_queue_v4l2_event(struct msm_vidc_inst *inst, int event_type); +struct crop_info { + u32 nLeft; + u32 nTop; + u32 nWidth; + u32 nHeight; + u32 width_height[MAX_PORT_NUM]; +}; + struct buffer_info { struct list_head list; int type; @@ -348,6 +356,7 @@ struct buffer_info { bool mapped[VIDEO_MAX_PLANES]; int same_fd_ref[VIDEO_MAX_PLANES]; struct timeval timestamp; + struct crop_info crop_data; }; struct buffer_info *device_to_uvaddr(struct msm_vidc_list *buf_list, |