From patchwork Wed Dec 2 11:43:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 64241 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 nB2BhTE1015379 for ; Wed, 2 Dec 2009 11:43:29 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21DA19F4CC; Wed, 2 Dec 2009 03:43:29 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from orsmga101.jf.intel.com (mga06.intel.com [134.134.136.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A0C89F385 for ; Wed, 2 Dec 2009 03:43:25 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 02 Dec 2009 03:42:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,327,1257148800"; d="scan'208";a="574921326" Received: from unknown (HELO localhost.localdomain) ([10.255.16.235]) by orsmga001.jf.intel.com with ESMTP; 02 Dec 2009 03:43:10 -0800 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 2 Dec 2009 11:43:14 +0000 Message-Id: <1259754196-12694-2-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1259754196-12694-1-git-send-email-chris@chris-wilson.co.uk> References: <1259754196-12694-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 1/3] intel: Expect caller to guarantee thread-safety of individual bo 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/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 3b4d3cf..e0585ca 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -841,8 +841,6 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable) struct drm_i915_gem_set_domain set_domain; int ret; - pthread_mutex_lock(&bufmgr_gem->lock); - /* Allow recursive mapping. Mesa may recursively map buffers with * nested display loops. */ @@ -865,7 +863,6 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable) "%s:%d: Error mapping buffer %d (%s): %s .\n", __FILE__, __LINE__, bo_gem->gem_handle, bo_gem->name, strerror(errno)); - pthread_mutex_unlock(&bufmgr_gem->lock); return ret; } bo_gem->mem_virtual = (void *)(uintptr_t) mmap_arg.addr_ptr; @@ -889,12 +886,9 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable) fprintf(stderr, "%s:%d: Error setting to CPU domain %d: %s\n", __FILE__, __LINE__, bo_gem->gem_handle, strerror(errno)); - pthread_mutex_unlock(&bufmgr_gem->lock); return ret; } - pthread_mutex_unlock(&bufmgr_gem->lock); - return 0; } @@ -905,8 +899,6 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo) struct drm_i915_gem_set_domain set_domain; int ret; - pthread_mutex_lock(&bufmgr_gem->lock); - /* Get a mapping of the buffer if we haven't before. */ if (bo_gem->gtt_virtual == NULL) { struct drm_i915_gem_mmap_gtt mmap_arg; @@ -929,7 +921,6 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo) __FILE__, __LINE__, bo_gem->gem_handle, bo_gem->name, strerror(errno)); - pthread_mutex_unlock(&bufmgr_gem->lock); return ret; } @@ -943,7 +934,6 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo) __FILE__, __LINE__, bo_gem->gem_handle, bo_gem->name, strerror(errno)); - pthread_mutex_unlock(&bufmgr_gem->lock); return errno; } } @@ -969,27 +959,19 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo) strerror(errno)); } - pthread_mutex_unlock(&bufmgr_gem->lock); - return ret; } int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo) { - drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; - int ret = 0; - if (bo == NULL) return 0; assert(bo_gem->gtt_virtual != NULL); - - pthread_mutex_lock(&bufmgr_gem->lock); bo->virtual = NULL; - pthread_mutex_unlock(&bufmgr_gem->lock); - return ret; + return 0; } static int drm_intel_gem_bo_unmap(drm_intel_bo *bo) @@ -1004,8 +986,6 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo) assert(bo_gem->mem_virtual != NULL); - pthread_mutex_lock(&bufmgr_gem->lock); - /* Cause a flush to happen if the buffer's pinned for scanout, so the * results show up in a timely manner. */ @@ -1017,7 +997,6 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo) } while (ret == -1 && errno == EINTR); bo->virtual = NULL; - pthread_mutex_unlock(&bufmgr_gem->lock); return 0; } @@ -1186,8 +1165,6 @@ drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) target_bo; - pthread_mutex_lock(&bufmgr_gem->lock); - /* Create a new relocation list if needed */ if (bo_gem->relocs == NULL) drm_intel_setup_reloc_list(bo); @@ -1222,8 +1199,6 @@ drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, bo_gem->reloc_count++; - pthread_mutex_unlock(&bufmgr_gem->lock); - return 0; }