From patchwork Thu Mar 28 12:04:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 2356341 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 588B23FD40 for ; Thu, 28 Mar 2013 12:17:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44D5BE5F5B for ; Thu, 28 Mar 2013 05:17:01 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 617BEE5CB4 for ; Thu, 28 Mar 2013 05:05:01 -0700 (PDT) Received: by mail-pa0-f41.google.com with SMTP id kx1so2209246pab.0 for ; Thu, 28 Mar 2013 05:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=QyJ85nWUBH/dsbYJPXYo5zn/pvaFGyNr99CD7s2rV0U=; b=g11xlpxVp7LcDjdfm2GCERMbiVQ1VtRdhtxB9/M9vmeBkOE+o7m8Qh4JZoWspb9ob6 lrk8bePgk1Qc1N8CizL8b55puXssRua+LUdEFXgHsCI/EkUWBjh3/MDgYf7k7AmI2Q7w g8niWNK9/c6uMNGM4SCEvqtdu2qLMDAmLVmeRAkg+LrVweoi1/97Q3gixpm6Uf9yX30Y mnf81oRdiHlTAwvou4Up7Q31R6UiPWuHr4ryd26GICOVWh1IQJgjDNJv+W3TtUpsGj2h 0dKx3JzSwVPUh4GcMIt7sg/Tl5BhLRVZ5JUran+nrqY89D7lW4WHI4fL0KLMEdyMvCHW qCnA== X-Received: by 10.68.4.97 with SMTP id j1mr34647816pbj.157.1364472300795; Thu, 28 Mar 2013 05:05:00 -0700 (PDT) Received: from mcgrof@gmail.com (c-24-7-61-223.hsd1.ca.comcast.net. [24.7.61.223]) by mx.google.com with ESMTPS id lb8sm27502440pab.13.2013.03.28.05.04.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Mar 2013 05:04:59 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Thu, 28 Mar 2013 05:04:55 -0700 From: "Luis R. Rodriguez" To: FlorianSchandinat@gmx.de Subject: [PATCH 4/4] fb: add helpers to enable and test for the skip_vt_switch Date: Thu, 28 Mar 2013 05:04:30 -0700 Message-Id: <1364472270-9297-5-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com> References: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com> X-Mailman-Approved-At: Thu, 28 Mar 2013 05:12:04 -0700 Cc: linux-fbdev@vger.kernel.org, backports@vger.kernel.org, "Luis R. Rodriguez" , daniel.vetter@ffwll.ch, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org, julia.lawall@lip6.fr, dri-devel@lists.freedesktop.org, cocci@systeme.lip6.fr X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: "Luis R. Rodriguez" This adds helpers to enable and test for the skip_vt_switch. This gets us two things: 1) It allows us to require less collateral evolutions should we need changes on the fb_info data structure later (perhaps a bitmap flag). 2) Allows this feature to be backported with 0 delta required on the upstream drivers, we'd just require the static inline to do a no-op. 1) may be worth while considering, 2) is a new consideration I'm trying to get others to evaluate to help with automatically backporting the Linux kernel. This is the first time I am aware someone argues for it. Cc: cocci@systeme.lip6.fr Cc: backports@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Julia Lawall Cc: Rodrigo Vivi Cc: Daniel Vetter Cc: Jesse Barnes Cc: Rafael J. Wysocki Signed-off-by: Luis R. Rodriguez --- drivers/gpu/drm/i915/intel_fb.c | 2 +- drivers/video/fbmem.c | 2 +- include/linux/fb.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 8d81c929..c0f306c 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c @@ -151,7 +151,7 @@ static int intelfb_create(struct drm_fb_helper *helper, info->screen_size = size; /* This driver doesn't need a VT switch to restore the mode on resume */ - info->skip_vt_switch = true; + fb_enable_skip_vt_switch(info); drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height); diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index ccd44b0..daffadc 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1645,7 +1645,7 @@ static int do_register_framebuffer(struct fb_info *fb_info) if (!fb_info->modelist.prev || !fb_info->modelist.next) INIT_LIST_HEAD(&fb_info->modelist); - if (fb_info->skip_vt_switch) + if (fb_skip_vt_switch_isset(fb_info)) pm_vt_switch_required(fb_info->dev, false); else pm_vt_switch_required(fb_info->dev, true); diff --git a/include/linux/fb.h b/include/linux/fb.h index d49c60f..d534966 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -505,6 +505,16 @@ struct fb_info { bool skip_vt_switch; /* no VT switch on suspend/resume required */ }; +static inline void fb_enable_skip_vt_switch(struct fb_info *info) +{ + info->skip_vt_switch = true; +} + +static inline bool fb_skip_vt_switch_isset(struct fb_info *info) +{ + return info->skip_vt_switch; +} + static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct) + max_num * sizeof(struct aperture), GFP_KERNEL);