summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2010-11-09 12:52:31 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2010-12-06 12:50:04 +0800
commitc3ccd4df6ce31f867b9b7bf28de88c1739035652 (patch)
tree4bdcdbd3226330db73c23473849d576ebdeb97f1
parent1c2feea8607628557f2bb77f3cdb8ef34786364e (diff)
downloadlibva-intel-driver-c3ccd4df6ce31f867b9b7bf28de88c1739035652.tar.gz
libva-intel-driver-c3ccd4df6ce31f867b9b7bf28de88c1739035652.tar.bz2
libva-intel-driver-c3ccd4df6ce31f867b9b7bf28de88c1739035652.zip
i965_drv_video: check batch buffer emitting
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--i965_media.c2
-rw-r--r--intel_batchbuffer.c44
-rw-r--r--intel_batchbuffer.h13
3 files changed, 58 insertions, 1 deletions
diff --git a/i965_media.c b/i965_media.c
index 8945444..036c452 100644
--- a/i965_media.c
+++ b/i965_media.c
@@ -177,7 +177,7 @@ i965_media_depth_buffer(VADriverContextP ctx)
OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0);
- ADVANCE_BATCH();
+ ADVANCE_BATCH(ctx);
}
static void
diff --git a/intel_batchbuffer.c b/intel_batchbuffer.c
index e561e8b..87c2abc 100644
--- a/intel_batchbuffer.c
+++ b/intel_batchbuffer.c
@@ -356,3 +356,47 @@ intel_batchbuffer_end_atomic_bcs(VADriverContextP ctx)
intel_batchbuffer_end_atomic_helper(intel->batch_bcs);
}
+static void
+intel_batchbuffer_begin_batch_helper(struct intel_batchbuffer *batch, int total)
+{
+ batch->emit_total = total * 4;
+ batch->emit_start = batch->ptr;
+}
+
+void
+intel_batchbuffer_begin_batch(VADriverContextP ctx, int total)
+{
+ struct intel_driver_data *intel = intel_driver_data(ctx);
+
+ intel_batchbuffer_begin_batch_helper(intel->batch, total);
+}
+
+void
+intel_batchbuffer_begin_batch_bcs(VADriverContextP ctx, int total)
+{
+ struct intel_driver_data *intel = intel_driver_data(ctx);
+
+ intel_batchbuffer_begin_batch_helper(intel->batch_bcs, total);
+}
+
+static void
+intel_batchbuffer_advance_batch_helper(struct intel_batchbuffer *batch)
+{
+ assert(batch->emit_total == (batch->ptr - batch->emit_start));
+}
+
+void
+intel_batchbuffer_advance_batch(VADriverContextP ctx)
+{
+ struct intel_driver_data *intel = intel_driver_data(ctx);
+
+ intel_batchbuffer_advance_batch_helper(intel->batch);
+}
+
+void
+intel_batchbuffer_advance_batch_bcs(VADriverContextP ctx)
+{
+ struct intel_driver_data *intel = intel_driver_data(ctx);
+
+ intel_batchbuffer_advance_batch_helper(intel->batch_bcs);
+}
diff --git a/intel_batchbuffer.h b/intel_batchbuffer.h
index 99ab08d..7c8e6f5 100644
--- a/intel_batchbuffer.h
+++ b/intel_batchbuffer.h
@@ -18,6 +18,9 @@ struct intel_batchbuffer
int atomic;
int flag;
+ int emit_total;
+ unsigned char *emit_start;
+
int (*run)(drm_intel_bo *bo, int used,
drm_clip_rect_t *cliprects, int num_cliprects,
int DR4, int ring_flag);
@@ -37,6 +40,9 @@ void intel_batchbuffer_start_atomic(VADriverContextP ctx, unsigned int size);
void intel_batchbuffer_end_atomic(VADriverContextP ctx);
Bool intel_batchbuffer_flush(VADriverContextP ctx);
+void intel_batchbuffer_begin_batch(VADriverContextP ctx, int total);
+void intel_batchbuffer_advance_batch(VADriverContextP ctx);
+
void intel_batchbuffer_emit_dword_bcs(VADriverContextP ctx, unsigned int x);
void intel_batchbuffer_emit_reloc_bcs(VADriverContextP ctx, dri_bo *bo,
uint32_t read_domains, uint32_t write_domains,
@@ -48,8 +54,12 @@ void intel_batchbuffer_start_atomic_bcs(VADriverContextP ctx, unsigned int size)
void intel_batchbuffer_end_atomic_bcs(VADriverContextP ctx);
Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx);
+void intel_batchbuffer_begin_batch_bcs(VADriverContextP ctx, int total);
+void intel_batchbuffer_advance_batch_bcs(VADriverContextP ctx);
+
#define BEGIN_BATCH(ctx, n) do { \
intel_batchbuffer_require_space(ctx, (n) * 4); \
+ intel_batchbuffer_begin_batch(ctx, (n)); \
} while (0)
#define OUT_BATCH(ctx, d) do { \
@@ -63,10 +73,12 @@ Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx);
} while (0)
#define ADVANCE_BATCH(ctx) do { \
+ intel_batchbuffer_advance_batch(ctx); \
} while (0)
#define BEGIN_BCS_BATCH(ctx, n) do { \
intel_batchbuffer_require_space_bcs(ctx, (n) * 4); \
+ intel_batchbuffer_begin_batch_bcs(ctx, (n)); \
} while (0)
#define OUT_BCS_BATCH(ctx, d) do { \
@@ -80,6 +92,7 @@ Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx);
} while (0)
#define ADVANCE_BCS_BATCH(ctx) do { \
+ intel_batchbuffer_advance_batch_bcs(ctx); \
} while (0)
#endif /* _INTEL_BATCHBUFFER_H_ */