Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2937323rwb; Mon, 15 Aug 2022 14:25:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR4sSC41p82ueDSgzROrqt9Z/fP5vYCVhFAfLVlCyUd7+YtaYbS1Ok6wZOXowXsGzU9iN470 X-Received: by 2002:a17:906:730c:b0:730:da74:3453 with SMTP id di12-20020a170906730c00b00730da743453mr11692151ejc.270.1660598724420; Mon, 15 Aug 2022 14:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598724; cv=none; d=google.com; s=arc-20160816; b=Qpy5hzyeSLB+YfGpnrcTkJX3u+EuNwgiSu2/a6jU67zta0qm9ryvT3Jwc4/cGMz85Y GOk3R41I3QnVjsQufRGvZqlOT3AOFP/7GpoSIBYqdC454Zn2PuhlUBPwOosdfhivTsW/ ggtrQhTcYdohItpghWvDk6dhlLGc67P7SUDiX3cTePSPMAJeDYb22xfotaCgJxOpxKGY CH29i4QJnKiSMjz/9ms9EtsywoJ7+D7fKn7Z1Mi9OUPHtvv1xdPaLe0TeMhw+bNS7zlU wM02NOv1WnqKAuk6XdtYXeUO5I8TyKtxg8nkV4h3gwfeUeva2nWAqDKc4mzeLpDUgrEW KOAQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UD/jSpqBRjmhuDuKF0jgm5UNUpVCN8g2h7tEB2V379s=; b=E8TPAT5UxTohar8CeofXwgDpxqjpspJkSMbOQ3h1fgReu43a7sMFBFggVXAJOKZN/Q /pRtJhcqFDhcXX2AV2Q12dIcOP/yp/bn90dbdHK7uW3EK5PrDwKwckNe/OihjcRpBWTw h0654b3owpm9WHD9iUFFqFP9ABGYxaND9ZIsYEyYVweyjFWRTsqeZSUkXcQdSREBYUk/ Jx6uuYSZG549CGqha3I+87NawRdWuI5ceetNnVXS5B17VuijzRLZJ/6y1IRPa6Ge4iKP YtMwnDVCi1Q9OgpCKVEbGZDpQVGE2M6YKKnaS9/u5ywjVlQvI+n/MCIgphHy+tm0jgBJ kxzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FiOW54q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a170906784100b00708884b555asi6613147ejm.392.2022.08.15.14.24.52; Mon, 15 Aug 2022 14:25:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FiOW54q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345901AbiHOVWC (ORCPT + 99 others); Mon, 15 Aug 2022 17:22:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245476AbiHOVQ4 (ORCPT ); Mon, 15 Aug 2022 17:16:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65C87E34; Mon, 15 Aug 2022 12:20:17 -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 ams.source.kernel.org (Postfix) with ESMTPS id EB7CEB81123; Mon, 15 Aug 2022 19:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB1A0C433C1; Mon, 15 Aug 2022 19:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591214; bh=L06Sv7lqBwFtevSXYTNx3gL3bYegFT+MrKgvTofIZK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiOW54q63AC8MfHEFg6XOjLsHOXZ1gfiZNwgDCpMqiwTfmH0f8ngCBVp2SEs8aLuA LR0lcg7RS7FuFV8fHaHpcxS/WsmlJEzDcftwOblBUbmGxYmzmtgT+3PacICo4OVK9b yvsEH7nVdIGB2Y3Bw9HNZu0rP+4hpX0LQiPuEZ6w= 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.18 0509/1095] hantro: Remove incorrect HEVC SPS validation Date: Mon, 15 Aug 2022 19:58:28 +0200 Message-Id: <20220815180450.591537881@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 step_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/media/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, struct vb2_queue *dst_vq) static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) { - struct hantro_ctx *ctx; - - ctx = container_of(ctrl->handler, - struct hantro_ctx, ctrl_handler); - if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) { const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; @@ -273,7 +268,12 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_SPS) { const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; - return hantro_hevc_validate_sps(ctx, sps); + if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 != 0) + /* Only 8-bit is supported */ + return -EINVAL; } else if (ctrl->id == V4L2_CID_STATELESS_VP9_FRAME) { const struct v4l2_ctrl_vp9_frame *dec_params = ctrl->p_new.p_vp9_frame; diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/media/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 *ctx) return -ENOMEM; } -int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctrl_hevc_sps *sps) +static int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctrl_hevc_sps *sps) { - if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) - /* Luma and chroma bit depth mismatch */ - return -EINVAL; - if (sps->bit_depth_luma_minus8 != 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/media/hantro/hantro_hw.h index 457eb8bb6dc2..68c313864b06 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -353,7 +353,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 addr); -int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctrl_hevc_sps *sps); static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension) -- 2.35.1