[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100412090506.26cf7179@virtuousgeek.org>
Date: Mon, 12 Apr 2010 09:05:06 -0700
From: Jesse Barnes <jbarnes@...tuousgeek.org>
To: Dave Airlie <airlied@...il.com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
James Simmons <jsimmons@...radead.org>
Subject: Re: [PATCH] drm: add locked variant of
drm_fb_helper_force_kernel_mode
On Mon, 12 Apr 2010 10:05:00 +1000
Dave Airlie <airlied@...il.com> wrote:
> On Sat, Apr 10, 2010 at 8:11 AM, Jesse Barnes <jbarnes@...tuousgeek.org> wrote:
> > Needed for panic and kdb, since we need to avoid taking the mode_config
> > mutex.
>
> One comment below.
Updated patch below.
--
Jesse Barnes, Intel Open Source Technology Center
>From 7e972aa6a2f432b8fd04cb5d1a51f4df2fddea62 Mon Sep 17 00:00:00 2001
From: Jesse Barnes <jbarnes@...tuousgeek.org>
Date: Thu, 8 Apr 2010 14:40:27 -0700
Subject: [PATCH] drm: add locked variant of drm_fb_helper_force_kernel_mode
Needed for panic and kdb, since we need to avoid taking the mode_config
mutex.
Signed-off-by: Jesse Barnes <jbarnes@...tuousgeek.org>
---
drivers/gpu/drm/drm_fb_helper.c | 43 ++++++++++++++++++++++++++++++++------
1 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6929f5b..be0b95a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -242,18 +242,22 @@ static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
return 0;
}
-bool drm_fb_helper_force_kernel_mode(void)
+bool drm_fb_helper_force_kernel_mode_locked(void)
{
int i = 0;
bool ret, error = false;
struct drm_fb_helper *helper;
-
- if (list_empty(&kernel_fb_helper_list))
- return false;
+ struct drm_mode_set *mode_set;
+ struct drm_crtc *crtc;
list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
for (i = 0; i < helper->crtc_count; i++) {
- struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set;
+ mode_set = &helper->crtc_info[i].mode_set;
+ crtc = helper->crtc_info[i].mode_set.crtc;
+
+ if (!crtc->enabled)
+ continue;
+
ret = drm_crtc_helper_set_config(mode_set);
if (ret)
error = true;
@@ -262,12 +266,37 @@ bool drm_fb_helper_force_kernel_mode(void)
return error;
}
+bool drm_fb_helper_force_kernel_mode(void)
+{
+ bool ret;
+ struct drm_device *dev;
+ struct drm_fb_helper *helper;
+ struct drm_mode_set *mode_set;
+
+ if (list_empty(&kernel_fb_helper_list)) {
+ DRM_DEBUG_KMS("no fb helper list??\n");
+ return false;
+ }
+
+ /* Get the DRM device */
+ helper = list_first_entry(&kernel_fb_helper_list,
+ struct drm_fb_helper,
+ kernel_fb_list);
+ mode_set = &helper->crtc_info[0].mode_set;
+ dev = mode_set->crtc->dev;
+
+ mutex_lock(&dev->mode_config.mutex);
+ ret = drm_fb_helper_force_kernel_mode_locked();
+ mutex_unlock(&dev->mode_config.mutex);
+
+ return ret;
+}
+
int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
void *panic_str)
{
DRM_ERROR("panic occurred, switching back to text console\n");
- return drm_fb_helper_force_kernel_mode();
- return 0;
+ return drm_fb_helper_force_kernel_mode_locked();
}
EXPORT_SYMBOL(drm_fb_helper_panic);
--
1.6.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists