1. enable color description in vui when encoding.
2. improve the get/set color description api
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
If 'pm_runtime_get_sync()' fail, need to reset device power usage_count
to '0'. Otherwise, the usage_count always bigger than '0' and not do
'runtime_suspend()' actually.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
there may be some redundant data before the encoded frame,
generally it won't bring any problem.
but on android, the redundant data may affect the mux,
can cause the mp4 can't be decoded.
so delete the redundant data in the driver.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
1. the mu won't be really power off,
so we need restore the mu but not initialize it
2. the vpu is shared with vpu malone,
so we don't do vpu reset when remove module.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
delay the creation of video device node in order to avoid inmod failure
in probe function, if create video node in a early stage,
the video node may be created before initialize the vpu dev,
and in such case, open video node,
the mu mailbox may be not requested,
then it will led to download firmware fail.
so create the video device node at the end of the probe function.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
The default aspect ratio supplied by firmware may be not correct.
And V4L2 have some ctrl interface to set it.
V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE,
V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC,
V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH,
V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT
So driver can implement these controls and supply a proper default value
vpu_windsor driver 1.0.3
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Need to call mailbox's request/free channel according to runtime PM.
Ohterwise MUs power always 'on' during runtime suspend.
Remove requesting mu from probe, it will be requested through
pm_runtime_resume indirectly, so there is no need call it
directly.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
If close encoder after streamon immediately,
driver may try to stop instance before really start,
so stop cmd may be not sent,
but start cmd will be send when mem_request event is received.
It'll led to intance hang
driver version 1.0.2
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Upstream removed 32bit timespec to deal with y2038 issue.
Update MXC drivers to deal with the change.
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
msg hasn't process in time
firmware write event message to message buffer, and trigger an interrupt,
driver will read the message and store it into a fifo. and call queue_work.
If the work is scheduling but have exited the while loop,
it may cause the event won't be processed until another event received.
So in some case, the stream may hang
as the next event is depends on the driver process the current event.
vpu_windsor may have the same issue.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
currently, vpu encoder only support integer frame rate,
we need improve the firmware to support fractional frame rate
so extends the range of frame rate from integers to real numbers
Signed-off-by: Ming Qian <ming.qian@nxp.com>
export fw log via debugfs
the fw log can help us debug some firmware issue.
keep consistent with the decoder
Signed-off-by: Ming Qian <ming.qian@nxp.com>
the csr register 'CM0Px_CPUWAIT' will be cleared to '1' after
reset(poweroff then poweron), hence we could check is vpu poweroff
when suspend according to this value.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
Add a missing semicolon. This missing semicolon is not breaking the
build in defconfig since the next MODULE_DEVICE_TABLE() expand to an
empty string, so the next semicolon is used. When this macro expands
to a non-empty string, the build breaks. This was found by a
"make allmodconfig" build.
Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
If the writeable flag is not change synchronously,
the flag may not changed correct,
it'll case the encode stream hang.
It's likely to happen when small resolution stream do suspend.
Signed-off-by: ming_qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
- Enable mailbox for vpu encoder
The mailbox of mu1_m0 is used by imx8qxp
The mailbox of mu2_m0 are used by imx8qm
- Unify code between 4.19 and 5.x
Update code from 4.19
Separate sc and mu contents to vpu_encoder_mu.h/.c
Separate pm_domain contents to vpu_encoder_pm.h/.c
Add kfifo for better hold received mu message
Sync v4l2 change
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Fix build error for kernel 5.x:
- power domain adjustment
use dev_pm_domain_attach_by_name()/device_link_add
- remove sc fw api
comment fuse related function
- definition of vb2_qbuf() changed
set 'media_device' for vb2_qbuf()
- 'vidioc_g_crop'/'vidioc_s_crop' removed
comment function 'v4l2_ioctl_g_crop'
- remove legacy macro, such as 'VB2_BUF_STATE_PREPARED'
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘show_buffer_info’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:3951:23: error: ‘VB2_BUF_STATE_REQUEUEING’ undeclared (first use in this function)
" %d:requeueing,", VB2_BUF_STATE_REQUEUEING);
Due to this macro was removed by the following commit:
commit c6e4e2c403
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Thu Feb 28 07:35:46 2019 -0500
media: vb2: drop VB2_BUF_STATE_REQUEUEING
The last user of this state has been converted, so we can now drop
this. Requeueing causes the queue to become unordered, which causes
problems with requests and (in the future) fences.
Since it is no longer needed, just get rid of this.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘show_buffer_info’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:4001:21: error: ‘VB2_BUF_STATE_PREPARED’ undeclared (first use in this function)
" %d:prepared,", VB2_BUF_STATE_PREPARED);
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: At top level:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: error: unknown field ‘vidioc_g_crop’ specified in initializer
.vidioc_g_crop = vpu_enc_v4l2_ioctl_g_crop,
^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: warning: initialization from incompatible pointer type
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: warning: (near initialization for ‘vpu_enc_v4l2_ioctl_ops.vidioc_dqbuf’)
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1416:2: error: unknown field ‘vidioc_s_crop’ specified in initializer
.vidioc_s_crop = vpu_enc_v4l2_ioctl_s_crop,
^
Module owner can double check later if need implement the same function
in other callbackes.
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘vpu_enc_v4l2_ioctl_qbuf’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1048:8: warning: passing argument 2 of ‘vb2_qbuf’ from incompatible pointer type
ret = vb2_qbuf(&q_data->vb2_q, buf);
^
In file included from ../include/media/v4l2-mem2mem.h:20:0,
from ../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:47:
../include/media/videobuf2-v4l2.h:144:5: note: expected ‘struct media_device *’ but argument is of type ‘struct v4l2_buffer *’
int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1048:8: error: too few arguments to function ‘vb2_qbuf’
ret = vb2_qbuf(&q_data->vb2_q, buf);
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>