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>
This commit is contained in:
parent
070bf44aba
commit
b35dd997b1
3 changed files with 39 additions and 0 deletions
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue