From patchwork Thu Sep 13 13:16:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10599539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BDFCA13BF for ; Thu, 13 Sep 2018 13:16:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD8FF2AD89 for ; Thu, 13 Sep 2018 13:16:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1C7D2AD8C; Thu, 13 Sep 2018 13:16:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 62EAC2AD88 for ; Thu, 13 Sep 2018 13:16:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C12086E68D; Thu, 13 Sep 2018 13:16:39 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 186126E68D for ; Thu, 13 Sep 2018 13:16:37 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 13756925-1500050 for multiple; Thu, 13 Sep 2018 14:16:26 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 13 Sep 2018 14:16:26 +0100 Message-Id: <20180913131629.3978-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/4] drm/i915: Mark up a couple of KMS debug messages as such X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP For finding the panel fitter and PLL for a particular modeset is a part of that modeset and should be included with the reset of the DRM_DEBUG_KMS. Signed-off-by: Chris Wilson Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7fbc006be44a..3be5fa0acee8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6155,8 +6155,8 @@ static void i9xx_pfit_disable(struct intel_crtc *crtc) assert_pipe_disabled(dev_priv, crtc->pipe); - DRM_DEBUG_DRIVER("disabling pfit, current: 0x%08x\n", - I915_READ(PFIT_CONTROL)); + DRM_DEBUG_KMS("disabling pfit, current: 0x%08x\n", + I915_READ(PFIT_CONTROL)); I915_WRITE(PFIT_CONTROL, 0); } @@ -8678,8 +8678,8 @@ static int ironlake_crtc_compute_clock(struct intel_crtc *crtc, ironlake_compute_dpll(crtc, crtc_state, NULL); if (!intel_get_shared_dpll(crtc, crtc_state, NULL)) { - DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n", - pipe_name(crtc->pipe)); + DRM_DEBUG_KMS("failed to find PLL for pipe %c\n", + pipe_name(crtc->pipe)); return -EINVAL; } @@ -9246,8 +9246,8 @@ static int haswell_crtc_compute_clock(struct intel_crtc *crtc, intel_get_crtc_new_encoder(state, crtc_state); if (!intel_get_shared_dpll(crtc, crtc_state, encoder)) { - DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n", - pipe_name(crtc->pipe)); + DRM_DEBUG_KMS("failed to find PLL for pipe %c\n", + pipe_name(crtc->pipe)); return -EINVAL; } } From patchwork Thu Sep 13 13:16:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10599543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AE3614E5 for ; Thu, 13 Sep 2018 13:16:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A5192AD7D for ; Thu, 13 Sep 2018 13:16:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F15C2AD7A; Thu, 13 Sep 2018 13:16:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5AD332AD89 for ; Thu, 13 Sep 2018 13:16:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3FAC6E693; Thu, 13 Sep 2018 13:16:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E3516E690 for ; Thu, 13 Sep 2018 13:16:39 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 13756926-1500050 for multiple; Thu, 13 Sep 2018 14:16:26 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 13 Sep 2018 14:16:27 +0100 Message-Id: <20180913131629.3978-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131629.3978-1-chris@chris-wilson.co.uk> References: <20180913131629.3978-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/4] drm/i915/fbdev: Use i915/drm_i915_private consistently X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Convert the interface (except for the drm core callback) to accept drm_i915_private as that is our native type of the majority of operations. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.c | 10 +-- drivers/gpu/drm/i915/intel_drv.h | 28 +++---- drivers/gpu/drm/i915/intel_fbdev.c | 117 ++++++++++++++--------------- 3 files changed, 77 insertions(+), 78 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 5dd7fc582e6f..a74de4428c79 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -692,7 +692,7 @@ static int i915_load_modeset_init(struct drm_device *dev) if (INTEL_INFO(dev_priv)->num_pipes == 0) return 0; - ret = intel_fbdev_init(dev); + ret = intel_fbdev_init(dev_priv); if (ret) goto cleanup_gem; @@ -1260,7 +1260,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) * irqs are fully enabled. We do it last so that the async config * cannot run before the connectors are registered. */ - intel_fbdev_initial_config_async(dev); + intel_fbdev_initial_config_async(dev_priv); /* * We need to coordinate the hotplugs with the asynchronous fbdev @@ -1527,7 +1527,7 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file) */ static void i915_driver_lastclose(struct drm_device *dev) { - intel_fbdev_restore_mode(dev); + intel_fbdev_restore_mode(to_i915(dev)); vga_switcheroo_process_delayed_switch(); } @@ -1623,7 +1623,7 @@ static int i915_drm_suspend(struct drm_device *dev) intel_opregion_unregister(dev_priv); - intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true); + intel_fbdev_set_suspend(dev_priv, FBINFO_STATE_SUSPENDED, true); dev_priv->suspend_count++; @@ -1784,7 +1784,7 @@ static int i915_drm_resume(struct drm_device *dev) intel_opregion_register(dev_priv); - intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false); + intel_fbdev_set_suspend(dev_priv, FBINFO_STATE_RUNNING, false); intel_opregion_notify_adapter(dev_priv, PCI_D0); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bf1c38728a59..daa2fc007d02 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1779,32 +1779,34 @@ bool intel_encoder_hotplug(struct intel_encoder *encoder, /* legacy fbdev emulation in intel_fbdev.c */ #ifdef CONFIG_DRM_FBDEV_EMULATION -extern int intel_fbdev_init(struct drm_device *dev); -extern void intel_fbdev_initial_config_async(struct drm_device *dev); -extern void intel_fbdev_unregister(struct drm_i915_private *dev_priv); -extern void intel_fbdev_fini(struct drm_i915_private *dev_priv); -extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous); -extern void intel_fbdev_output_poll_changed(struct drm_device *dev); -extern void intel_fbdev_restore_mode(struct drm_device *dev); +int intel_fbdev_init(struct drm_i915_private *i915); +void intel_fbdev_initial_config_async(struct drm_i915_private *i915); +void intel_fbdev_unregister(struct drm_i915_private *i915); +void intel_fbdev_fini(struct drm_i915_private *i915); +void intel_fbdev_set_suspend(struct drm_i915_private *i915, + int state, bool synchronous); +void intel_fbdev_restore_mode(struct drm_i915_private *i915); +void intel_fbdev_output_poll_changed(struct drm_device *dev); #else -static inline int intel_fbdev_init(struct drm_device *dev) +static inline int intel_fbdev_init(struct drm_i915_private *i915) { return 0; } -static inline void intel_fbdev_initial_config_async(struct drm_device *dev) +static inline void intel_fbdev_initial_config_async(struct drm_i915_private *i915) { } -static inline void intel_fbdev_unregister(struct drm_i915_private *dev_priv) +static inline void intel_fbdev_unregister(struct drm_i915_private *i915) { } -static inline void intel_fbdev_fini(struct drm_i915_private *dev_priv) +static inline void intel_fbdev_fini(struct drm_i915_private *i915) { } -static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) +static inline void intel_fbdev_set_suspend(struct drm_i915_private *i915, + int state, bool synchronous) { } @@ -1812,7 +1814,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev) { } -static inline void intel_fbdev_restore_mode(struct drm_device *dev) +static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915) { } #endif diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index f99332972b7a..84ebd8102215 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -54,11 +54,14 @@ static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev) intel_fb_obj_invalidate(obj, origin); } +static struct intel_fbdev *info_to_fbdev(struct fb_info *info) +{ + return container_of(info->par, struct intel_fbdev, helper); +} + static int intel_fbdev_set_par(struct fb_info *info) { - struct drm_fb_helper *fb_helper = info->par; - struct intel_fbdev *ifbdev = - container_of(fb_helper, struct intel_fbdev, helper); + struct intel_fbdev *ifbdev = info_to_fbdev(info); int ret; ret = drm_fb_helper_set_par(info); @@ -70,9 +73,7 @@ static int intel_fbdev_set_par(struct fb_info *info) static int intel_fbdev_blank(int blank, struct fb_info *info) { - struct drm_fb_helper *fb_helper = info->par; - struct intel_fbdev *ifbdev = - container_of(fb_helper, struct intel_fbdev, helper); + struct intel_fbdev *ifbdev = info_to_fbdev(info); int ret; ret = drm_fb_helper_blank(blank, info); @@ -85,9 +86,7 @@ static int intel_fbdev_blank(int blank, struct fb_info *info) static int intel_fbdev_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - struct drm_fb_helper *fb_helper = info->par; - struct intel_fbdev *ifbdev = - container_of(fb_helper, struct intel_fbdev, helper); + struct intel_fbdev *ifbdev = info_to_fbdev(info); int ret; ret = drm_fb_helper_pan_display(var, info); @@ -113,11 +112,10 @@ static int intelfb_alloc(struct drm_fb_helper *helper, { struct intel_fbdev *ifbdev = container_of(helper, struct intel_fbdev, helper); - struct drm_framebuffer *fb; - struct drm_device *dev = helper->dev; - struct drm_i915_private *dev_priv = to_i915(dev); + struct drm_i915_private *i915 = to_i915(helper->dev); struct drm_mode_fb_cmd2 mode_cmd = {}; struct drm_i915_gem_object *obj; + struct drm_framebuffer *fb; int size, ret; /* we don't do packed 24bpp */ @@ -139,10 +137,10 @@ static int intelfb_alloc(struct drm_fb_helper *helper, * important and we should probably use that space with FBC or other * features. */ obj = NULL; - if (size * 2 < dev_priv->stolen_usable_size) - obj = i915_gem_object_create_stolen(dev_priv, size); + if (size * 2 < i915->stolen_usable_size) + obj = i915_gem_object_create_stolen(i915, size); if (obj == NULL) - obj = i915_gem_object_create(dev_priv, size); + obj = i915_gem_object_create(i915, size); if (IS_ERR(obj)) { DRM_ERROR("failed to allocate framebuffer\n"); ret = PTR_ERR(obj); @@ -170,16 +168,14 @@ static int intelfb_create(struct drm_fb_helper *helper, { struct intel_fbdev *ifbdev = container_of(helper, struct intel_fbdev, helper); + struct drm_i915_private *i915 = to_i915(helper->dev); struct intel_framebuffer *intel_fb = ifbdev->fb; - struct drm_device *dev = helper->dev; - struct drm_i915_private *dev_priv = to_i915(dev); - struct pci_dev *pdev = dev_priv->drm.pdev; - struct i915_ggtt *ggtt = &dev_priv->ggtt; + struct i915_ggtt *ggtt = &i915->ggtt; const struct i915_ggtt_view view = { .type = I915_GGTT_VIEW_NORMAL, }; - struct fb_info *info; struct drm_framebuffer *fb; + struct fb_info *info; struct i915_vma *vma; unsigned long flags = 0; bool prealloc = false; @@ -209,8 +205,8 @@ static int intelfb_create(struct drm_fb_helper *helper, sizes->fb_height = intel_fb->base.height; } - mutex_lock(&dev->struct_mutex); - intel_runtime_pm_get(dev_priv); + mutex_lock(&i915->drm.struct_mutex); + intel_runtime_pm_get(i915); /* Pin the GGTT vma for our access via info->screen_base. * This also validates that any existing fb inherited from the @@ -242,10 +238,11 @@ static int intelfb_create(struct drm_fb_helper *helper, info->fbops = &intelfb_ops; /* setup aperture base/size for vesafb takeover */ - info->apertures->ranges[0].base = dev->mode_config.fb_base; + info->apertures->ranges[0].base = i915->drm.mode_config.fb_base; info->apertures->ranges[0].size = ggtt->mappable_end; - info->fix.smem_start = dev->mode_config.fb_base + i915_ggtt_offset(vma); + info->fix.smem_start = + i915->drm.mode_config.fb_base + i915_ggtt_offset(vma); info->fix.smem_len = vma->node.size; vaddr = i915_vma_pin_iomap(vma); @@ -277,16 +274,16 @@ static int intelfb_create(struct drm_fb_helper *helper, ifbdev->vma = vma; ifbdev->vma_flags = flags; - intel_runtime_pm_put(dev_priv); - mutex_unlock(&dev->struct_mutex); - vga_switcheroo_client_fb_set(pdev, info); + intel_runtime_pm_put(i915); + mutex_unlock(&i915->drm.struct_mutex); + vga_switcheroo_client_fb_set(i915->drm.pdev, info); return 0; out_unpin: intel_unpin_fb_vma(vma, flags); out_unlock: - intel_runtime_pm_put(dev_priv); - mutex_unlock(&dev->struct_mutex); + intel_runtime_pm_put(i915); + mutex_unlock(&i915->drm.struct_mutex); return ret; } @@ -335,7 +332,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, struct drm_fb_offset *offsets, bool *enabled, int width, int height) { - struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); + struct drm_i915_private *i915 = to_i915(fb_helper->dev); unsigned long conn_configured, conn_seq, mask; unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); int i, j; @@ -484,7 +481,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, * fbdev helper library. */ if (num_connectors_enabled != num_connectors_detected && - num_connectors_enabled < INTEL_INFO(dev_priv)->num_pipes) { + num_connectors_enabled < INTEL_INFO(i915)->num_pipes) { DRM_DEBUG_KMS("fallback: Not all outputs enabled\n"); DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled, num_connectors_detected); @@ -540,7 +537,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev) * Note we only support a single fb shared across pipes for boot (mostly for * fbcon), so we just find the biggest and use that. */ -static bool intel_fbdev_init_bios(struct drm_device *dev, +static bool intel_fbdev_init_bios(struct drm_i915_private *i915, struct intel_fbdev *ifbdev) { struct intel_framebuffer *fb = NULL; @@ -549,7 +546,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, unsigned int max_size = 0; /* Find the largest fb */ - for_each_crtc(dev, crtc) { + for_each_crtc(&i915->drm, crtc) { struct drm_i915_gem_object *obj = intel_fb_obj(crtc->primary->state->fb); intel_crtc = to_intel_crtc(crtc); @@ -574,7 +571,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, } /* Now make sure all the pipes will fit into it */ - for_each_crtc(dev, crtc) { + for_each_crtc(&i915->drm, crtc) { unsigned int cur_size; intel_crtc = to_intel_crtc(crtc); @@ -637,7 +634,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, drm_framebuffer_get(&ifbdev->fb->base); /* Final pass to check if any active pipes don't have fbs */ - for_each_crtc(dev, crtc) { + for_each_crtc(&i915->drm, crtc) { intel_crtc = to_intel_crtc(crtc); if (!crtc->state->active) @@ -659,39 +656,39 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, static void intel_fbdev_suspend_worker(struct work_struct *work) { - intel_fbdev_set_suspend(&container_of(work, - struct drm_i915_private, - fbdev_suspend_work)->drm, + intel_fbdev_set_suspend(container_of(work, + struct drm_i915_private, + fbdev_suspend_work), FBINFO_STATE_RUNNING, true); } -int intel_fbdev_init(struct drm_device *dev) +int intel_fbdev_init(struct drm_i915_private *i915) { - struct drm_i915_private *dev_priv = to_i915(dev); struct intel_fbdev *ifbdev; int ret; - if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0)) + if (WARN_ON(INTEL_INFO(i915)->num_pipes == 0)) return -ENODEV; ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); if (ifbdev == NULL) return -ENOMEM; - drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs); + drm_fb_helper_prepare(&i915->drm, + &ifbdev->helper, &intel_fb_helper_funcs); - if (!intel_fbdev_init_bios(dev, ifbdev)) + if (!intel_fbdev_init_bios(i915, ifbdev)) ifbdev->preferred_bpp = 32; - ret = drm_fb_helper_init(dev, &ifbdev->helper, 4); + ret = drm_fb_helper_init(&i915->drm, &ifbdev->helper, 4); if (ret) { kfree(ifbdev); return ret; } - dev_priv->fbdev = ifbdev; - INIT_WORK(&dev_priv->fbdev_suspend_work, intel_fbdev_suspend_worker); + i915->fbdev = ifbdev; + INIT_WORK(&i915->fbdev_suspend_work, intel_fbdev_suspend_worker); drm_fb_helper_single_add_all_connectors(&ifbdev->helper); @@ -708,9 +705,9 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie) intel_fbdev_unregister(to_i915(ifbdev->helper.dev)); } -void intel_fbdev_initial_config_async(struct drm_device *dev) +void intel_fbdev_initial_config_async(struct drm_i915_private *i915) { - struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; + struct intel_fbdev *ifbdev = i915->fbdev; if (!ifbdev) return; @@ -728,23 +725,23 @@ static void intel_fbdev_sync(struct intel_fbdev *ifbdev) ifbdev->cookie = 0; } -void intel_fbdev_unregister(struct drm_i915_private *dev_priv) +void intel_fbdev_unregister(struct drm_i915_private *i915) { - struct intel_fbdev *ifbdev = dev_priv->fbdev; + struct intel_fbdev *ifbdev = i915->fbdev; if (!ifbdev) return; - cancel_work_sync(&dev_priv->fbdev_suspend_work); + cancel_work_sync(&i915->fbdev_suspend_work); if (!current_is_async()) intel_fbdev_sync(ifbdev); drm_fb_helper_unregister_fbi(&ifbdev->helper); } -void intel_fbdev_fini(struct drm_i915_private *dev_priv) +void intel_fbdev_fini(struct drm_i915_private *i915) { - struct intel_fbdev *ifbdev = fetch_and_zero(&dev_priv->fbdev); + struct intel_fbdev *ifbdev = fetch_and_zero(&i915->fbdev); if (!ifbdev) return; @@ -752,10 +749,10 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv) intel_fbdev_destroy(ifbdev); } -void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) +void intel_fbdev_set_suspend(struct drm_i915_private *i915, + int state, bool synchronous) { - struct drm_i915_private *dev_priv = to_i915(dev); - struct intel_fbdev *ifbdev = dev_priv->fbdev; + struct intel_fbdev *ifbdev = i915->fbdev; struct fb_info *info; if (!ifbdev || !ifbdev->vma) @@ -772,7 +769,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous * ourselves, so only flush outstanding work upon suspend! */ if (state != FBINFO_STATE_RUNNING) - flush_work(&dev_priv->fbdev_suspend_work); + flush_work(&i915->fbdev_suspend_work); console_lock(); } else { /* @@ -785,7 +782,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous /* Don't block our own workqueue as this can * be run in parallel with other i915.ko tasks. */ - schedule_work(&dev_priv->fbdev_suspend_work); + schedule_work(&i915->fbdev_suspend_work); return; } } @@ -814,9 +811,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev) drm_fb_helper_hotplug_event(&ifbdev->helper); } -void intel_fbdev_restore_mode(struct drm_device *dev) +void intel_fbdev_restore_mode(struct drm_i915_private *i915) { - struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; + struct intel_fbdev *ifbdev = i915->fbdev; if (!ifbdev) return; From patchwork Thu Sep 13 13:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10599545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C8B214E5 for ; Thu, 13 Sep 2018 13:16:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BFDE2AD6C for ; Thu, 13 Sep 2018 13:16:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 858B92AD8C; Thu, 13 Sep 2018 13:16:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 856042AD7E for ; Thu, 13 Sep 2018 13:16:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C7336E699; Thu, 13 Sep 2018 13:16:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5D9BE6E699 for ; Thu, 13 Sep 2018 13:16:49 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 13756927-1500050 for multiple; Thu, 13 Sep 2018 14:16:26 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 13 Sep 2018 14:16:28 +0100 Message-Id: <20180913131629.3978-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131629.3978-1-chris@chris-wilson.co.uk> References: <20180913131629.3978-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Disable displays at the user's request X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If the user passes i915.disable_display=1 we want to disable all the displays and associated HW like the powerwells on their behalf. Instead of short circuiting the HW probe, let it run and setup all the bookkeeping for the known HW. Afterwards, instead of taking over the BIOS fb and installing the fbcon, we shutdown all the outputs and teardown the bookkeeping, leaving us with no attached outputs or crtcs, and all the HW powered down. Open: wq flushes should be required but seem to deadlock the modprobe under CI. Signed-off-by: Chris Wilson Cc: Imre Deak Cc: Ville Syrjälä --- drivers/gpu/drm/i915/i915_drv.c | 52 +++++++++++++++++------- drivers/gpu/drm/i915/intel_device_info.c | 9 ++-- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a74de4428c79..f34a1f5b99e5 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -689,22 +689,8 @@ static int i915_load_modeset_init(struct drm_device *dev) intel_setup_overlay(dev_priv); - if (INTEL_INFO(dev_priv)->num_pipes == 0) - return 0; - - ret = intel_fbdev_init(dev_priv); - if (ret) - goto cleanup_gem; - - /* Only enable hotplug handling once the fbdev is fully set up. */ - intel_hpd_init(dev_priv); - return 0; -cleanup_gem: - if (i915_gem_suspend(dev_priv)) - DRM_ERROR("failed to idle hardware; continuing to unload!\n"); - i915_gem_fini(dev_priv); cleanup_modeset: intel_modeset_cleanup(dev); cleanup_irq: @@ -1366,6 +1352,17 @@ static void i915_driver_destroy(struct drm_i915_private *i915) pci_set_drvdata(pdev, NULL); } +static void disable_display(struct drm_i915_private *i915) +{ + drm_atomic_helper_shutdown(&i915->drm); + +#if 0 /* XXX flushes deadlock under modprobe??? */ + flush_workqueue(i915->modeset_wq); + flush_work(&i915->atomic_helper.free_work); + flush_scheduled_work(); +#endif +} + /** * i915_driver_load - setup chip and create an initial config * @pdev: PCI device @@ -1426,6 +1423,33 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret < 0) goto out_cleanup_hw; + /* + * After completing our HW probe; tear it all down again (at the + * user's request)! + * + * Along side the CRTCs and connectors, there is a medley of + * auxiliary HW which control various powerwells and interact with + * other state (such as the BIOS framebuffer occupying a portion + * of reserved memory). If the user tells us to run without any + * displays enabled, we still need to register all the display and + * auxiliary HW in order to safely disable them. + */ + if (i915_modparams.disable_display) { + DRM_INFO("Display disabled (module parameter)\n"); + disable_display(dev_priv); + mkwrite_device_info(dev_priv)->num_pipes = 0; + } + + if (INTEL_INFO(dev_priv)->num_pipes == 0) { + dev_priv->psr.sink_support = false; + drm_mode_config_cleanup(&dev_priv->drm); + driver.driver_features &= ~(DRIVER_MODESET | DRIVER_ATOMIC); + } + + /* Only enable hotplug handling once the fbdev is fully set up. */ + if (intel_fbdev_init(dev_priv) == 0) + intel_hpd_init(dev_priv); + i915_driver_register(dev_priv); intel_init_ipc(dev_priv); diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 0ef0c6448d53..e50ea5b2576b 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -776,12 +776,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info) info->num_sprites[pipe] = 1; } - if (i915_modparams.disable_display) { - DRM_INFO("Display disabled (module parameter)\n"); - info->num_pipes = 0; - } else if (info->num_pipes > 0 && - (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) && - HAS_PCH_SPLIT(dev_priv)) { + if (info->num_pipes > 0 && + (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) && + HAS_PCH_SPLIT(dev_priv)) { u32 fuse_strap = I915_READ(FUSE_STRAP); u32 sfuse_strap = I915_READ(SFUSE_STRAP); diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 84ebd8102215..9dd50c5ec558 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -668,7 +668,7 @@ int intel_fbdev_init(struct drm_i915_private *i915) struct intel_fbdev *ifbdev; int ret; - if (WARN_ON(INTEL_INFO(i915)->num_pipes == 0)) + if (INTEL_INFO(i915)->num_pipes == 0) return -ENODEV; ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); From patchwork Thu Sep 13 13:16:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10599541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2DA613BF for ; Thu, 13 Sep 2018 13:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2DD32AD86 for ; Thu, 13 Sep 2018 13:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 972C42AD8A; Thu, 13 Sep 2018 13:16:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 66F662AD7E for ; Thu, 13 Sep 2018 13:16:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 258226E690; Thu, 13 Sep 2018 13:16:40 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 316096E690 for ; Thu, 13 Sep 2018 13:16:38 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 13756928-1500050 for multiple; Thu, 13 Sep 2018 14:16:27 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 13 Sep 2018 14:16:29 +0100 Message-Id: <20180913131629.3978-4-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131629.3978-1-chris@chris-wilson.co.uk> References: <20180913131629.3978-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 4/4] HAX: force i915.disable_display=1 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP --- drivers/gpu/drm/i915/i915_params.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h index 6c4d4a21474b..3d9fa6bb8f2b 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -63,7 +63,7 @@ struct drm_printer; param(bool, load_detect_test, false) \ param(bool, force_reset_modeset_test, false) \ param(bool, error_capture, true) \ - param(bool, disable_display, false) \ + param(bool, disable_display, true) \ param(bool, verbose_state_checks, true) \ param(bool, nuclear_pageflip, false) \ param(bool, enable_dp_mst, true) \