All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH] intel: allow fence register tracking to be disable
Date: Thu, 22 Apr 2010 22:48:46 +0200	[thread overview]
Message-ID: <1271969327-16945-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1271969327-16945-1-git-send-email-daniel.vetter@ffwll.ch>

libdrm just doesn't know enough to do this precisely. Therefore allow
this to be disabled and put the burden on the client where enough
information is available.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 intel/intel_bufmgr.h     |    1 +
 intel/intel_bufmgr_gem.c |   25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 0984ab0..4e3dd20 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -135,6 +135,7 @@ drm_intel_bo *drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
 						unsigned int handle);
 void drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr);
 void drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr);
+int drm_intel_bufmgr_gem_disable_fence_accounting(drm_intel_bufmgr *bufmgr);
 int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo);
 int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo);
 void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index a2cf6e6..b7aa2bd 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -101,6 +101,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	int gen;
 	char bo_reuse;
 	char fenced_relocs;
+	char no_fence_accounting;
 } drm_intel_bufmgr_gem;
 
 #define DRM_INTEL_RELOC_FENCE (1<<0)
@@ -1737,6 +1738,28 @@ drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr)
 }
 
 /**
+ * Disable the fence checking in drm_intel_gem_bo_get_aperture_space
+ *
+ * The gem buffer manager doesn't know which tiled buffers need fence registers
+ * and which do not. The checking done in get_aperture_space is therefore
+ * necessarily much too pessimistic. Enabling this option allows the client to
+ * check fence register usage on its own.
+ *
+ * Returns 0 if unfenced relocations are not available, i.e. the user has to
+ * reserve a fence for every relocation of a tiled buffer. Returns 1 if unfenced
+ * relocations are available.
+ */
+int drm_intel_bufmgr_gem_disable_fence_accounting(drm_intel_bufmgr *bufmgr)
+{
+	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
+
+	if (bufmgr_gem->fenced_relocs)
+		bufmgr_gem->no_fence_accounting = 1;
+
+	return bufmgr_gem->fenced_relocs;
+}
+
+/**
  * Return the additional aperture space required by the tree of buffer objects
  * rooted at bo.
  */
@@ -1884,7 +1907,7 @@ drm_intel_gem_check_aperture_space(drm_intel_bo **bo_array, int count)
 	int total_fences;
 
 	/* Check for fence reg constraints if necessary */
-	if (bufmgr_gem->available_fences) {
+	if (bufmgr_gem->available_fences && !bufmgr_gem->no_fence_accounting) {
 		total_fences = drm_intel_gem_total_fences(bo_array, count);
 		if (total_fences > bufmgr_gem->available_fences)
 			return -ENOSPC;
-- 
1.7.0.4

  reply	other threads:[~2010-04-22 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 20:48 [PATCH] libdrm changes to allow exact fence usage accounting Daniel Vetter
2010-04-22 20:48 ` Daniel Vetter [this message]
2010-04-22 20:48 ` [PATCH] i830 uxa: track fence reg usage exactly Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271969327-16945-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.