From patchwork Wed Sep 24 17:20:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 4968821 Return-Path: X-Original-To: patchwork-intel-gfx@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 7E4DBBEEA5 for ; Wed, 24 Sep 2014 17:20:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3302C20122 for ; Wed, 24 Sep 2014 17:20:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C62582022D for ; Wed, 24 Sep 2014 17:20:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E6136E665; Wed, 24 Sep 2014 10:20:51 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com [209.85.216.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A2496E667; Wed, 24 Sep 2014 10:20:50 -0700 (PDT) Received: by mail-qa0-f46.google.com with SMTP id x12so3437988qac.5 for ; Wed, 24 Sep 2014 10:20:49 -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=P3JQUaL4BNiEhBg296HdHENLKazEDSzKQjwf8yqnnKI=; b=WTwiI7IzXTTif1XemkAUmOLEmId6HpNP8VWNkK35waY5hpBE28RqEmgPmYAl25Ig4A SUocoKAae53dNdJYZ6tACC8OptUkNRSQoCuTvf+QyVrtCCPLsaQ3eyPEZJTIOYjiqtk8 g0+MffxxzFVAJgB+Zdo9U1yavtpVPFiv8KP6DJ96EZpCsoVZbsHngz0fSMwel4YJxmVE CK5o8mpBvaNXNvTPa1vQTMDui+8tDgFCGXakn7bFZMqoU4IexkmyWjhBkHFwvrVXOhj/ aMo7w8Qo4MfILyVRmgSobwDV5FGIxcJtF9B7bDE9ZlMMzY0J1DW8wrvDn/T3kQYdbi8s 5mCA== X-Received: by 10.224.129.66 with SMTP id n2mr11211216qas.34.1411579249721; Wed, 24 Sep 2014 10:20:49 -0700 (PDT) Received: from localhost.localdomain ([191.255.48.205]) by mx.google.com with ESMTPSA id l46sm13274852qgd.27.2014.09.24.10.20.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 10:20:48 -0700 (PDT) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Date: Wed, 24 Sep 2014 14:20:27 -0300 Message-Id: <1411579232-8668-6-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411579232-8668-1-git-send-email-gustavo@padovan.org> References: <1411579232-8668-1-git-send-email-gustavo@padovan.org> Cc: Daniel Stone , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH v3 06/11] drm/i915: split intel_crtc_page_flip() into check() and commit() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 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 a583abd..3cb092c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9641,23 +9641,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 @@ -9680,6 +9668,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; @@ -9823,6 +9832,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,