From patchwork Thu Apr 8 22:02:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 91526 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o38M3oYZ032098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 8 Apr 2010 22:04:26 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nzzo2-0000Ez-Nh; Thu, 08 Apr 2010 22:02:34 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nzzo2-0000Er-6F for dri-devel@lists.sourceforge.net; Thu, 08 Apr 2010 22:02:34 +0000 Received-SPF: pass (sfi-mx-2.v28.ch3.sourceforge.com: domain of virtuousgeek.org designates 69.89.21.11 as permitted sender) client-ip=69.89.21.11; envelope-from=jbarnes@virtuousgeek.org; helo=outbound-mail-01.bluehost.com; Received: from cpoproxy1-pub.bluehost.com ([69.89.21.11] helo=outbound-mail-01.bluehost.com) by sfi-mx-2.v28.ch3.sourceforge.com with smtp (Exim 4.69) id 1Nzznz-0000H2-Qz for dri-devel@lists.sourceforge.net; Thu, 08 Apr 2010 22:02:34 +0000 Received: (qmail 1666 invoked by uid 0); 8 Apr 2010 22:02:25 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by cpoproxy1.bluehost.com with SMTP; 8 Apr 2010 22:02:25 -0000 Received: from [75.110.194.140] (helo=localhost) by box514.bluehost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1Nzznt-00020e-D7 for dri-devel@lists.sourceforge.net; Thu, 08 Apr 2010 16:02:25 -0600 Date: Thu, 8 Apr 2010 15:02:23 -0700 From: Jesse Barnes To: dri-devel@lists.sourceforge.net Subject: [PATCH] drm: add locked variant of drm_fb_helper_force_kernel_mode Message-ID: <20100408150223.74b3539e@virtuousgeek.org> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 75.110.194.140 authed with jbarnes@virtuousgeek.org} X-Spam-Score: -1.0 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.5 AWL AWL: From: address is in the auto white-list X-Headers-End: 1Nzznz-0000H2-Qz X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 08 Apr 2010 22:04:26 +0000 (UTC) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 6929f5b..962eadb 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,11 +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(); + drm_fb_helper_force_kernel_mode_locked(); return 0; } EXPORT_SYMBOL(drm_fb_helper_panic);