[1/3] media: venus: adapt headers only flag for V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE

Message ID 20230103071551.17775-1-ming.qian@nxp.com (mailing list archive)
State New
Delegated to: Hans Verkuil
Headers
Series [1/3] media: venus: adapt headers only flag for V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE |

Commit Message

Ming Qian Jan. 3, 2023, 7:15 a.m. UTC
  when V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE is chosen,
the first buffer only contains stream header,
so apply the flag V4L2_BUF_FLAG_HEADERS_ONLY

Signed-off-by: Ming Qian <ming.qian@nxp.com>
---
 drivers/media/platform/qcom/venus/venc.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

kernel test robot Jan. 3, 2023, 9:04 a.m. UTC | #1
Hi Ming,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on linus/master v6.2-rc2 next-20221226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ming-Qian/media-s5p-mfc-adapt-headers-only-flag-for-V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE/20230103-151825
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20230103071551.17775-1-ming.qian%40nxp.com
patch subject: [PATCH 1/3] media: venus: adapt headers only flag for V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE
config: m68k-allmodconfig
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/70cdada277a04c9de92e7d09ebe0e6d0d6499da4
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ming-Qian/media-s5p-mfc-adapt-headers-only-flag-for-V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE/20230103-151825
        git checkout 70cdada277a04c9de92e7d09ebe0e6d0d6499da4
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/media/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/platform/qcom/venus/venc.c: In function 'venc_buf_done':
>> drivers/media/platform/qcom/venus/venc.c:1265:40: error: 'V4L2_BUF_FLAG_HEADERS_ONLY' undeclared (first use in this function); did you mean 'V4L2_CTRL_FLAG_READ_ONLY'?
    1265 |                         vbuf->flags |= V4L2_BUF_FLAG_HEADERS_ONLY;
         |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                        V4L2_CTRL_FLAG_READ_ONLY
   drivers/media/platform/qcom/venus/venc.c:1265:40: note: each undeclared identifier is reported only once for each function it appears in


vim +1265 drivers/media/platform/qcom/venus/venc.c

  1235	
  1236	static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type,
  1237				  u32 tag, u32 bytesused, u32 data_offset, u32 flags,
  1238				  u32 hfi_flags, u64 timestamp_us)
  1239	{
  1240		struct vb2_v4l2_buffer *vbuf;
  1241		struct vb2_buffer *vb;
  1242		unsigned int type;
  1243	
  1244		venc_pm_touch(inst);
  1245	
  1246		if (buf_type == HFI_BUFFER_INPUT)
  1247			type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
  1248		else
  1249			type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
  1250	
  1251		vbuf = venus_helper_find_buf(inst, type, tag);
  1252		if (!vbuf)
  1253			return;
  1254	
  1255		vbuf->flags = flags;
  1256	
  1257		if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
  1258			vb = &vbuf->vb2_buf;
  1259			vb2_set_plane_payload(vb, 0, bytesused + data_offset);
  1260			vb->planes[0].data_offset = data_offset;
  1261			vb->timestamp = timestamp_us * NSEC_PER_USEC;
  1262			vbuf->sequence = inst->sequence_cap++;
  1263			if (inst->controls.enc.header_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE &&
  1264			    !vbuf->sequence)
> 1265				vbuf->flags |= V4L2_BUF_FLAG_HEADERS_ONLY;
  1266		} else {
  1267			vbuf->sequence = inst->sequence_out++;
  1268		}
  1269	
  1270		v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE);
  1271	}
  1272
  

Patch

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index cdb12546c4fa..33c8e4329f6e 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1260,6 +1260,9 @@  static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type,
 		vb->planes[0].data_offset = data_offset;
 		vb->timestamp = timestamp_us * NSEC_PER_USEC;
 		vbuf->sequence = inst->sequence_cap++;
+		if (inst->controls.enc.header_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE &&
+		    !vbuf->sequence)
+			vbuf->flags |= V4L2_BUF_FLAG_HEADERS_ONLY;
 	} else {
 		vbuf->sequence = inst->sequence_out++;
 	}