Commit ac467612 authored by Wambui Karuga's avatar Wambui Karuga Committed by Jani Nikula
Browse files

drm/i915/fbdev: convert to drm_device based logging.



Convert various instances of printk based drm logging macros to the
struct drm_device based logging macros in i915/display/intel_fbdev.c.
This also involves extracting the drm_i915_private device from various
intel types.

v2 by Jani:
- fix the final one too

Signed-off-by: default avatarWambui Karuga <wambui.karugax@gmail.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarWambui Karuga <wambui.karugax@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7081a49d20cc46b1b1144c83a4e21294d121d8a7.1583766715.git.jani.nikula@intel.com
parent 97ed48b5
Loading
Loading
Loading
Loading
+55 −41
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
	if (IS_ERR(obj))
		obj = i915_gem_object_create_shmem(dev_priv, size);
	if (IS_ERR(obj)) {
		DRM_ERROR("failed to allocate framebuffer\n");
		drm_err(&dev_priv->drm, "failed to allocate framebuffer\n");
		return PTR_ERR(obj);
	}

@@ -183,7 +183,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
	if (intel_fb &&
	    (sizes->fb_width > intel_fb->base.width ||
	     sizes->fb_height > intel_fb->base.height)) {
		DRM_DEBUG_KMS("BIOS fb too small (%dx%d), we require (%dx%d),"
		drm_dbg_kms(&dev_priv->drm,
			    "BIOS fb too small (%dx%d), we require (%dx%d),"
			    " releasing it\n",
			    intel_fb->base.width, intel_fb->base.height,
			    sizes->fb_width, sizes->fb_height);
@@ -191,13 +192,14 @@ static int intelfb_create(struct drm_fb_helper *helper,
		intel_fb = ifbdev->fb = NULL;
	}
	if (!intel_fb || drm_WARN_ON(dev, !intel_fb_obj(&intel_fb->base))) {
		DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n");
		drm_dbg_kms(&dev_priv->drm,
			    "no BIOS fb, allocating a new one\n");
		ret = intelfb_alloc(helper, sizes);
		if (ret)
			return ret;
		intel_fb = ifbdev->fb;
	} else {
		DRM_DEBUG_KMS("re-using BIOS fb\n");
		drm_dbg_kms(&dev_priv->drm, "re-using BIOS fb\n");
		prealloc = true;
		sizes->fb_width = intel_fb->base.width;
		sizes->fb_height = intel_fb->base.height;
@@ -220,7 +222,7 @@ static int intelfb_create(struct drm_fb_helper *helper,

	info = drm_fb_helper_alloc_fbi(helper);
	if (IS_ERR(info)) {
		DRM_ERROR("Failed to allocate fb_info\n");
		drm_err(&dev_priv->drm, "Failed to allocate fb_info\n");
		ret = PTR_ERR(info);
		goto out_unpin;
	}
@@ -240,7 +242,8 @@ static int intelfb_create(struct drm_fb_helper *helper,

	vaddr = i915_vma_pin_iomap(vma);
	if (IS_ERR(vaddr)) {
		DRM_ERROR("Failed to remap framebuffer into virtual memory\n");
		drm_err(&dev_priv->drm,
			"Failed to remap framebuffer into virtual memory\n");
		ret = PTR_ERR(vaddr);
		goto out_unpin;
	}
@@ -258,7 +261,7 @@ static int intelfb_create(struct drm_fb_helper *helper,

	/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */

	DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08x\n",
	drm_dbg_kms(&dev_priv->drm, "allocated %dx%d fb: 0x%08x\n",
		    ifbdev->fb->base.width, ifbdev->fb->base.height,
		    i915_ggtt_offset(vma));
	ifbdev->vma = vma;
@@ -309,6 +312,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
static bool intel_fbdev_init_bios(struct drm_device *dev,
				 struct intel_fbdev *ifbdev)
{
	struct drm_i915_private *i915 = to_i915(dev);
	struct intel_framebuffer *fb = NULL;
	struct drm_crtc *crtc;
	struct intel_crtc *intel_crtc;
@@ -321,13 +325,15 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
		intel_crtc = to_intel_crtc(crtc);

		if (!crtc->state->active || !obj) {
			DRM_DEBUG_KMS("pipe %c not active or no fb, skipping\n",
			drm_dbg_kms(&i915->drm,
				    "pipe %c not active or no fb, skipping\n",
				    pipe_name(intel_crtc->pipe));
			continue;
		}

		if (obj->base.size > max_size) {
			DRM_DEBUG_KMS("found possible fb from plane %c\n",
			drm_dbg_kms(&i915->drm,
				    "found possible fb from plane %c\n",
				    pipe_name(intel_crtc->pipe));
			fb = to_intel_framebuffer(crtc->primary->state->fb);
			max_size = obj->base.size;
@@ -335,7 +341,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
	}

	if (!fb) {
		DRM_DEBUG_KMS("no active fbs found, not using BIOS config\n");
		drm_dbg_kms(&i915->drm,
			    "no active fbs found, not using BIOS config\n");
		goto out;
	}

@@ -346,12 +353,13 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
		intel_crtc = to_intel_crtc(crtc);

		if (!crtc->state->active) {
			DRM_DEBUG_KMS("pipe %c not active, skipping\n",
			drm_dbg_kms(&i915->drm,
				    "pipe %c not active, skipping\n",
				    pipe_name(intel_crtc->pipe));
			continue;
		}

		DRM_DEBUG_KMS("checking plane %c for BIOS fb\n",
		drm_dbg_kms(&i915->drm, "checking plane %c for BIOS fb\n",
			    pipe_name(intel_crtc->pipe));

		/*
@@ -362,7 +370,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
		cur_size = crtc->state->adjusted_mode.crtc_hdisplay;
		cur_size = cur_size * fb->base.format->cpp[0];
		if (fb->base.pitches[0] < cur_size) {
			DRM_DEBUG_KMS("fb not wide enough for plane %c (%d vs %d)\n",
			drm_dbg_kms(&i915->drm,
				    "fb not wide enough for plane %c (%d vs %d)\n",
				    pipe_name(intel_crtc->pipe),
				    cur_size, fb->base.pitches[0]);
			fb = NULL;
@@ -372,7 +381,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
		cur_size = crtc->state->adjusted_mode.crtc_vdisplay;
		cur_size = intel_fb_align_height(&fb->base, 0, cur_size);
		cur_size *= fb->base.pitches[0];
		DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n",
		drm_dbg_kms(&i915->drm,
			    "pipe %c area: %dx%d, bpp: %d, size: %d\n",
			    pipe_name(intel_crtc->pipe),
			    crtc->state->adjusted_mode.crtc_hdisplay,
			    crtc->state->adjusted_mode.crtc_vdisplay,
@@ -380,20 +390,23 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
			    cur_size);

		if (cur_size > max_size) {
			DRM_DEBUG_KMS("fb not big enough for plane %c (%d vs %d)\n",
			drm_dbg_kms(&i915->drm,
				    "fb not big enough for plane %c (%d vs %d)\n",
				    pipe_name(intel_crtc->pipe),
				    cur_size, max_size);
			fb = NULL;
			break;
		}

		DRM_DEBUG_KMS("fb big enough for plane %c (%d >= %d)\n",
		drm_dbg_kms(&i915->drm,
			    "fb big enough for plane %c (%d >= %d)\n",
			    pipe_name(intel_crtc->pipe),
			    max_size, cur_size);
	}

	if (!fb) {
		DRM_DEBUG_KMS("BIOS fb not suitable for all pipes, not using\n");
		drm_dbg_kms(&i915->drm,
			    "BIOS fb not suitable for all pipes, not using\n");
		goto out;
	}

@@ -415,7 +428,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
	}


	DRM_DEBUG_KMS("using BIOS fb for initial console\n");
	drm_dbg_kms(&i915->drm, "using BIOS fb for initial console\n");
	return true;

out:
@@ -524,8 +537,9 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv)
 * processing, fbdev will perform a full connector reprobe if a hotplug event
 * was received while HPD was suspended.
 */
static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state)
static void intel_fbdev_hpd_set_suspend(struct drm_i915_private *i915, int state)
{
	struct intel_fbdev *ifbdev = i915->fbdev;
	bool send_hpd = false;

	mutex_lock(&ifbdev->hpd_lock);
@@ -535,7 +549,7 @@ static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state)
	mutex_unlock(&ifbdev->hpd_lock);

	if (send_hpd) {
		DRM_DEBUG_KMS("Handling delayed fbcon HPD event\n");
		drm_dbg_kms(&i915->drm, "Handling delayed fbcon HPD event\n");
		drm_fb_helper_hotplug_event(&ifbdev->helper);
	}
}
@@ -590,7 +604,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
	drm_fb_helper_set_suspend(&ifbdev->helper, state);
	console_unlock();

	intel_fbdev_hpd_set_suspend(ifbdev, state);
	intel_fbdev_hpd_set_suspend(dev_priv, state);
}

void intel_fbdev_output_poll_changed(struct drm_device *dev)