From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754221AbcHWSRq (ORCPT ); Tue, 23 Aug 2016 14:17:46 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:34265 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752444AbcHWSRp (ORCPT ); Tue, 23 Aug 2016 14:17:45 -0400 MIME-Version: 1.0 X-Originating-IP: [212.51.149.109] In-Reply-To: <1f55fd4b-3db1-439d-4076-8ef0ccc790f8@tronnes.org> References: <1471897525-31118-1-git-send-email-noralf@tronnes.org> <1471897525-31118-6-git-send-email-noralf@tronnes.org> <20160823124116.GG10980@phenom.ffwll.local> <1f55fd4b-3db1-439d-4076-8ef0ccc790f8@tronnes.org> From: Daniel Vetter Date: Tue, 23 Aug 2016 20:01:17 +0200 X-Google-Sender-Auth: 0luYdDjQ64F0KZSPf_M8WVOXSnw Message-ID: Subject: Re: [PATCH v4 5/5] drm: simpledrm: honour remove_conflicting_framebuffers() To: =?UTF-8?Q?Noralf_Tr=C3=B8nnes?= Cc: dri-devel , Linux Kernel Mailing List , "devicetree@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u7NIHoqC024719 On Tue, Aug 23, 2016 at 7:52 PM, Noralf Trønnes wrote: >>> +static int sdrm_fbdev_event_notify(struct notifier_block *self, >>> + unsigned long action, void *data) >>> +{ >>> + struct sdrm_device *sdrm; >>> + struct fb_event *event = data; >>> + struct fb_info *info = event->info; >>> + struct drm_fb_helper *fb_helper = info->par; >>> + >>> + if (action != FB_EVENT_FB_UNREGISTERED) >>> + return NOTIFY_DONE; >>> + >>> + if (!fb_helper || !fb_helper->dev || fb_helper->fbdev != info) >>> + return NOTIFY_DONE; >>> + >>> + sdrm = fb_helper->dev->dev_private; >>> + >>> + if (sdrm && sdrm->fb_helper == fb_helper) >>> + >>> platform_device_del(to_platform_device(fb_helper->dev->dev)); >>> + >>> + return NOTIFY_DONE; >>> +} >> >> One problem this leaves behind is that registering of the new fbdev driver >> is too late - by that point we've already set up the entire driver, >> including modeset. If fbdev meanwhile does a dpms off or something like >> that all hell will break loose. > > > I don't understand how fbdev registration comes into play here. Drivers call > remove_conflicting_framebuffers very early so simpledrm is gone by the time > they register anything. > > For simpledrm, fbdev doing blank/unblank is a no-op since fb_ops.fb_blank > is not implemented. So a fb_blank() just results in fbcon doing a > software blank. Maybe my scenario wasn't entirely clear: - prereq: fbdev emulation in drm is disabled 1. simpledrm loads and sets up the firmware fb 2. real driver loads, first calls drm_fb_helper_remove_conflicting_framebuffer. Nothing happens because CONFIG_FB=n. 3. real driver start loading, remapping the gart and what not else 4. something is drawn using fbcon, simplerdrm writes through the now invalid mapping -> BOOM You have code to listen to the framebuffer registration notifier, but I think even that happens way too late. Or at least I didn't spot any code in remove_conflicting_framebuffers which would call down into that notifier. Or maybe I entirely misunderstand your code ... Wrt fixing: Just adding it to the recently added stub is of course also a working solution. -Daniel PS: Can you pls review the 2 patches I submitted with you on cc? I won't merge my own patches without proper review, so without that done they're stuck. -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch