From nobody Mon Sep 29 21:09:37 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 993CCC3276A for ; Tue, 16 Aug 2022 00:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356343AbiHPACS (ORCPT ); Mon, 15 Aug 2022 20:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356445AbiHOXy3 (ORCPT ); Mon, 15 Aug 2022 19:54:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 047761607A1; Mon, 15 Aug 2022 13:19:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C998A60F86; Mon, 15 Aug 2022 20:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9F1C433C1; Mon, 15 Aug 2022 20:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594749; bh=4Da9VfCATmK0UuUvULHDYgqa7YJ9Qcv9Lzqi2nk+pWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKdpkdMBnkt45nY4JX6u3YwZKS31CRgCVXaHybVz+SOdD5kQ/uXncUS/OvjwMUONZ TVfFHFvu2kRLhwtRlpKBXlX61JvZfuaza3B4I0Ysq4KWctNgxfppgDCbsIPGOKvQ8X 9uu2uN2vTs0861z2huUXWsG2d9z4jaTCFB8DJv/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 0545/1157] hantro: Remove incorrect HEVC SPS validation Date: Mon, 15 Aug 2022 19:58:21 +0200 Message-Id: <20220815180501.466187835@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ezequiel Garcia [ Upstream commit df9ec2fc8e70e01532fd9161cd98711969561ff6 ] Currently, the driver tries to validat the HEVC SPS against the CAPTURE queue format (i.e. the decoded format). This is not correct, because typically the SPS control is set before the CAPTURE queue is negotiated. Fixes: 135ad96cb4d6b ("media: hantro: Be more accurate on pixel formats ste= p_width constraints") Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/hantro/hantro_drv.c | 12 ++++++------ drivers/staging/media/hantro/hantro_hevc.c | 9 +-------- drivers/staging/media/hantro/hantro_hw.h | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/me= dia/hantro/hantro_drv.c index 01d33dcb0467..ac232b5f7825 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -253,11 +253,6 @@ queue_init(void *priv, struct vb2_queue *src_vq, struc= t vb2_queue *dst_vq) =20 static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) { - struct hantro_ctx *ctx; - - ctx =3D container_of(ctrl->handler, - struct hantro_ctx, ctrl_handler); - if (ctrl->id =3D=3D V4L2_CID_STATELESS_H264_SPS) { const struct v4l2_ctrl_h264_sps *sps =3D ctrl->p_new.p_h264_sps; =20 @@ -273,7 +268,12 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) } else if (ctrl->id =3D=3D V4L2_CID_MPEG_VIDEO_HEVC_SPS) { const struct v4l2_ctrl_hevc_sps *sps =3D ctrl->p_new.p_hevc_sps; =20 - return hantro_hevc_validate_sps(ctx, sps); + if (sps->bit_depth_luma_minus8 !=3D sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 !=3D 0) + /* Only 8-bit is supported */ + return -EINVAL; } else if (ctrl->id =3D=3D V4L2_CID_STATELESS_VP9_FRAME) { const struct v4l2_ctrl_vp9_frame *dec_params =3D ctrl->p_new.p_vp9_frame; =20 diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index 4f7e2acb46ec..df1f81952bba 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -154,15 +154,8 @@ static int tile_buffer_reallocate(struct hantro_ctx *c= tx) return -ENOMEM; } =20 -int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps) +static int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v= 4l2_ctrl_hevc_sps *sps) { - if (sps->bit_depth_luma_minus8 !=3D sps->bit_depth_chroma_minus8) - /* Luma and chroma bit depth mismatch */ - return -EINVAL; - if (sps->bit_depth_luma_minus8 !=3D 0) - /* Only 8-bit is supported */ - return -EINVAL; - /* * for tile pixel format check if the width and height match * hardware constraints diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index 33d156ccbfeb..77769d2bb38e 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -359,7 +359,6 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); void hantro_hevc_ref_init(struct hantro_ctx *ctx); dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, s32 poc); int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t ad= dr); -int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps); =20 =20 static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension) --=20 2.35.1