Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp6621pxb; Mon, 13 Sep 2021 11:28:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx32c6pGxsVDvV0DVFAztbcPpxe8mGRzzvDMo0pyV2JtyUYn/isKV6IG5XIThg+ripC/oFb X-Received: by 2002:a05:6e02:1305:: with SMTP id g5mr8218117ilr.9.1631557720487; Mon, 13 Sep 2021 11:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631557720; cv=none; d=google.com; s=arc-20160816; b=LfWRg/smHSo4uxubzWWArxJBST3r/aFW74lS+2BHKJaADx4lFRrAtREDJvmOKH3Z8x S4mfTkSxQiDGJW1fIr3tNGeTiCHg4y2bA0t4NHCJ+r02VUhWr9qcjccbq88eLSVzXWdi 1L1olQzHNL1JSrbhi4CCAPxUepu7a7W1OLUSAnzC4WfjNUXVU30FoGW6ZgiAgoGPNudq Io9iPIo35QBmIwR9KEtpBDSMpkLMV9/EZZpBS7crABUAD802vD7G5PinTLxk9KdWa7h7 Xa0E+OwZhPfXzfnop4tt4ub77oawcmkeoblZRH3wkSxf5RWxp/Y9tKZw8YndS+NhUpPP A/OA== 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=3LXmc5UjdveND1VA+D68OjiT5pVmoJPsBDKc1b36RdE=; b=Y+avPg4lxGpzQyG8tSOv61Ji9pmXN5N6Fk9tTs4Hkng8diZsDtmtFE+Q1raHqxrd7O xfHKvi2xPzczo6V7OuVuIiyNQZhJq6DQkt952Jy7/8t/djjq5RSjaGY3UE6qLAA3xoJd ZupYKwe1aCKZuq/bF0gakceWFvDd41BvURNhhne4p3bnStGqJUT8qLbd/sVlew9mPpNC +B7pEkKkJumgn5PuhOHB2hPbb+4CE0Akgp0/epH440HpWTSTfECJdPkMSOk7GAq3dRqW I1XkMdIzBXUA23lPV5xZs1PWf/GXpT4axLoNEApGML8TJC+FmROeYPsmuS5OXmJcWrNs b88Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WG+fFoOw; 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 q14si2439277iot.14.2021.09.13.11.28.28; Mon, 13 Sep 2021 11:28:40 -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=WG+fFoOw; 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 S240633AbhIMNXV (ORCPT + 99 others); Mon, 13 Sep 2021 09:23:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:34834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240285AbhIMNVW (ORCPT ); Mon, 13 Sep 2021 09:21:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6CB75610A2; Mon, 13 Sep 2021 13:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539194; bh=yigy+Nk8kyBy+/NjNCqeL55b+Y70hewK4LGHSXEnOQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WG+fFoOwu21Q48zcblR3hwVbl7e84MDxmycoLzz4G+WzC3rP9oeWmmy31TV0/X1YR 8MhiMIjx1Uy71xx/Eiw3OV06hpwLntO0WESIJ9/BY7lgwJSlKxpRj0wkNSodWeiEc1 MCzy3tSlTSw7cRxWF/z5hs2Ow4oeCO83kGrAG8jY= 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.4 059/144] media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats Date: Mon, 13 Sep 2021 15:14:00 +0200 Message-Id: <20210913131049.940184146@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@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 00c7bed3dd57..e6b68be09f8f 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -2023,17 +2023,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