From patchwork Mon Jun 29 20:44:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 6692031 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 07001C05AD for ; Mon, 29 Jun 2015 20:45:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1FDA62053D for ; Mon, 29 Jun 2015 20:45:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 25CBA205F2 for ; Mon, 29 Jun 2015 20:45:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE3A1720CB; Mon, 29 Jun 2015 13:44:54 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A3B66E960; Mon, 29 Jun 2015 13:44:52 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 29 Jun 2015 13:44:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,372,1432623600"; d="scan'208";a="596961180" Received: from rdvivi-talin.jf.intel.com ([10.7.196.149]) by orsmga003.jf.intel.com with ESMTP; 29 Jun 2015 13:44:50 -0700 From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Subject: [PATCH 4/4] drm/i915: fbdev dirty calls fb user dirty to invalidate frontbuffer. Date: Mon, 29 Jun 2015 13:44:46 -0700 Message-Id: <1435610686-2249-4-git-send-email-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435610686-2249-1-git-send-email-rodrigo.vivi@intel.com> References: <1435610686-2249-1-git-send-email-rodrigo.vivi@intel.com> Cc: dri-devel@lists.freedesktop.org, Rodrigo Vivi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have fb user dirty invalidating frontbuffer and we have the new fbdev dirty callback let's merge them. So it doesn't matter if fbcon throught fbdev or splash screen throught drm_ioctl_dirtyfb, in any case we will have frontbuffer properly invalidated and power savings features that rely on frontbuffer tracking will be able to work as expected. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_fbdev.c | 86 ++++++-------------------------------- 1 file changed, 13 insertions(+), 73 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 2a1724e..f1592c7 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -45,92 +45,32 @@ #include #include "i915_drv.h" -static int intel_fbdev_set_par(struct fb_info *info) +static void intel_fbdev_dirty(struct fb_info *info, u32 x1, u32 y1, + u32 x2, u32 y2) { struct drm_fb_helper *fb_helper = info->par; struct intel_fbdev *ifbdev = container_of(fb_helper, struct intel_fbdev, helper); - int ret; - - ret = drm_fb_helper_set_par(info); - - if (ret == 0) { - /* - * FIXME: fbdev presumes that all callbacks also work from - * atomic contexts and relies on that for emergency oops - * printing. KMS totally doesn't do that and the locking here is - * by far not the only place this goes wrong. Ignore this for - * now until we solve this for real. - */ - mutex_lock(&fb_helper->dev->struct_mutex); - ret = i915_gem_object_set_to_gtt_domain(ifbdev->fb->obj, - true); - mutex_unlock(&fb_helper->dev->struct_mutex); - } - - return ret; -} - -static int intel_fbdev_blank(int blank, struct fb_info *info) -{ - struct drm_fb_helper *fb_helper = info->par; - struct intel_fbdev *ifbdev = - container_of(fb_helper, struct intel_fbdev, helper); - int ret; - - ret = drm_fb_helper_blank(blank, info); - - if (ret == 0) { - /* - * FIXME: fbdev presumes that all callbacks also work from - * atomic contexts and relies on that for emergency oops - * printing. KMS totally doesn't do that and the locking here is - * by far not the only place this goes wrong. Ignore this for - * now until we solve this for real. - */ - mutex_lock(&fb_helper->dev->struct_mutex); - intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT); - mutex_unlock(&fb_helper->dev->struct_mutex); - } - - return ret; -} - -static int intel_fbdev_pan_display(struct fb_var_screeninfo *var, - struct fb_info *info) -{ - struct drm_fb_helper *fb_helper = info->par; - struct intel_fbdev *ifbdev = - container_of(fb_helper, struct intel_fbdev, helper); - - int ret; - ret = drm_fb_helper_pan_display(var, info); - - if (ret == 0) { - /* - * FIXME: fbdev presumes that all callbacks also work from - * atomic contexts and relies on that for emergency oops - * printing. KMS totally doesn't do that and the locking here is - * by far not the only place this goes wrong. Ignore this for - * now until we solve this for real. - */ - mutex_lock(&fb_helper->dev->struct_mutex); - intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT); - mutex_unlock(&fb_helper->dev->struct_mutex); - } + struct intel_framebuffer *intel_fb = ifbdev->fb; + struct drm_framebuffer *fb = &intel_fb->base; - return ret; + /* + * Our fb dirty callback is just used to invalidate frontbuffer + * entirely. So just fb reference is needed and rest is ignored. + */ + fb->funcs->dirty(fb, NULL, 0, 0, NULL, 1); } static struct fb_ops intelfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, - .fb_set_par = intel_fbdev_set_par, + .fb_set_par = drm_fb_helper_set_par, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, - .fb_pan_display = intel_fbdev_pan_display, - .fb_blank = intel_fbdev_blank, + .fb_dirty = intel_fbdev_dirty, + .fb_pan_display = drm_fb_helper_pan_display, + .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, .fb_debug_enter = drm_fb_helper_debug_enter, .fb_debug_leave = drm_fb_helper_debug_leave,