Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751847AbbKQC3Z (ORCPT ); Mon, 16 Nov 2015 21:29:25 -0500 Received: from mail-bn1on0139.outbound.protection.outlook.com ([157.56.110.139]:24848 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751421AbbKQC3Y (ORCPT ); Mon, 16 Nov 2015 21:29:24 -0500 Authentication-Results: spf=permerror (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; pengutronix.de; dkim=none (message not signed) header.d=none;pengutronix.de; dmarc=none action=none header.from=freescale.com; Date: Tue, 17 Nov 2015 10:10:42 +0800 From: Liu Ying To: Daniel Vetter CC: , , Subject: Re: [PATCH 2/2] drm/imx: Remove the primary plane created by create_primary_plane() Message-ID: <20151117021040.GA20180@shlinux2> References: <1446632158-19998-1-git-send-email-Ying.Liu@freescale.com> <1446632158-19998-2-git-send-email-Ying.Liu@freescale.com> <20151116160021.GX16848@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20151116160021.GX16848@phenom.ffwll.local> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD056;1:h6SBaboDoe40w43nWc9ALVDohEqAQwIyw81x22e2SrXpFshD1bMFmSF3ucS0WJcbAfqli6rfAgSOQVcVHJS0S6zZqrO1CzYuGQBc0XT9b0JYNZddOhwz2DtzAEzmDndXalYJCdZR+7ELIcWhGxq5LcJAwtFhcOnXerHKq9jS1Zha3/pG2mtNH6/75uE6ozJYkJLy1tISASwwsBbLbNeyJ2j8IPxmT8NjDIkjHBZJVpFrQShh1ymM15SMcKDRUV9vBqjTlA9wvitaEgbA6kfUh8s5mTdgxJd3rEagU1/oz2DWepRAacyw3wOJaFn5han1LCAXd8L+4jwdvaK9sBhIBnaLnwFSLEVwSWlnlh6r4wU6/ld6e2TU8rf0T79t/12A X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(448002)(24454002)(199003)(189002)(92566002)(87936001)(33656002)(5001960100002)(46406003)(97736004)(19580395003)(19580405001)(83506001)(97756001)(86362001)(85326001)(15975445007)(4001350100001)(77096005)(110136002)(81156007)(50986999)(33716001)(47776003)(586003)(76176999)(2950100001)(1720100001)(189998001)(5008740100001)(5007970100001)(54356999)(11100500001)(106466001)(6806005)(5890100001)(23726002)(50466002)(104016004);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0301MB1217;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1217;2:+wv+WawtthxyVCgN6c56aQjS3Dp3i6QjBno3VIAuxtgZmfm91BPEndSEqPg6KTxbMPK54tUUvpA4K7xMQJrc8FHpmopURNq4vNrqvFzOmeVkuN6STbnyvy9AAo9TdZ5+9GOw6V8esD59QozuMrEylEUCnZ/l/QDid6nAdLB1bTw=;3:2ebmNVVnDd6GM7rRuGEp+aAx+pcmXCJaiV2c4IOgwpNki2/4xCIO28wSv2vcJPOMh+L41PaSjmGPilpKQxsN6B9RuJRVayFFlHBQ6i78x8jo2EDFbG7WpBm/dCsPlM4qtpGfifT7jQV/K8JqYpgfinJkdWXUQg8F1vomCE9hC65vSulIOlJNjREdzAeDcyvQHhHaEmEgZpZX/q+InIocyqCRmUIJE+6mP16+yfRC6MQ=;25:/pEXX+5PlF1sMi1el03Wp6epqTGMo2H6KjA7fTvOTabMIsZQwy6GWxyK2+cKNBn/2zf0YyFMq7h1gk3kAPpcDikmCB6ZH13TBDNai6UofzecCI1rPKIZ06BmnYLMq6F7pM8DNc+36R8Ab+ayZ6EkAN6gI76zDoOxEVBNamuLl4lgH/vrt6JVwAS5fw8SNkG8q8Q/ZqVf63PtLiyHEHyAaffgtB7zokjr+HfRu+I7GZ96P5OVbWyleMSvCk0p2z2CttWMMHqKqV/jcNU5B9RCzg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1217; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1217;20:XxEObTDyDDj9WZVjY761Z0RE5GNEQ3aygX5/jY/6/TfBd0LE4oGrfMGav3wxnHEnwTsQgOfjUl0DLsZIU6J4DkDPYC4CEFgONsYWtybPesMwj+W9xzR8GOZV5B5f4aFcwOIXcqQA2hVXMMkhu7Ft6pBGyixSddwwKIy+et8b1JuTWWyF4lHJdaPVGVwc2qQKE8BF62dZJ0342jWsipqDzQ3HrkRRyt5Z1VuaAcSgGWrlN6WVUPv8vlibwrO2mfO0BWEIqJDLvre872e3GO+JMJ9K0ioxkt4z+SoMYdLWcTydR3OFk4F2ftjXq0291FUbGAXZhYfz7dAG4N0BxVcnHMaYL8PUFvRLCBXUvMPbtak=;4:9MlOAb196p2sMArlUTvViopMpXjoOL3J8nE7GF/otfPEH7ZJIXwHcxv/Qh2AMld7vnyxIeE+ZnQooz6ttI6c8Rbya8GbQ7HvfJCX6Qox+0c1LGMLljKdaKZ/uLJs1cmnhOA9+awyjGZILP92Z0o4q4fB16aUld0jYXHQAdwCFzs+nn/aT7utqap0hd9HhrXVIvytzoJyaZuUIMp5wXaTxGoXxssw1o4xgu+36J2jEGm1OFaG/pg9OhPFTcs0zZGM6iLn6M66tLeAvNoUkraVJDSHvg5zmd/XIrsZXNsm1AkRtj0RDsvOBW4ihfVMBSzoDEjWBC8C3fa8NDbEq7cqfB0j51y7V4oXARUfeKzAH8ZmI7JXN/qx8e3KaRPQ2SNs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001)(10201501046);SRVR:BN3PR0301MB1217;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1217; X-Forefront-PRVS: 07630F72AD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR0301MB1217;23:1dgZsw/UE1jzlcmXswDQ9rl8w4hB84XeGSir1DZ?= =?us-ascii?Q?kZsjdV7qFlEVLF2yExu1+SC44FGc947Tc9/CneFzQubehqekzjscZXyNIcqt?= =?us-ascii?Q?enHf6TSk10u+5gp+O9jZUBftl8j/oHw13egaYewGwVtnlH1l00fNhmhwH0tg?= =?us-ascii?Q?O+9V2BpU09QvvFzeGmNjD7vYL2CXiM5jsl5M0piDWw6Ni6zMPEb3z7/9W12d?= =?us-ascii?Q?ZabWspV/BFdI153at0crhQotBatsWoM/mLKmJi/VppciMM8Up/9SC5PgmbsS?= =?us-ascii?Q?M/El7JDoQtKEEnoKquCz2ziui6ixarG0yBpfryyonYTuNcz+6ieerHyHqVZp?= =?us-ascii?Q?pVs/c9dGSH5VtH94dreVTGNyIJsMRgrE999kpnBfysa0Osga+mnzkz9iWKhR?= =?us-ascii?Q?keEMwLYR8IahaLjABfa0CMaLRTDyy+9fTe4yHBIVATrQr1CS424I8PvwnhTF?= =?us-ascii?Q?tsRcSfLpKO4Sic22HH0tXUHpvrSTVoPh17b3mGkOm1bxKDcOcte/+emN0K/v?= =?us-ascii?Q?YQQjjGrKDKIUun9W/DRkhaxG1YWCOIQgX2LCRmx97TMqQxZToFo9R7/4yKVZ?= =?us-ascii?Q?RToDcBvVl4C5rTt/rB5Qa9DfyPrubZ122aCqqb26laQKO1RHNV9t162u/P1r?= =?us-ascii?Q?e6pyYlQx1+pf9W//uxrYkmYAvnE8PBbZ43xekyzSv5pSpzmyqZr79Z3F6VDj?= =?us-ascii?Q?M8zXOdkrKCWaqwo7Z21FaLYRosPrYxpH5/wOkkYz+g0iHvF0dw8hGcVGGa5Z?= =?us-ascii?Q?tNabAeiklDPaPQMS0NloeHHx6cEV15EguzdSHqU2i7V8UvhlIwmBE9nijCdw?= =?us-ascii?Q?1dgxG3DMDFKEsSmC+lUYZRzCNUZFnPZBbZKTgPd3xGIhCAhCpb/W7QscckXz?= =?us-ascii?Q?e9BTfdpQRh5uEGtWdXveGKTHBkOjDhldbpIBY5+H2rXnKTCYw7w1BysbRVIQ?= =?us-ascii?Q?wxiNwGhHrbx3VNOzK2TmgvCW+7VS1lcKAFZTPYHE9ew9/nLRcp12VdwtF48T?= =?us-ascii?Q?Sgn6MM2/CNv0Lvqv84ikYy5PPGrT4N+k+6ywDzQfHcGzx3bPJO0TvHaPiaA0?= =?us-ascii?Q?rX03e2rJSb23OUvz1YZXKrvVXHJ0E5A4rqJCGLQW0mHM/kYIMh9nD5QhPe18?= =?us-ascii?Q?vzKAay7w2sDM=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1217;5:hWBFPm9odwll/S48gISHBL4rOR11OI8UW/DwuAHxNSLy5T35CYnUr2MWshaf48DhNLPqWK9FfyPvvv/j2JrD7hbJcplXCmrQLwku2UkrycMZwHCxpR2Te63mVa1lTAjOC8U95HvC+/Hdqanem7P8wQ==;24:YVQRbJglBhxW+sxZPVLlq6MA0pFRdL8TrhNMwUPn5oIxD6hwNQiVxPuZmwvJsQff8I4f0doE1Nt8rOGDeViqWj0xzzU5C4lyt8CY8rwTRow=;20:grzB9TNVFGsmuWD3hEQ+ux4u81H0Bn3b+rZB0SR8KXP08FRDTVbWXtBq/pXNEcMsetDrLZCLvtCfX44TkSfW9Q== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2015 02:13:21.9500 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1217 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3759 Lines: 95 On Mon, Nov 16, 2015 at 05:00:21PM +0100, Daniel Vetter wrote: > On Wed, Nov 04, 2015 at 06:15:58PM +0800, Liu Ying wrote: > > Since we are using ipu_plane_init() to add one primary plane for each > > IPU CRTC, it's unnecessary to create the safe one by using the helper > > create_primary_plane(). > > > > Furthermore, the safe one is attached to crtc->primary, which actually > > carries a framebuffer(crtc->primary->fb) created by the fbdev helper to > > build up the fbcon. Instead, the one created by ipu_plane_init() is > > dangling, but it is the one actually does ipu_plane_mode_set() for the > > fbcon. This may causes the mismatch bewteen ipu_plane->enabled(true) and > > ipu_plane->base.fb(NULL). Thus, it brings a NULL pointer dereference > > issue in ipu_plane_mode_set() when we try to additionally touch the > > IDMAC channel of the ipu_plane. This issue could be reproduced by > > running the drm modetest with command line 'modetest -P 19:1024x768@XR24' > > on the i.MX6Q SabreSD platform(single LVDS display). This patch binds > > the plane created by ipu_plane_init() with crtc->primary and removes the > > safe one to address this issue. > > > > Signed-off-by: Liu Ying > > --- > > drivers/gpu/drm/imx/imx-drm-core.c | 3 ++- > > drivers/gpu/drm/imx/ipuv3-crtc.c | 6 ++++++ > > 2 files changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c > > index 6faa735..08eceeb 100644 > > --- a/drivers/gpu/drm/imx/imx-drm-core.c > > +++ b/drivers/gpu/drm/imx/imx-drm-core.c > > @@ -373,7 +373,8 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, > > drm_crtc_helper_add(crtc, > > imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs); > > > > - drm_crtc_init(drm, crtc, > > + /* The related primary plane will be created in ipu_plane_init(). */ > > + drm_crtc_init_with_planes(drm, crtc, NULL, NULL, > > imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs); > > > > return 0; > > diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c > > index 8d68697..d27143f 100644 > > --- a/drivers/gpu/drm/imx/ipuv3-crtc.c > > +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c > > @@ -343,6 +343,11 @@ err_out: > > return ret; > > } > > > > +static inline void ipu_crtc_set_primary_plane(struct ipu_crtc *ipu_crtc) > > +{ > > + ipu_crtc->base.primary = &ipu_crtc->plane[0]->base; > > This is quite a hack. Better would be to reorg the code so that when you > call drm_crtc_init_with_planes the primary plane has been created already. > -Daniel Thanks for your comments. Philipp has generated a patch[1] to address this. I acked it conditionally. [1] http://www.spinics.net/lists/dri-devel/msg93700.html Regards, Liu Ying > > > +} > > + > > static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, > > struct ipu_client_platformdata *pdata, struct drm_device *drm) > > { > > @@ -380,6 +385,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, > > ret); > > goto err_remove_crtc; > > } > > + ipu_crtc_set_primary_plane(ipu_crtc); > > > > /* If this crtc is using the DP, add an overlay plane */ > > if (pdata->dp >= 0 && pdata->dma[1] > 0) { > > -- > > 2.5.0 > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/dri-devel > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/