summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/i915/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-02-27 17:51:48 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2011-02-27 18:49:56 +0100
commit3c59b3eb4b6f4f673106d738b62458e6b0b38d46 (patch)
treeb89169d918e630793768ef9b7a46b87db8ad42c7 /src/gallium/winsys/i915/drm
parente20c3255e29b9f94840d1f23439ab29060c94e3f (diff)
i915g/winsys: buffer validation support
v2: Add the batch bo to the libdrm validation lost, for otherwise libdrm won't take previously used buffers into account. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'src/gallium/winsys/i915/drm')
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
index 54b2d7af2eb..7cc5af89639 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
@@ -72,6 +72,26 @@ i915_drm_batchbuffer_create(struct i915_winsys *iws)
return &batch->base;
}
+static boolean
+i915_drm_batchbuffer_validate_buffers(struct i915_winsys_batchbuffer *batch,
+ struct i915_winsys_buffer **buffer,
+ int num_of_buffers)
+{
+ struct i915_drm_batchbuffer *drm_batch = i915_drm_batchbuffer(batch);
+ drm_intel_bo *bos[num_of_buffers + 1];
+ int i, ret;
+
+ bos[0] = drm_batch->bo;
+ for (i = 0; i < num_of_buffers; i++)
+ bos[i+1] = intel_bo(buffer[i]);
+
+ ret = drm_intel_bufmgr_check_aperture_space(bos, num_of_buffers);
+ if (ret != 0)
+ return FALSE;
+
+ return TRUE;
+}
+
static int
i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
struct i915_winsys_buffer *buffer,
@@ -211,6 +231,7 @@ i915_drm_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch)
void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws)
{
idws->base.batchbuffer_create = i915_drm_batchbuffer_create;
+ idws->base.validate_buffers = i915_drm_batchbuffer_validate_buffers;
idws->base.batchbuffer_reloc = i915_drm_batchbuffer_reloc;
idws->base.batchbuffer_flush = i915_drm_batchbuffer_flush;
idws->base.batchbuffer_destroy = i915_drm_batchbuffer_destroy;