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

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
...@@ -146,7 +146,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper, ...@@ -146,7 +146,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
if (IS_ERR(obj)) if (IS_ERR(obj))
obj = i915_gem_object_create_shmem(dev_priv, size); obj = i915_gem_object_create_shmem(dev_priv, size);
if (IS_ERR(obj)) { 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); return PTR_ERR(obj);
} }
...@@ -183,7 +183,8 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -183,7 +183,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
if (intel_fb && if (intel_fb &&
(sizes->fb_width > intel_fb->base.width || (sizes->fb_width > intel_fb->base.width ||
sizes->fb_height > intel_fb->base.height)) { 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", " releasing it\n",
intel_fb->base.width, intel_fb->base.height, intel_fb->base.width, intel_fb->base.height,
sizes->fb_width, sizes->fb_height); sizes->fb_width, sizes->fb_height);
...@@ -191,13 +192,14 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -191,13 +192,14 @@ static int intelfb_create(struct drm_fb_helper *helper,
intel_fb = ifbdev->fb = NULL; intel_fb = ifbdev->fb = NULL;
} }
if (!intel_fb || drm_WARN_ON(dev, !intel_fb_obj(&intel_fb->base))) { 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); ret = intelfb_alloc(helper, sizes);
if (ret) if (ret)
return ret; return ret;
intel_fb = ifbdev->fb; intel_fb = ifbdev->fb;
} else { } else {
DRM_DEBUG_KMS("re-using BIOS fb\n"); drm_dbg_kms(&dev_priv->drm, "re-using BIOS fb\n");
prealloc = true; prealloc = true;
sizes->fb_width = intel_fb->base.width; sizes->fb_width = intel_fb->base.width;
sizes->fb_height = intel_fb->base.height; sizes->fb_height = intel_fb->base.height;
...@@ -220,7 +222,7 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -220,7 +222,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
info = drm_fb_helper_alloc_fbi(helper); info = drm_fb_helper_alloc_fbi(helper);
if (IS_ERR(info)) { 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); ret = PTR_ERR(info);
goto out_unpin; goto out_unpin;
} }
...@@ -240,7 +242,8 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -240,7 +242,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
vaddr = i915_vma_pin_iomap(vma); vaddr = i915_vma_pin_iomap(vma);
if (IS_ERR(vaddr)) { 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); ret = PTR_ERR(vaddr);
goto out_unpin; goto out_unpin;
} }
...@@ -258,7 +261,7 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -258,7 +261,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ /* 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, ifbdev->fb->base.width, ifbdev->fb->base.height,
i915_ggtt_offset(vma)); i915_ggtt_offset(vma));
ifbdev->vma = vma; ifbdev->vma = vma;
...@@ -309,6 +312,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev) ...@@ -309,6 +312,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
static bool intel_fbdev_init_bios(struct drm_device *dev, static bool intel_fbdev_init_bios(struct drm_device *dev,
struct intel_fbdev *ifbdev) struct intel_fbdev *ifbdev)
{ {
struct drm_i915_private *i915 = to_i915(dev);
struct intel_framebuffer *fb = NULL; struct intel_framebuffer *fb = NULL;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct intel_crtc *intel_crtc; struct intel_crtc *intel_crtc;
...@@ -321,13 +325,15 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -321,13 +325,15 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
intel_crtc = to_intel_crtc(crtc); intel_crtc = to_intel_crtc(crtc);
if (!crtc->state->active || !obj) { 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)); pipe_name(intel_crtc->pipe));
continue; continue;
} }
if (obj->base.size > max_size) { 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)); pipe_name(intel_crtc->pipe));
fb = to_intel_framebuffer(crtc->primary->state->fb); fb = to_intel_framebuffer(crtc->primary->state->fb);
max_size = obj->base.size; max_size = obj->base.size;
...@@ -335,7 +341,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -335,7 +341,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
} }
if (!fb) { 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; goto out;
} }
...@@ -346,12 +353,13 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -346,12 +353,13 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
intel_crtc = to_intel_crtc(crtc); intel_crtc = to_intel_crtc(crtc);
if (!crtc->state->active) { 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)); pipe_name(intel_crtc->pipe));
continue; 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)); pipe_name(intel_crtc->pipe));
/* /*
...@@ -362,7 +370,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -362,7 +370,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
cur_size = crtc->state->adjusted_mode.crtc_hdisplay; cur_size = crtc->state->adjusted_mode.crtc_hdisplay;
cur_size = cur_size * fb->base.format->cpp[0]; cur_size = cur_size * fb->base.format->cpp[0];
if (fb->base.pitches[0] < cur_size) { 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), pipe_name(intel_crtc->pipe),
cur_size, fb->base.pitches[0]); cur_size, fb->base.pitches[0]);
fb = NULL; fb = NULL;
...@@ -372,7 +381,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -372,7 +381,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
cur_size = crtc->state->adjusted_mode.crtc_vdisplay; cur_size = crtc->state->adjusted_mode.crtc_vdisplay;
cur_size = intel_fb_align_height(&fb->base, 0, cur_size); cur_size = intel_fb_align_height(&fb->base, 0, cur_size);
cur_size *= fb->base.pitches[0]; 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), pipe_name(intel_crtc->pipe),
crtc->state->adjusted_mode.crtc_hdisplay, crtc->state->adjusted_mode.crtc_hdisplay,
crtc->state->adjusted_mode.crtc_vdisplay, crtc->state->adjusted_mode.crtc_vdisplay,
...@@ -380,20 +390,23 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -380,20 +390,23 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
cur_size); cur_size);
if (cur_size > max_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), pipe_name(intel_crtc->pipe),
cur_size, max_size); cur_size, max_size);
fb = NULL; fb = NULL;
break; 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), pipe_name(intel_crtc->pipe),
max_size, cur_size); max_size, cur_size);
} }
if (!fb) { 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; goto out;
} }
...@@ -415,7 +428,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ...@@ -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; return true;
out: out:
...@@ -524,8 +537,9 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv) ...@@ -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 * processing, fbdev will perform a full connector reprobe if a hotplug event
* was received while HPD was suspended. * 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; bool send_hpd = false;
mutex_lock(&ifbdev->hpd_lock); mutex_lock(&ifbdev->hpd_lock);
...@@ -535,7 +549,7 @@ static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state) ...@@ -535,7 +549,7 @@ static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state)
mutex_unlock(&ifbdev->hpd_lock); mutex_unlock(&ifbdev->hpd_lock);
if (send_hpd) { 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); drm_fb_helper_hotplug_event(&ifbdev->helper);
} }
} }
...@@ -590,7 +604,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous ...@@ -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); drm_fb_helper_set_suspend(&ifbdev->helper, state);
console_unlock(); 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) void intel_fbdev_output_poll_changed(struct drm_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment