From patchwork Mon Sep 22 22:23:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 4951001 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AD24ABEEA5 for ; Mon, 22 Sep 2014 22:23:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1DB02024D for ; Mon, 22 Sep 2014 22:23:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id F16C62024C for ; Mon, 22 Sep 2014 22:23:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F4E26E503; Mon, 22 Sep 2014 15:23:33 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f177.google.com (mail-qc0-f177.google.com [209.85.216.177]) by gabe.freedesktop.org (Postfix) with ESMTP id E69DF6E508; Mon, 22 Sep 2014 15:23:31 -0700 (PDT) Received: by mail-qc0-f177.google.com with SMTP id x13so915591qcv.36 for ; Mon, 22 Sep 2014 15:23:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lD1fZ4y8ppE4FXYauLKccbFoFiJ+GznwVyqsi1MC47o=; b=ZjSYI+fh9MW8Rj8s2eX7TXq6WlswO/jawWwhEtTw9lAGgdsaody18G/fQzFcomWYch FfJ4jsIX1vcHrdHUgJwWtpu+j5Fg9YYE8nqFJVgrj48zvrJ7tCoKJWAkROXFHZVSMcdm FobZIV+rzIKaNtzfts2+hUKFcMz+kniJZpenmt5wd2bs5SQKq9r0J765manGeAj3oAE8 7LcSJ/+umqYmPNolXsjnbGROBxrPzIFLYZUo/a9vjQF7O2MLOMDeWyY9ZAnxx5TCmPna RPRgFG8Wr3kbPgiEP3pdsdIG+YK5148SXNoR/smT/+Hb0GZ/JFLzcCVPkWZ/WfZ3qbMo S8Cw== X-Received: by 10.224.80.131 with SMTP id t3mr25988325qak.35.1411424611559; Mon, 22 Sep 2014 15:23:31 -0700 (PDT) Received: from localhost.localdomain ([179.110.222.152]) by mx.google.com with ESMTPSA id o7sm8903631qay.4.2014.09.22.15.23.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Sep 2014 15:23:30 -0700 (PDT) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2 05/10] drm/i915: split intel_crtc_page_flip() into check() and commit() Date: Mon, 22 Sep 2014 19:23:12 -0300 Message-Id: <1411424597-31662-5-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411424597-31662-1-git-send-email-gustavo@padovan.org> References: <1411424597-31662-1-git-send-email-gustavo@padovan.org> Cc: Daniel Stone , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-5.2 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 From: Daniel Stone Start the work of splitting the intel_crtc_page_flip() for later use by the atomic modesetting API. Signed-off-by: Daniel Stone Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 417b74d..f9ab8aa 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9543,23 +9543,11 @@ void intel_check_page_flip(struct drm_device *dev, int pipe) spin_unlock(&dev->event_lock); } -static int intel_crtc_page_flip(struct drm_crtc *crtc, - struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event, - uint32_t page_flip_flags) +static int intel_crtc_check_page_flip(struct drm_crtc *crtc, + struct drm_framebuffer *fb) { struct drm_device *dev = crtc->dev; - struct drm_i915_private *dev_priv = dev->dev_private; struct drm_framebuffer *old_fb = crtc->primary->fb; - struct drm_i915_gem_object *obj = intel_fb_obj(fb); - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - enum pipe pipe = intel_crtc->pipe; - struct intel_unpin_work *work; - struct intel_engine_cs *ring; - int ret; - - //trigger software GT busyness calculation - gen8_flip_interrupt(dev); /* * drm_mode_page_flip_ioctl() should already catch this, but double @@ -9582,6 +9570,27 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, fb->pitches[0] != crtc->primary->fb->pitches[0])) return -EINVAL; + return 0; +} + +static int intel_crtc_commit_page_flip(struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event, + uint32_t page_flip_flags) +{ + struct drm_device *dev = crtc->dev; + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_framebuffer *old_fb = crtc->primary->fb; + struct drm_i915_gem_object *obj = intel_fb_obj(fb); + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + enum pipe pipe = intel_crtc->pipe; + struct intel_unpin_work *work; + struct intel_engine_cs *ring; + int ret; + + /* trigger software GT busyness calculation */ + gen8_flip_interrupt(dev); + if (i915_terminally_wedged(&dev_priv->gpu_error)) goto out_hang; @@ -9725,6 +9734,20 @@ out_hang: return ret; } +static int intel_crtc_page_flip(struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event, + uint32_t page_flip_flags) +{ + int ret; + + ret = intel_crtc_check_page_flip(crtc, fb); + if (ret) + return ret; + + return intel_crtc_commit_page_flip(crtc, fb, event, page_flip_flags); +} + static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut,