From patchwork Mon Jun 3 13:10:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 2652231 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id BB1CFDF24C for ; Mon, 3 Jun 2013 13:12:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 76793E614A for ; Mon, 3 Jun 2013 06:12:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F0E2E6147; Mon, 3 Jun 2013 06:10:55 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 Jun 2013 06:10:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,792,1363158000"; d="scan'208";a="347277690" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by fmsmga002.fm.intel.com with SMTP; 03 Jun 2013 06:10:52 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 03 Jun 2013 16:10:52 +0300 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Date: Mon, 3 Jun 2013 16:10:40 +0300 Message-Id: <1370265042-13969-2-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1370265042-13969-1-git-send-email-ville.syrjala@linux.intel.com> References: <1370265042-13969-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH v2 1/3] drm: Add drm_plane_force_disable() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä drm_plane_force_disable() will forcibly disable the plane even if user had previously requested the plane to be enabled. This can be used to force planes to be off when restoring the fbdev mode. The code was simply pulled from drm_framebuffer_remove(), which now calls the new function as well. v2: Check plane->fb in drm_plane_force_disable(), drop bogus comment about disabling crtc Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_crtc.c | 29 +++++++++++++++++++---------- include/drm/drm_crtc.h | 1 + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index e7e9242..865ebfe 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -569,16 +569,8 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb) } list_for_each_entry(plane, &dev->mode_config.plane_list, head) { - if (plane->fb == fb) { - /* should turn off the crtc */ - ret = plane->funcs->disable_plane(plane); - if (ret) - DRM_ERROR("failed to disable plane with busy fb\n"); - /* disconnect the plane from the fb and crtc: */ - __drm_framebuffer_unreference(plane->fb); - plane->fb = NULL; - plane->crtc = NULL; - } + if (plane->fb == fb) + drm_plane_force_disable(plane); } drm_modeset_unlock_all(dev); } @@ -867,6 +859,23 @@ void drm_plane_cleanup(struct drm_plane *plane) } EXPORT_SYMBOL(drm_plane_cleanup); +void drm_plane_force_disable(struct drm_plane *plane) +{ + int ret; + + if (!plane->fb) + return; + + ret = plane->funcs->disable_plane(plane); + if (ret) + DRM_ERROR("failed to disable plane with busy fb\n"); + /* disconnect the plane from the fb and crtc: */ + __drm_framebuffer_unreference(plane->fb); + plane->fb = NULL; + plane->crtc = NULL; +} +EXPORT_SYMBOL(drm_plane_force_disable); + /** * drm_mode_create - create a new display mode * @dev: DRM device diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index adb3f9b..db7a885 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -894,6 +894,7 @@ extern int drm_plane_init(struct drm_device *dev, const uint32_t *formats, uint32_t format_count, bool priv); extern void drm_plane_cleanup(struct drm_plane *plane); +extern void drm_plane_force_disable(struct drm_plane *plane); extern void drm_encoder_cleanup(struct drm_encoder *encoder);