Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2348952rdh; Sun, 29 Oct 2023 11:47:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLwnaGsVO4V35RZzfIrfozqUnFmcXpicQmrltimohOsGJiQWMwX45Ttjo0VXC9iTjfbcBK X-Received: by 2002:a05:6a20:6a11:b0:17e:466:ea62 with SMTP id p17-20020a056a206a1100b0017e0466ea62mr7515566pzk.42.1698605251483; Sun, 29 Oct 2023 11:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698605251; cv=none; d=google.com; s=arc-20160816; b=RunsUoupSvZnwe7Pzc6DaION8CvQCdVbD8sbk89HnTA3vgxK8MI8IuTdiAPvSpVBXL XahOh1TM1V96bcRhYAiijeDn2Nl3iD74lJMuxDuYjndiPChPtfBOcWzcNoDSfdHl3A0s oRImtmGxPDvrvfHZSkkLGceD0I75ZpHmTJMwkN6ynWSSXPNLv8ih8xEZAxJzUGs97mcm 03+USqzkCWWYP99C4eBytJhYoBZDhHxJdTJqZxTIfE0IBzbuYmwd7R3tX//rO160IGN7 AwwZ8hCSy/8t7Z/Y8sKpf8YglFMJbyJ/Qer7yVCFQxtXe3tEoBEtqxsAiVtPPtbgE6wF v1RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oUZXSd3mNA7U3mwNKfQV7xxJvG8Airy7VIo0pNLNDPc=; fh=mpVSHlz6QLTMQJyYfdyLOAes1Kk5kund3qIBSdmv/MI=; b=oOHumqkEByYfFcy6Sx+tpIJ4NyvWjUspIXlB/cbS9jTn0RW48jkHs2SjFuZtyYvekJ X6aFgmjTdXxNSBhjApdV05GIhcfkzWzyrmzYbcqum8hBjbFKd3Bzyd/Spqs2EXQtsfzm MULEKvKrZTY56yciYrXQ4wjQd0HI+9VBZ49I3GHQcIoBW2g4Pp8aHJAtazIMuYwCbBgq 86B1w2x9RPNsbUDgBzFYvzw0wzZ58R/BM8ySTJX8izGIuuE++q90DoXLM4CV7wEjCzYl jKoGvp458ku6G9GMCDwNTanJp0ihAl+uj9HJ/faRtdOG/ZJIFCSJgwK9Bi0TmvQD3XZC qUBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=fuUVW5cK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k7-20020a170902c40700b001cc5152e657si122168plk.248.2023.10.29.11.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 11:47:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=fuUVW5cK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1B3708087DE3; Sun, 29 Oct 2023 11:47:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjJ2Spw (ORCPT + 99 others); Sun, 29 Oct 2023 14:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjJ2Spv (ORCPT ); Sun, 29 Oct 2023 14:45:51 -0400 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4AC2DE; Sun, 29 Oct 2023 11:45:47 -0700 (PDT) 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=1698605142; bh=oUZXSd3mNA7U3mwNKfQV7xxJvG8Airy7VIo0pNLNDPc=; b=fuUVW5cK5GotmdX8DyumXKY8DO+T1SUFDEte4Ut3qf/5M8tV1jwVP1yR3Sm5hcV2a8NHtSLtK QgOn7Qx+gBTOmIF7QUIZkVwqWOmEhld+8LiJNHznLA3MDK3+vkJYEkeV01tfcabXsD1580gIlso pyrTy1TtcP/urodqPnZdol4LDplVvIadk2NqOQimWT/sZQhGNlUxw/NsUowEb0wfX6k+Otd1072 bvb43aiK8GSiZaZ7kbtE78HGKf7fTq6eagSaWNws0WZTNl+iXs8zCNqq/EQINZZZ6WQk/iqeEy6 CDIY2KGrvoR7022cpb5F3AFM5KYxd4vQFDT+PVu+DK3g== From: Jonas Karlman To: Ezequiel Garcia , Mauro Carvalho Chehab , "Greg Kroah-Hartman" Cc: Alex Bee , Nicolas Dufresne , Benjamin Gaignard , Sebastian Fricke , Christopher Obbard , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Jonas Karlman Subject: [PATCH v3 06/10] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt helper method Date: Sun, 29 Oct 2023 18:34:13 +0000 Message-ID: <20231029183427.1781554-7-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029183427.1781554-1-jonas@kwiboo.se> References: <20231029183427.1781554-1-jonas@kwiboo.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, 149.28.215.223 X-ForwardEmail-ID: 653ea5d08fe0ffca230b0f56 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 29 Oct 2023 11:47:03 -0700 (PDT) This extract setting decoded pixfmt into a helper method, current code is replaced with a call to the new helper method. Signed-off-by: Jonas Karlman --- v3: - No changes drivers/staging/media/rkvdec/rkvdec.c | 29 ++++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c index 84a41792cb4b..8d8ab529537c 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -27,6 +27,17 @@ #include "rkvdec.h" #include "rkvdec-regs.h" +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 += 128 * + DIV_ROUND_UP(pix_mp->width, 16) * + DIV_ROUND_UP(pix_mp->height, 16); + pix_mp->field = V4L2_FIELD_NONE; +} + static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) { struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); @@ -192,13 +203,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); f->type = 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 += 128 * - DIV_ROUND_UP(f->fmt.pix_mp.width, 16) * - DIV_ROUND_UP(f->fmt.pix_mp.height, 16); + f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width; + f->fmt.pix_mp.height = ctx->coded_fmt.fmt.pix_mp.height; + rkvdec_fill_decoded_pixfmt(ctx, &f->fmt.pix_mp); } static int rkvdec_enum_framesizes(struct file *file, void *priv, @@ -264,13 +271,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, &pix_mp->height, &coded_desc->frmsize); - v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, - pix_mp->width, pix_mp->height); - pix_mp->plane_fmt[0].sizeimage += - 128 * - DIV_ROUND_UP(pix_mp->width, 16) * - DIV_ROUND_UP(pix_mp->height, 16); - pix_mp->field = V4L2_FIELD_NONE; + rkvdec_fill_decoded_pixfmt(ctx, pix_mp); return 0; } -- 2.42.0