Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2189830pxb; Thu, 11 Feb 2021 06:38:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEaGLAMISgsDHp2bhNUZoDau9wHehf5Qi6I7ODdUeRA3yUkww+uc2NPnrBgmMSr7c2X8wR X-Received: by 2002:a17:906:ae50:: with SMTP id lf16mr8952481ejb.66.1613054330086; Thu, 11 Feb 2021 06:38:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613054330; cv=none; d=google.com; s=arc-20160816; b=FxBwA6NKG1PDF4yiBVb5pDYPnBcGSwhVRtAQpysFD8BFzmpIk3Yh/Jv500ERDExSMj 0dgyv2t4PpeW+CT4cNPVsjrnTurg1rKCr4NQPkhEDXoTBoyhkzYfFMDtW/td1zofQ9ru puAcRo9eziJTYotI9RjR9zVTfk8kPv9xn+cxMRrRHk3YI5Sauue0iN/jpmjwRVmq+C41 0o+7MeHED2p9RwUZlSfxrbA+j6oSUGiI9vvu1QK5pTVnZZ9lWAtJQNPZrcwEqZ3vHetp aBgluN58dLHhNezOg7WoZL4JeCBU5cMau0NYC19de0LoLwKTEka9KLcfqpJinhDX+shC vMfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DcsnsBU/G2efNLSHN8YKy1m4+4Vlv31rDMJPyNWSBD0=; b=bDWy04y+YHoGR5u+DUOQom+RyzJCkHcMtSblX/WV4XlETusCyBQerfrMucJu/Ake30 LiQqqqNwVxQ2t/bX2ZH9veUNeSGt6sni699uu+/GI9aluKpXNBiyGizIvDm5IJuFFjfj hcZMKJU31JHftyEltqZd367OeFmaCvVKUy5dRu2YH6WofMvKjExds6tBm42SHa0MvM3W dPQSEcvPcm/HXnCmEhDCLg72MJNNJaJSzTY81EGh2XUx4st5h71ABKbaxr8izhwHrRNl +aIwyTfh3S2Ms3qeCg6D7HhZAx33VjiaNRJGDN5bz3dmJELlMpVnFaDCiTzgdINCIGlP PUhw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si3812286edq.605.2021.02.11.06.38.26; Thu, 11 Feb 2021 06:38:50 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbhBKOfh (ORCPT + 99 others); Thu, 11 Feb 2021 09:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232259AbhBKOdV (ORCPT ); Thu, 11 Feb 2021 09:33:21 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACEB4C061786 for ; Thu, 11 Feb 2021 06:32:39 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAD1G-0008Ve-Le; Thu, 11 Feb 2021 15:32:34 +0100 Received: from pza by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lAD1F-0006r5-Kf; Thu, 11 Feb 2021 15:32:33 +0100 Date: Thu, 11 Feb 2021 15:32:33 +0100 From: Philipp Zabel To: Sven Van Asbroeck Cc: Nicolas Dufresne , Mauro Carvalho Chehab , Adrian Ratiu , Lucas Stach , Fabio Estevam , linux-media , Linux Kernel Mailing List Subject: Re: [BUG REPORT] media: coda: mpeg4 decode corruption on i.MX6qp only Message-ID: <20210211143233.GA1360@pengutronix.de> References: <20210203163348.30686-1-TheSven73@gmail.com> <804285cff81878a2c188d1b823182114f891ca38.camel@ndufresne.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 15:17:42 up 71 days, 2:44, 112 users, load average: 0.11, 0.12, 0.21 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: pza@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sven, On Wed, Feb 10, 2021 at 01:29:29PM -0500, Sven Van Asbroeck wrote: > Found it! > > The i.MX6QuadPlus has two pairs of PREs, which use the extended > section of the iRAM. The Classic does not have any PREs or extended > iRAM: > > pre1: pre@21c8000 { > compatible = "fsl,imx6qp-pre"; > > fsl,iram = <&ocram2>; > }; > > pre3: pre@21ca000 { > compatible = "fsl,imx6qp-pre"; > > fsl,iram = <&ocram3>; > }; > > The CODA (VPU) driver uses the common section of iRAM: > > vpu: vpu@2040000 { > compatible = "cnm,coda960"; > > iram = <&ocram>; > }; > > The VPU or the PREs are overrunning their assigned iRAM area. How do I > know? Because if I change the PRE iRAM order, the problem disappears! > > PRE1: ocram2 change to ocram3 > PRE2: ocram2 change to ocram3 > PRE3: ocram3 change to ocram2 > PRE4: ocram3 change to ocram2 Thank you for debugging this. Given that CODA uses the OCRAM address range 0x900000-0x940000 and the PREs use OCRAM2 at 0x940000-0x960000 and OCRAM3 at 0x960000-0x980000, it seems unlikely that the PREs would overrun into the CODA iRAM. But maybe there is some stride related overflow that causes it to write at negative offsets or some other kind of oversight. Could you check /sys/kernel/debug/dri/?/state while running the error case? Another thing that might help to identify who is writing where might be to clear the whole OCRAM region and dump it after running only decode or only PRE/PRG scanout, for example: ----------8<---------- /* Clear OCRAM */ #include #include #include #include #include #define OCRAM_START 0x900000 #define OCRAM_SIZE 0x80000 int main(int argc, char *argv[]) { int fd = open("/dev/mem", O_RDWR | O_SYNC); void *map = mmap(NULL, OCRAM_SIZE, PROT_WRITE, MAP_SHARED, fd, OCRAM_START); if (map == MAP_FAILED) return EXIT_FAILURE; memset(map, 0, OCRAM_SIZE); munmap(map, OCRAM_SIZE); close(fd); return EXIT_SUCCESS; } ---------->8---------- ----------8<---------- /* Dump OCRAM to stdout */ #include #include #include #include #define OCRAM_START 0x900000 #define OCRAM_SIZE 0x80000 int main(int argc, char *argv[]) { int fd = open("/dev/mem", O_RDONLY | O_SYNC); void *map = mmap(NULL, OCRAM_SIZE, PROT_READ, MAP_SHARED, fd, OCRAM_START); if (map == MAP_FAILED) return EXIT_FAILURE; write(1, map, OCRAM_SIZE); munmap(map, OCRAM_SIZE); close(fd); return EXIT_SUCCESS; } ---------->8---------- regards Philipp