From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B97D8C32771 for ; Mon, 6 Jan 2020 07:52:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 948A721734 for ; Mon, 6 Jan 2020 07:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725908AbgAFHwl (ORCPT ); Mon, 6 Jan 2020 02:52:41 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58938 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgAFHwk (ORCPT ); Mon, 6 Jan 2020 02:52:40 -0500 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 657BB283C0A; Mon, 6 Jan 2020 07:52:38 +0000 (GMT) Date: Mon, 6 Jan 2020 08:52:35 +0100 From: Boris Brezillon To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Sakari Ailus , linux-media@vger.kernel.org Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Tomasz Figa , Nicolas Dufresne , kernel@collabora.com, Paul Kocialkowski , Ezequiel Garcia , Jonas Karlman , linux-rockchip@lists.infradead.org, Heiko Stuebner Subject: Re: [PATCH v3 6/7] media: rkvdec: Add the rkvdec driver Message-ID: <20200106085235.0e639ecb@collabora.com> In-Reply-To: <20191213125414.90725-7-boris.brezillon@collabora.com> References: <20191213125414.90725-1-boris.brezillon@collabora.com> <20191213125414.90725-7-boris.brezillon@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Fri, 13 Dec 2019 13:54:13 +0100 Boris Brezillon wrote: > +static int rkvdec_try_capture_fmt(struct file *file, void *priv, > + struct v4l2_format *f) > +{ > + struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); > + const struct rkvdec_coded_fmt_desc *coded_desc; > + u32 fourcc, width, height; > + unsigned int i; > + > + /* > + * The codec context should point to a coded format desc, if the format > + * on the coded end has not been set yet, it should point to the > + * default value. > + */ > + coded_desc = ctx->coded_fmt_desc; > + if (WARN_ON(!coded_desc)) > + return -EINVAL; > + > + fourcc = f->fmt.pix_mp.pixelformat; > + for (i = 0; i < coded_desc->num_decoded_fmts; i++) { > + if (coded_desc->decoded_fmts[i] == fourcc) > + break; > + } > + > + if (i == coded_desc->num_decoded_fmts) > + return -EINVAL; > + > + /* Save the original width/height before aligning them. */ > + width = f->fmt.pix_mp.width; > + height = f->fmt.pix_mp.height; > + > + /* Always apply the frmsize constraint of the coded end. */ > + v4l2_apply_frmsize_constraints(&f->fmt.pix_mp.width, > + &f->fmt.pix_mp.height, > + &coded_desc->frmsize); > + > + v4l2_fill_pixfmt_mp(&f->fmt.pix_mp, fourcc, f->fmt.pix_mp.width, > + f->fmt.pix_mp.height); > + > + /* > + * Now that we have computed sizeimage and bytesperline we can restore > + * the original width/height (before macro block alignment). > + */ > + f->fmt.pix_mp.width = width; > + f->fmt.pix_mp.height = height; Looks like restoring the original width/height was a bad idea (it breaks the odd_size tests of the VP9 testsuite [1]). I'll adjust the test in validate_dec_params() [2] to align the ctrl width/height params on a superblock size (64 pixels) instead. > + > + f->fmt.pix_mp.field = V4L2_FIELD_NONE; > + > + return 0; > +} [1]https://storage.googleapis.com/downloads.webmproject.org/vp9/decoder-test-streams/Profile_0_8bit.zip [2]https://patchwork.kernel.org/patch/11290603/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Brezillon Subject: Re: [PATCH v3 6/7] media: rkvdec: Add the rkvdec driver Date: Mon, 6 Jan 2020 08:52:35 +0100 Message-ID: <20200106085235.0e639ecb@collabora.com> References: <20191213125414.90725-1-boris.brezillon@collabora.com> <20191213125414.90725-7-boris.brezillon@collabora.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20191213125414.90725-7-boris.brezillon-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+glpar-linux-rockchip=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Sakari Ailus , linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Mark Rutland , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Tomasz Figa , Heiko Stuebner , Jonas Karlman , Nicolas Dufresne , Paul Kocialkowski , linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Rob Herring , kernel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org, Ezequiel Garcia List-Id: linux-rockchip.vger.kernel.org On Fri, 13 Dec 2019 13:54:13 +0100 Boris Brezillon wrote: > +static int rkvdec_try_capture_fmt(struct file *file, void *priv, > + struct v4l2_format *f) > +{ > + struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); > + const struct rkvdec_coded_fmt_desc *coded_desc; > + u32 fourcc, width, height; > + unsigned int i; > + > + /* > + * The codec context should point to a coded format desc, if the format > + * on the coded end has not been set yet, it should point to the > + * default value. > + */ > + coded_desc = ctx->coded_fmt_desc; > + if (WARN_ON(!coded_desc)) > + return -EINVAL; > + > + fourcc = f->fmt.pix_mp.pixelformat; > + for (i = 0; i < coded_desc->num_decoded_fmts; i++) { > + if (coded_desc->decoded_fmts[i] == fourcc) > + break; > + } > + > + if (i == coded_desc->num_decoded_fmts) > + return -EINVAL; > + > + /* Save the original width/height before aligning them. */ > + width = f->fmt.pix_mp.width; > + height = f->fmt.pix_mp.height; > + > + /* Always apply the frmsize constraint of the coded end. */ > + v4l2_apply_frmsize_constraints(&f->fmt.pix_mp.width, > + &f->fmt.pix_mp.height, > + &coded_desc->frmsize); > + > + v4l2_fill_pixfmt_mp(&f->fmt.pix_mp, fourcc, f->fmt.pix_mp.width, > + f->fmt.pix_mp.height); > + > + /* > + * Now that we have computed sizeimage and bytesperline we can restore > + * the original width/height (before macro block alignment). > + */ > + f->fmt.pix_mp.width = width; > + f->fmt.pix_mp.height = height; Looks like restoring the original width/height was a bad idea (it breaks the odd_size tests of the VP9 testsuite [1]). I'll adjust the test in validate_dec_params() [2] to align the ctrl width/height params on a superblock size (64 pixels) instead. > + > + f->fmt.pix_mp.field = V4L2_FIELD_NONE; > + > + return 0; > +} [1]https://storage.googleapis.com/downloads.webmproject.org/vp9/decoder-test-streams/Profile_0_8bit.zip [2]https://patchwork.kernel.org/patch/11290603/