Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3081954rwb; Mon, 15 Aug 2022 17:40:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Uufzv/E9IGEumyM3HRv4OsbkwxGxJ5o8xeLYTkZHtua3eNnHLEYTOgYKJwN9wKAoDk+OG X-Received: by 2002:a62:18ce:0:b0:52d:3137:d854 with SMTP id 197-20020a6218ce000000b0052d3137d854mr18583945pfy.16.1660610458416; Mon, 15 Aug 2022 17:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610458; cv=none; d=google.com; s=arc-20160816; b=IjjTB5i43PDjBld7LU7nYlLEEXpkww1AGInOuCHfL/3MJeKsangatNBziKi04BkQK5 aOpVkvQd3NaC3dboMiOomxkBbxpOSVYpYeD4XIrQ57p1zbbpteFShcNpMMm3CXrgYOkS /QgVWSK/o99XZ/BPz8pI4q8sq20yp5f9PxByyWXZBBHQk0R1K+sdW7UyY3iTOVktR8B2 XrJ6JlXHrxK1q/L6KHN/860A+NcYHGm+1KSJMpbkPwL1tpKXkpkZZWPAQFQJeRU71aeN rTdLsExNT9Y+PqXxU5mJtNDF8djWueyCwjyq62m73A5jLVNHssbB8omoH+PpTv2rgh2F /l0Q== 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=0K69RsMFTc6dbceVVvbxwiM10Mp7egn+JxWJl9eD7Ok=; b=Qf5khfQbNbZwx5qq7UFsjg47vF7/XXQgGYFFv98rQNqzoCruCfUtfeEa5TDvZQcgRO EvNBWXAQsFP+oOth7RSwCxleymk+09IsdvTltdPK0KOa7MdVxlEVlbfBt1gp5s+wKYOT RgYQIPS0K8UBXn0UIcC3mKZyCZucybWWlCGIf8g2E0HUgeCeWM2VALGU85TfIXPHZ4w8 gHtmkOlRoFYzxW7mUGG8XpYwJheFbTpud9IhT2O7GM+EAVONvxXuDtZ+8aEarVzXsNm1 SjtEQSvLFEvWPzuf6XgrlSpqGNLGgqg14iAufSdBhW+E/MsGv6uAZrSOMDVeSCPiteBp Z7Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P0EjW0lm; 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 mu14-20020a17090b388e00b001f7353b22b7si20986014pjb.135.2022.08.15.17.40.47; Mon, 15 Aug 2022 17:40:58 -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=P0EjW0lm; 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 S1355421AbiHOXwH (ORCPT + 99 others); Mon, 15 Aug 2022 19:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354939AbiHOXqv (ORCPT ); Mon, 15 Aug 2022 19:46:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC38F8E991; Mon, 15 Aug 2022 13:15:03 -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 7257CB80EA9; Mon, 15 Aug 2022 20:15:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C10EC433D7; Mon, 15 Aug 2022 20:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594501; bh=nUubxWZTlLnx+rOCghc0oRuIANaK9QPhD549Gb2CnV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0EjW0lmfIy8lPsOQAJDYxdDwxBcJIs9ilZq90VMoHbG7EesK50AsALspkzJThkCa cGv6ARYOTwmBi4P4/v9uls3Kdc0NGEcxuFxHVdX6JbVml5GOR2E2VGEC/4/U8uRL7t 2ZR//HJUzwyskBxpbk5V1v26/YbFnQGA3Nr+klk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 0467/1157] media: amphion: only insert the first sequence startcode for vc1l format Date: Mon, 15 Aug 2022 19:57:03 +0200 Message-Id: <20220815180458.278879721@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-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: Ming Qian [ Upstream commit e670f5d672ef3d00b0b8c69eff09a019e6dd4ef9 ] For format V4L2_PIX_FMT_VC1_ANNEX_L, the amphion vpu requires driver to help insert some custom startcode before sequence and frame. but only the first sequence startcode is needed, the extra startcode will cause decoding error. So after seek, we don't need to insert the sequence startcode. In other words, for V4L2_PIX_FMT_VC1_ANNEX_L, the vpu doesn't support dynamic resolution change. Fixes: 145e936380edb ("media: amphion: implement malone decoder rpc interface") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vdec.c | 2 +- drivers/media/platform/amphion/vpu.h | 1 + drivers/media/platform/amphion/vpu_malone.c | 2 ++ drivers/media/platform/amphion/vpu_rpc.h | 7 ++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 5e3b08d07abd..44dbca0fe17f 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -105,7 +105,6 @@ static const struct vpu_format vdec_formats[] = { .pixfmt = V4L2_PIX_FMT_VC1_ANNEX_L, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION }, { .pixfmt = V4L2_PIX_FMT_MPEG2, @@ -741,6 +740,7 @@ static void vdec_stop_done(struct vpu_inst *inst) vdec->eos_received = 0; vdec->is_source_changed = false; vdec->source_change = 0; + inst->total_input_count = 0; vpu_inst_unlock(inst); } diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h index e56b96a7e5d3..f914de6ed81e 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -258,6 +258,7 @@ struct vpu_inst { struct vpu_format cap_format; u32 min_buffer_cap; u32 min_buffer_out; + u32 total_input_count; struct v4l2_rect crop; u32 colorspace; diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/platform/amphion/vpu_malone.c index 40267c73b1f9..542bbe361bd8 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -1298,6 +1298,8 @@ static int vpu_malone_insert_scode_vc1_l_seq(struct malone_scode_t *scode) int size = 0; u8 rcv_seqhdr[MALONE_VC1_RCV_SEQ_HEADER_LEN]; + if (scode->inst->total_input_count) + return 0; scode->need_data = 0; ret = vpu_malone_insert_scode_seq(scode, MALONE_CODEC_ID_VC1_SIMPLE, sizeof(rcv_seqhdr)); diff --git a/drivers/media/platform/amphion/vpu_rpc.h b/drivers/media/platform/amphion/vpu_rpc.h index 25119e5e807e..7eb6f01e6ab5 100644 --- a/drivers/media/platform/amphion/vpu_rpc.h +++ b/drivers/media/platform/amphion/vpu_rpc.h @@ -312,11 +312,16 @@ static inline int vpu_iface_input_frame(struct vpu_inst *inst, struct vb2_buffer *vb) { struct vpu_iface_ops *ops = vpu_core_get_iface(inst->core); + int ret; if (!ops || !ops->input_frame) return -EINVAL; - return ops->input_frame(inst->core->iface, inst, vb); + ret = ops->input_frame(inst->core->iface, inst, vb); + if (ret < 0) + return ret; + inst->total_input_count++; + return ret; } static inline int vpu_iface_config_memory_resource(struct vpu_inst *inst, -- 2.35.1