From patchwork Sat Apr 25 08:08:26 2037 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 63655 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAU9Qa1e005106 for ; Mon, 30 Nov 2009 09:26:36 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77BDC9EB53; Mon, 30 Nov 2009 01:26:36 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.ffwll.ch (cable-static-49-187.intergga.ch [157.161.49.187]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C7479EB49 for ; Mon, 30 Nov 2009 01:26:33 -0800 (PST) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 1B87A20C21B; Mon, 30 Nov 2009 10:26:33 +0100 (CET) X-Spam-ASN: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on orange.ffwll.ch X-Spam-Level: X-Spam-Hammy: 0.000-+--struct, 0.000-+--signedoffby, 0.000-+--signed-off-by X-Spam-Status: No, score=-1.2 required=6.0 tests=ALL_TRUSTED,BAYES_00, FH_DATE_PAST_20XX autolearn=no version=3.2.5 X-Spam-Spammy: 0.966-+--H*Ad:U*daniel.vetter, 0.964-+--H*m:ffwll, 0.950-+--H*r:mail.ffwll.ch Received: from biene (unknown [192.168.23.129]) by mail.ffwll.ch (Postfix) with ESMTP id EC64020C156; Mon, 30 Nov 2009 10:26:23 +0100 (CET) Received: from daniel by biene with local (Exim 4.69) (envelope-from ) id 2JlAzX-0001M6-2Q; Sat, 25 Apr 2037 10:08:39 +0200 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Sat, 25 Apr 2037 10:08:26 +0200 Message-Id: <06891ed1f1ed308aecf6544268ed86bb61a393f9.2124259224.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: References: In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 1/2] drm/i915: overlay: extract some duplicated code X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 890274f..d18f563 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -413,12 +413,28 @@ static int intel_overlay_off(struct intel_overlay *overlay) if (ret != 0) return ret; - overlay->active = 0; overlay->hw_wedged = 0; overlay->last_flip_req = 0; return ret; } +static void intel_overlay_off_tail(struct intel_overlay *overlay) +{ + struct drm_gem_object *obj; + + /* never have the overlay hw on without showing a frame */ + BUG_ON(!overlay->vid_bo); + obj = overlay->vid_bo->obj; + + i915_gem_object_unpin(obj); + drm_gem_object_unreference(obj); + overlay->vid_bo = NULL; + + overlay->crtc->overlay = NULL; + overlay->crtc = NULL; + overlay->active = 0; +} + /* recover from an interruption due to a signal * We have to be careful not to repeat work forever an make forward progess. */ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, @@ -476,17 +492,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, return ret; case SWITCH_OFF_STAGE_2: - BUG_ON(!overlay->vid_bo); - obj = overlay->vid_bo->obj; - - i915_gem_object_unpin(obj); - drm_gem_object_unreference(obj); - overlay->vid_bo = NULL; - - overlay->crtc->overlay = NULL; - overlay->crtc = NULL; - - overlay->active = 0; + intel_overlay_off_tail(overlay); break; default: BUG_ON(overlay->hw_wedged != NEEDS_WAIT_FOR_FLIP); @@ -869,7 +875,6 @@ int intel_overlay_switch_off(struct intel_overlay *overlay) { int ret; struct overlay_registers *regs; - struct drm_gem_object *obj; struct drm_device *dev = overlay->dev; BUG_ON(!mutex_is_locked(&dev->struct_mutex)); @@ -897,16 +902,7 @@ int intel_overlay_switch_off(struct intel_overlay *overlay) if (ret != 0) return ret; - /* never have the overlay hw on without showing a frame */ - BUG_ON(!overlay->vid_bo); - obj = overlay->vid_bo->obj; - - i915_gem_object_unpin(obj); - drm_gem_object_unreference(obj); - overlay->vid_bo = NULL; - - overlay->crtc->overlay = NULL; - overlay->crtc = NULL; + intel_overlay_off_tail(overlay); return 0; }