Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp161609rdb; Thu, 8 Feb 2024 02:06:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0cU24VVOtFd3qT3g05XPtEi2jmPkUaEoFZEaciv5M2QcBf3e9jezR6QUze2bGoae6Bir0J4Dp8fsgBBaAliL0ULUySWz4gKIO7u2sYQ== X-Google-Smtp-Source: AGHT+IFPjSLs/uLoysoq22+ZmYxwUKe37Cpc2mqAhgk4NMf8nZavf9MMFw7xQyee73oLLvtm5+/a X-Received: by 2002:a05:620a:146b:b0:783:bd6c:90cd with SMTP id j11-20020a05620a146b00b00783bd6c90cdmr8356855qkl.19.1707386817521; Thu, 08 Feb 2024 02:06:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707386817; cv=pass; d=google.com; s=arc-20160816; b=P71/Nta92xUVSa+s+eTvRf8W7eW3pbXmgrE0z5oAhTQcFAfhxDMfRrB8l6ebw8iYBS WthDuMVU4pxYSN+8bHlV1eQOy9EY5gKc/t4YBla+EZl/EWoXPK+mGwvFwKVxRm+YZMd9 0IitYQ75YTDlg6D/yZ5W3q4VEa6BmbAMTZpRYIvLjtXoCcEZw6+9UIFlXDwfx/SYlNH7 bzUTbGfRkBCBcKHbrDN7NR9qr1bQ4Qm5qvwY5lBjAH8fQqUqeAUmyBOBX3IJBV0PNdLT ngZ1BlJ58c61XQ9a1NugSDDewMAGFheY+degucpyzyHDa/R9q96kozNH8/rwCIcwc8RM nHXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pJ+WCAYhi9tBkzcVk/+8z5bjTz7wKkWEQis4j+RWrws=; fh=EIY3TeCfWv2q/dyslhd111K8un0bJ0QueYEN5kE7PHI=; b=Mu1IQjzOp9GEeEoRYUktnALfgQVshndHykbGXjBbpgCH6eSGUIrZ7WyPLh+NqhhqK6 H5+KWnxv4p4O+21atz5hoJudxkrYqeYW7nkzZo+xKSpJugfjAr22/bAvxWCixA/vHjLo RkTVjIf1bJ85HdI8svzZDYMifRBZFkunF22h1UgG3ESEKaTQm2eWSzlh2xDTjd0EGvdp 7lv6RKPCNmzF2U6TLBFGzeGSnwztxmaZF5WInfjsw+Y6fDqoLW6LA/WtXkiKFMRHcEJX SoVtFSMjzm0eNpkqtA/91cgAXNwg+717cCQBlzR6ylZ/2Ona6J99dXqekmYh2CyTjN4A eI1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bLzj8ooH; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-57815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=2; AJvYcCXl6jjs6uKfwjgyAPdgr+cGR7n3wARgE7i4cssZDcLnwDpnFsI5dJEZA6rhtz/i/tNH8Wri03hIXPrfRBRjr5u54VQX8U0l3j6tAAEBHg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e27-20020a05620a209b00b007858d5d9ef9si2899525qka.55.2024.02.08.02.06.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 02:06:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bLzj8ooH; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-57815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3B45C1C27E46 for ; Thu, 8 Feb 2024 10:06:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2032D6EB41; Thu, 8 Feb 2024 10:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="bLzj8ooH" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 787766D1BD; Thu, 8 Feb 2024 10:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707386520; cv=none; b=rmOY4CUTBPrf0guTAwT9gsUVu3ahRHHDRTCDm0PO7F5eu/o2fWXCGPjo6RspAifWWvV0+xDSuJWExHrdmxuh2t4N+8iaDdfttE3MXkr34UHbDNEGFHyEWJDgSceqU/UtGSEmvfz2fYoba/ua1ojXgaGpXvLNudmUDn951A1vDDI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707386520; c=relaxed/simple; bh=ZjTYuZI27yktivY2o1E00i2URHt1xHbHgN6Q3LlWvUI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TL/25RjoxGqw+ITI2aZkPKLUCUUj8RceMUZPEAZgo71z7P/q0yGVACsnVrSUP8rHFr3W9uBKqa3qpCLvor2quPTv2QH+raT3pCEeVXMpS24nrBd8tz3dzdsJOlJ1t6/RgH88fe08p/fAsf4RT+4PmkNOkCGVHuaCS0785fX0eac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=bLzj8ooH; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707386511; bh=ZjTYuZI27yktivY2o1E00i2URHt1xHbHgN6Q3LlWvUI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bLzj8ooHWv6M8Wo0jLN4HnS6vZrxTMuvLVSOVdDYjWuM/wDAXm6ZxcIOgdeKCBU9x V8l6sJ37DgW/wfiecteAzhN5YxFX+vLozXOJHzrnzU0UpIjOG1e4TqABaeKFuQ4rL/ mqsUkesAckB5rqalYvcYW8UbiOMEXZWPcvGPLRjbHDsltlUJjOHBFzTCEDKsD30P4r cXKXCDFen+ZEC4+fAQA4yKA+W8WuVhMU4NXls4O5Lyr7+LjKpNOoDQlVsdhdi2BX5g hvG3iDAEVqohLtG/+0ioroGo1Az8wddNkqxIhgSGXu4qtyCRo3NQHu+HqiqidU3LD6 q8VMBfDldMvrQ== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sebastianfricke) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 9EDA237811CF; Thu, 8 Feb 2024 10:01:50 +0000 (UTC) Date: Thu, 8 Feb 2024 11:01:49 +0100 From: Sebastian Fricke To: Nicolas Dufresne Cc: "jackson.lee" , mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com Subject: Re: [RESEND PATCH v0 2/5] wave5: Support to prepend sps/pps to IDR frame. Message-ID: <20240208100149.pet6em5tnunv2ome@basti-XPS-13-9310> References: <20240131013046.15687-1-jackson.lee@chipsnmedia.com> <20240131013046.15687-3-jackson.lee@chipsnmedia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hey Jackson, as with the previous review, the title needs to be adjusted 'wave5:' is not enough. Also 'Support to prepend sps/pps to IDR' sounds a bit weird and doesn't quite match what you describe below. How about: 'Support SPS/PPS generation for each IDR' On 07.02.2024 13:00, Nicolas Dufresne wrote: >Hi Jackson, > >Le mercredi 31 janvier 2024 à 10:30 +0900, jackson.lee a écrit : >> Indicates whether to generate SPS and PPS at every IDR. Setting it to 0 disables generating SPS and PPS at every IDR. >> Setting it to one enables generating SPS and PPS at every IDR. My suggestion: Provide a control to toggle (0 = off / 1 = on), whether the SPS and PPS are generated for every IDR. Greetings, Sebastian >> >> Signed-off-by: Jackson Lee >> Signed-off-by: Nas Chung >> --- >> drivers/media/platform/chips-media/wave5/wave5-hw.c | 6 ++++-- >> drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 7 +++++++ >> drivers/media/platform/chips-media/wave5/wave5-vpuapi.h | 1 + >> 3 files changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c >> index f1e022fb148e..8ad7f3a28ae1 100644 >> --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c >> +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c >> @@ -1602,11 +1602,13 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst) >> if (inst->std == W_AVC_ENC) >> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_INTRA_PARAM, p_param->intra_qp | >> ((p_param->intra_period & 0x7ff) << 6) | >> - ((p_param->avc_idr_period & 0x7ff) << 17)); >> + ((p_param->avc_idr_period & 0x7ff) << 17) | >> + (p_param->forced_idr_header_enable << 28)); > >I can spot evident hard-coding of mask and bit shifts in here. In order to >continuously improve this driver code, I would like to see this (and the >following) magic number being defined with well named macros as a preparation >patch to this feature change. > >regards, >Nicolas > >> else if (inst->std == W_HEVC_ENC) >> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_INTRA_PARAM, >> p_param->decoding_refresh_type | (p_param->intra_qp << 3) | >> - (p_param->intra_period << 16)); >> + (p_param->forced_idr_header_enable << 9) | >> + (p_param->intra_period << 16)); >> >> reg_val = (p_param->rdo_skip << 2) | >> (p_param->lambda_scaling_enable << 3) | >> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c >> index 0cb5bfb67258..761775216cd4 100644 >> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c >> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c >> @@ -1125,6 +1125,9 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl) >> case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: >> inst->enc_param.entropy_coding_mode = ctrl->val; >> break; >> + case V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR: >> + inst->enc_param.forced_idr_header_enable = ctrl->val; >> + break; >> case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: >> break; >> default: >> @@ -1292,6 +1295,7 @@ static void wave5_set_enc_openparam(struct enc_open_param *open_param, >> else >> open_param->wave_param.intra_refresh_arg = num_ctu_row; >> } >> + open_param->wave_param.forced_idr_header_enable = input.forced_idr_header_enable; >> } >> >> static int initialize_sequence(struct vpu_instance *inst) >> @@ -1775,6 +1779,9 @@ static int wave5_vpu_open_enc(struct file *filp) >> 0, 1, 1, 0); >> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops, >> V4L2_CID_MIN_BUFFERS_FOR_OUTPUT, 1, 32, 1, 1); >> + v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops, >> + V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR, >> + 0, 1, 1, 0); >> >> if (v4l2_ctrl_hdl->error) { >> ret = -ENODEV; >> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h >> index 352f6e904e50..3ad6118550ac 100644 >> --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h >> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h >> @@ -566,6 +566,7 @@ struct enc_wave_param { >> u32 lambda_scaling_enable: 1; /* enable lambda scaling using custom GOP */ >> u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8 transform */ >> u32 mb_level_rc_enable: 1; /* enable MB-level rate control */ >> + u32 forced_idr_header_enable: 1; /* enable header encoding before IDR frame */ >> }; >> >> struct enc_open_param { > >