From nobody Sat Nov 30 16:41:50 2024 Received: from smtp.forwardemail.net (smtp.forwardemail.net [207.246.76.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D084318A6B4 for ; Mon, 9 Sep 2024 19:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.246.76.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725909971; cv=none; b=t9A8Z7/OCHcX5LgXxM/BpvQMNxIhMi15vMlzOpnllFB4sgM2RlxFixJPrUEt8ICKc0wfN73oDtyVrJaab6OLw1p+dagzxQOqnxTwnUBHSnK3PzXHqlbLJAaU+3VdpRdEuVu6qfeKBhB6DzyM+LvYLestDpiSdCgM1zMGKOWL8yQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725909971; c=relaxed/simple; bh=VRH83o1EN2Ura5nGOZ+F41ijG13nE1cH6eD6m5TPrU8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U6sHUB89PfNu8YZpW9vZm1sB3sTkr40whCibnZ4rZdXu4yTW5NbS+N0t+HLE9nIs0ZpwNeXPMVS8bme+Om0kZRftoTMstv4FUcihig175qNC6clXICtPYxwdhRaNQa7belOEWoYX22Q1K+JsrPE48te3Gx8AgzcopcUSEZGdBNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=P5LxYKiV; arc=none smtp.client-ip=207.246.76.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="P5LxYKiV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1725909960; bh=qbxNtibCOaqBtiRn2qVQHAO7oSytVkUzlG+GE75u3Sg=; b=P5LxYKiVG3MCQLTiS7RLukpqmjDhKDa9mBdzsMWOMo0J7yzH05dpQQqql7EBUJM1A/GBceYMp KVuR/KpZFS6N5AYcidrNbetYbQkNuNXHCEUz8eYn9RxzS9miJ0y/oPx//ZvrMTu+gh3cl3eW/kT UJI+1GBjkvXzYyD8rmx+J0m7/2rdfQO9MrZNFcEJarjaflEYqO2N+U+31N2NG/yvL1S1jpNZnpK L1peZCriZ/B+4tZv63BBwkOWDdNyOLwboQ4b2O4co4xX+v8jBjnPKFkW50d8B8jkL0Aockj5yi6 l1sRmHriSjU1PK2N5nFJTdQO4g4sV2ZpSVWY8uZbkyNQ== From: Jonas Karlman To: Sebastian Fricke , Ezequiel Garcia , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: Alex Bee , Nicolas Dufresne , Benjamin Gaignard , Detlev Casanova , Dan Carpenter , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Jonas Karlman , Christopher Obbard Subject: [PATCH v6 05/11] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt into helper Date: Mon, 9 Sep 2024 19:25:03 +0000 Message-ID: <20240909192522.1076704-6-jonas@kwiboo.se> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909192522.1076704-1-jonas@kwiboo.se> References: <20240909192522.1076704-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 207.246.76.47 X-ForwardEmail-ID: 66df4bc7c680cb8b7d2dc1d4 Content-Type: text/plain; charset="utf-8" Extract call to v4l2_fill_pixfmt_mp() and ajusting of sizeimage into a helper. Replace current code with a call to the new helper. Signed-off-by: Jonas Karlman Reviewed-by: Nicolas Dufresne Tested-by: Nicolas Dufresne Tested-by: Christopher Obbard --- v6: - No change v5: - Collect r-b and t-b tags v4: - Do not reset pix_mp->field in rkvdec_fill_decoded_pixfmt() v3: - No change --- drivers/staging/media/rkvdec/rkvdec.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/= rkvdec/rkvdec.c index ac398b5a9736..d1087519d218 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -27,6 +27,16 @@ #include "rkvdec.h" #include "rkvdec-regs.h" =20 +static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, + struct v4l2_pix_format_mplane *pix_mp) +{ + v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, + pix_mp->width, pix_mp->height); + pix_mp->plane_fmt[0].sizeimage +=3D 128 * + DIV_ROUND_UP(pix_mp->width, 16) * + DIV_ROUND_UP(pix_mp->height, 16); +} + static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) { struct rkvdec_ctx *ctx =3D container_of(ctrl->handler, struct rkvdec_ctx,= ctrl_hdl); @@ -192,13 +202,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx= *ctx) =20 rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); f->type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - v4l2_fill_pixfmt_mp(&f->fmt.pix_mp, - ctx->coded_fmt_desc->decoded_fmts[0], - ctx->coded_fmt.fmt.pix_mp.width, - ctx->coded_fmt.fmt.pix_mp.height); - f->fmt.pix_mp.plane_fmt[0].sizeimage +=3D 128 * - DIV_ROUND_UP(f->fmt.pix_mp.width, 16) * - DIV_ROUND_UP(f->fmt.pix_mp.height, 16); + f->fmt.pix_mp.width =3D ctx->coded_fmt.fmt.pix_mp.width; + f->fmt.pix_mp.height =3D ctx->coded_fmt.fmt.pix_mp.height; + rkvdec_fill_decoded_pixfmt(ctx, &f->fmt.pix_mp); } =20 static int rkvdec_enum_framesizes(struct file *file, void *priv, @@ -264,12 +270,7 @@ static int rkvdec_try_capture_fmt(struct file *file, v= oid *priv, &pix_mp->height, &coded_desc->frmsize); =20 - v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, - pix_mp->width, pix_mp->height); - pix_mp->plane_fmt[0].sizeimage +=3D - 128 * - DIV_ROUND_UP(pix_mp->width, 16) * - DIV_ROUND_UP(pix_mp->height, 16); + rkvdec_fill_decoded_pixfmt(ctx, pix_mp); pix_mp->field =3D V4L2_FIELD_NONE; =20 return 0; --=20 2.46.0