All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: dri-devel@lists.freedesktop.org
Cc: "Noralf Trønnes" <noralf@tronnes.org>,
	jy0922.shim@samsung.com, daniel.vetter@ffwll.ch,
	tomi.valkeinen@ti.com, sw0312.kim@samsung.com,
	inki.dae@samsung.com, hdegoede@redhat.com,
	kyungmin.park@samsung.com, bskeggs@redhat.com,
	rodrigo.vivi@intel.com, alexander.deucher@amd.com,
	linux@armlinux.org.uk, intel-gfx@lists.freedesktop.org,
	christian.koenig@amd.com, mark.yao@rock-chips.com
Subject: [PATCH 04/15] drm/amdgpu: Use drm_fb_helper_lastclose() and _poll_changed()
Date: Fri, 20 Oct 2017 01:02:02 +0200	[thread overview]
Message-ID: <20171019230213.63521-5-noralf@tronnes.org> (raw)
In-Reply-To: <20171019230213.63521-1-noralf@tronnes.org>

This driver can use drm_fb_helper_lastclose() in its .lastclose function.
It can also use drm_fb_helper_output_poll_changed() as its
.output_poll_changed callback.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  9 ++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      | 27 ---------------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c     |  4 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h    |  4 ----
 4 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 6ad243293a78..c41262865616 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -34,6 +34,7 @@
 #include <linux/pm_runtime.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
+#include <drm/drm_fb_helper.h>
 
 static void amdgpu_flip_callback(struct dma_fence *f, struct dma_fence_cb *cb)
 {
@@ -556,15 +557,9 @@ amdgpu_user_framebuffer_create(struct drm_device *dev,
 	return &amdgpu_fb->base;
 }
 
-static void amdgpu_output_poll_changed(struct drm_device *dev)
-{
-	struct amdgpu_device *adev = dev->dev_private;
-	amdgpu_fb_output_poll_changed(adev);
-}
-
 const struct drm_mode_config_funcs amdgpu_mode_funcs = {
 	.fb_create = amdgpu_user_framebuffer_create,
-	.output_poll_changed = amdgpu_output_poll_changed
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 };
 
 static const struct drm_prop_enum_list amdgpu_underscan_enum_list[] =
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 562930b17a6d..e38bf856f48b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -288,12 +288,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 	return ret;
 }
 
-void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev)
-{
-	if (adev->mode_info.rfbdev)
-		drm_fb_helper_hotplug_event(&adev->mode_info.rfbdev->helper);
-}
-
 static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev)
 {
 	struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
@@ -397,24 +391,3 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
 		return true;
 	return false;
 }
-
-void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev)
-{
-	struct amdgpu_fbdev *afbdev;
-	struct drm_fb_helper *fb_helper;
-	int ret;
-
-	if (!adev)
-		return;
-
-	afbdev = adev->mode_info.rfbdev;
-
-	if (!afbdev)
-		return;
-
-	fb_helper = &afbdev->helper;
-
-	ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
-	if (ret)
-		DRM_DEBUG("failed to restore crtc mode\n");
-}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 4fd06f8d9768..db1e320be54a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -785,9 +785,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
  */
 void amdgpu_driver_lastclose_kms(struct drm_device *dev)
 {
-	struct amdgpu_device *adev = dev->dev_private;
-
-	amdgpu_fbdev_restore_mode(adev);
+	drm_fb_helper_lastclose(dev);
 	vga_switcheroo_process_delayed_switch();
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 2af2678ddaf6..9e9cd0e1c558 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -570,10 +570,6 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev);
 void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state);
 int amdgpu_fbdev_total_size(struct amdgpu_device *adev);
 bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj);
-void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev);
-
-void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev);
-
 
 int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tiled);
 
-- 
2.14.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-10-19 23:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 23:01 [PATCH 00/15] drm/fb-helper: Add .last_close and .output_poll_changed helpers Noralf Trønnes
2017-10-19 23:01 ` [PATCH 01/15] drm/fb-helper: Handle function NULL argument Noralf Trønnes
2017-10-19 23:02 ` [PATCH 02/15] drm: Add drm_device->drm_fb_helper_private pointer Noralf Trønnes
2017-10-20 13:29   ` Daniel Vetter
2017-10-20 13:52   ` Ville Syrjälä
2017-10-20 15:44     ` Noralf Trønnes
2017-10-20 16:00       ` Ville Syrjälä
2017-10-20 17:11         ` Noralf Trønnes
2017-10-30  9:25           ` Daniel Vetter
2017-10-19 23:02 ` [PATCH 03/15] drm/fb-helper: Add .last_close and .output_poll_changed helpers Noralf Trønnes
2017-10-19 23:02 ` Noralf Trønnes [this message]
2017-10-19 23:02 ` [PATCH 05/15] drm/armada: Use drm_fb_helper_lastclose() and _poll_changed() Noralf Trønnes
2017-10-23 10:10   ` Russell King - ARM Linux
2017-10-19 23:02 ` [PATCH 06/15] drm/exynos: " Noralf Trønnes
2017-10-19 23:02 ` [PATCH 07/15] drm/gma500: " Noralf Trønnes
2017-10-19 23:02 ` [PATCH 08/15] drm/i915: Use drm_fb_helper_output_poll_changed() Noralf Trønnes
2017-10-19 23:02 ` [PATCH 09/15] drm/msm: Use drm_fb_helper_lastclose() and _poll_changed() Noralf Trønnes
2017-10-19 23:02 ` [PATCH 10/15] drm/nouveau: Use drm_fb_helper_output_poll_changed() Noralf Trønnes
2017-10-19 23:02 ` [PATCH 11/15] drm/omap: Use drm_fb_helper_lastclose() and _poll_changed() Noralf Trønnes
2017-10-19 23:02 ` [PATCH 12/15] drm/radeon: " Noralf Trønnes
2017-10-19 23:02 ` [PATCH 13/15] drm/rockchip: " Noralf Trønnes
2017-10-19 23:02 ` [PATCH 14/15] drm/tegra: " Noralf Trønnes
2017-10-19 23:02 ` [PATCH 15/15] staging: vboxvideo: Use drm_fb_helper_lastclose() Noralf Trønnes
2017-10-23  6:43   ` Hans de Goede
2017-10-19 23:46 ` ✓ Fi.CI.BAT: success for drm/fb-helper: Add .last_close and .output_poll_changed helpers Patchwork
2017-10-20  1:02 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171019230213.63521-5-noralf@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=alexander.deucher@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=inki.dae@samsung.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jy0922.shim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux@armlinux.org.uk \
    --cc=mark.yao@rock-chips.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sw0312.kim@samsung.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.