Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1839766pxb; Mon, 13 Sep 2021 06:41:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBCrtdeo9+dIHlasnY5pTpXOLXQiiYjX/xsNUA8lXy5ztajEePgDFFiDz2G2aB4o9x7N0D X-Received: by 2002:a6b:d915:: with SMTP id r21mr9065043ioc.76.1631540509463; Mon, 13 Sep 2021 06:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540509; cv=none; d=google.com; s=arc-20160816; b=J+bxDN0188qZuCz0HP1OT9m8vjBaGNdhYoWGra7exrt7tablV9M/TcCtf3833t3wpm WlUuJqLEjqRPnd2/hLUx6C6nbQdbcGAOCideH7g+vknS8iELGQeZVAoEz00xSF7sW4iD BWcaqyKlAadfxwgZbJdRKR6v145AwsUiHEoKolcn2Ovq1eAvqvejVWYdzp3D7Hl/qTYr fV7OCI3QoQk2jjFe1qTG9scmF48o1Q0srLse8JVhadQNTR3skh8f/BzyugYpxOCtuB5Y ydaBvh2Xwp3qivwbr02BO0f7x8hepe44A1fo2gqIVCZmVMmgq5J2N6wF1eqQ0TDd7pXw A6Mg== 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=kN6GoCrFJrfzKUM1e5RI356GDYOGWLegxlfZmMoBkM8=; b=nyheZ++kKHFANy5JxeEBv91AJYUU4fehT7cFqZevwdZEaUC4AnpgDy0HIGZWvHy76/ SN4C9ZuO3UfovaO40FMycBFD21Ey5pnZRD5dA1wtIYFU84TVu1yHtbfxFThZywQWoD6E Z0CjDEVXWe4CllPPV7HQ5ZhfkRs46Ey4TmIuGfT+UG5jhd76/V3s4hBl1hVVGU1A7xqi UQI6pKDnUZfdBtBXj3P1YY8FjxeXe0bfLh0fJJWaOSgOl2KpEgDBqe0aOJAd233TCBxf 447wY1heLbqV06F8FPMOBjBqehUia2W2/2FAm1fgK0m16rnfadMl8Co3nRu/EfJf/MwU 3jyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/dGG7gm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si1714668ilt.29.2021.09.13.06.41.37; Mon, 13 Sep 2021 06:41:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/dGG7gm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241583AbhIMNla (ORCPT + 99 others); Mon, 13 Sep 2021 09:41:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:37682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242089AbhIMNgR (ORCPT ); Mon, 13 Sep 2021 09:36:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 433DF610A5; Mon, 13 Sep 2021 13:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539648; bh=RKonlF0nt2qu42Z4Pv0XKU0K3Dwufrhsz5t3hILBXmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/dGG7gmhvlG6bBPbo+I5+rvjkxVVSP+JX7t80spicNk0k5LCql3O6l8ckq8E2CVa ehoWnPSaNuw6qeZaqfY8ccLqMEV7RYRynj2VgGEtlkWI4gFQFRoXZiN4j8hGBtLB2E q+nstELREaCzzTXbFRNIhmhtJfdxeIgq6TliEoxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrej Picej , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 098/236] media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats Date: Mon, 13 Sep 2021 15:13:23 +0200 Message-Id: <20210913131103.684780778@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Philipp Zabel [ Upstream commit 44693d74f5653f82cd7ca0fe730eed0f6b83306a ] The frame memory control register value is currently determined before userspace selects the final capture format and never corrected. Update ctx->frame_mem_ctrl in __coda_start_decoding() to fix decoding into YUV420 or YVU420 capture buffers. Reported-by: Andrej Picej Fixes: 497e6b8559a6 ("media: coda: add sequence initialization work") Signed-off-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/coda/coda-bit.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index bf75927bac4e..159c9de85788 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -2031,17 +2031,25 @@ static int __coda_start_decoding(struct coda_ctx *ctx) u32 src_fourcc, dst_fourcc; int ret; + q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); + q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + src_fourcc = q_data_src->fourcc; + dst_fourcc = q_data_dst->fourcc; + if (!ctx->initialized) { ret = __coda_decoder_seq_init(ctx); if (ret < 0) return ret; + } else { + ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) | + CODA9_FRAME_TILED2LINEAR); + if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV) + ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; + if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) + ctx->frame_mem_ctrl |= (0x3 << 9) | + ((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR); } - q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); - q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); - src_fourcc = q_data_src->fourcc; - dst_fourcc = q_data_dst->fourcc; - coda_write(dev, ctx->parabuf.paddr, CODA_REG_BIT_PARA_BUF_ADDR); ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc); -- 2.30.2