From patchwork Sat Feb 26 18:30:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 592721 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1QIceY1010853 for ; Sat, 26 Feb 2011 18:39:03 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 93DEF9F39E for ; Sat, 26 Feb 2011 10:38:40 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-iy0-f177.google.com (mail-iy0-f177.google.com [209.85.210.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A6319E7BE for ; Sat, 26 Feb 2011 10:30:39 -0800 (PST) Received: by mail-iy0-f177.google.com with SMTP id 40so1907628iyf.36 for ; Sat, 26 Feb 2011 10:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=tPPbgMYyFpR/TNlKZgJybksLF0cNTHsGMUfwYdB2CSw=; b=MEWpMHf45eR4+vkctDa7olKRET4mLLazgV8CS1anUmb6zn/RLi/ORZ4Z4SeA0cMGMW cmTDqgNwX80T6pKFH+FS1c+LHEZrusp4qlmzEkKPk/LcPm7ezRp8y4nw92j1fyf4ppht b82RjJ+yEzf2IF6njZJR+rzst460mcZV0oeuQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=I8Cb7iq3C3gVFyfNwq+WMDPrkn18JRRPxtqvaZ4WgcEEQ22qhdARe5njqzSSULJB5P PRLPJBg0YWaX1KwTaC5c6nHxQAIXmisSwboyzH8xtSpf6ulfXeGshU0QzHipb8cqUgLY GlYJGgT8AT8sz/gvtWo9o1cL8NzKgZvuiT7OM= Received: by 10.42.3.133 with SMTP id 5mr2509696ico.351.1298745039795; Sat, 26 Feb 2011 10:30:39 -0800 (PST) Received: from localhost.localdomain ([67.208.96.87]) by mx.google.com with ESMTPS id wd12sm1519339icb.17.2011.02.26.10.30.38 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 26 Feb 2011 10:30:39 -0800 (PST) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Sat, 26 Feb 2011 10:30:15 -0800 Message-Id: <1298745018-5937-6-git-send-email-bwidawsk@gmail.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1298745018-5937-1-git-send-email-bwidawsk@gmail.com> References: <1298745018-5937-1-git-send-email-bwidawsk@gmail.com> Subject: [Intel-gfx] [RFC] [PATCH 5/8] drm/i915/context: implement context switch wait X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 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+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 26 Feb 2011 18:39:03 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/i915_context.c b/drivers/gpu/drm/i915/i915_context.c index babceca..45b5181 100644 --- a/drivers/gpu/drm/i915/i915_context.c +++ b/drivers/gpu/drm/i915/i915_context.c @@ -66,6 +66,29 @@ static void context_destroy_id(struct drm_i915_gem_context *ctx) spin_unlock(&file_priv->context_idr_lock); } +static int wait_for_context_switch(struct intel_ring_buffer *ring) +{ + struct drm_i915_gem_request *request; + int ret; + + request = kzalloc(sizeof(*request), GFP_KERNEL); + if (request == NULL) { + ret = -ENOMEM; + goto out; + } + + ret = i915_add_request(ring, NULL, request); + if (ret) { + kfree(request); + goto out; + } + + ret = i915_wait_request(ring, request->seqno); + +out: + return ret; +} + /* * Initialize a context for the given ring. * @wait_for_switch: whether or not to wait for the context switch instruction