summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i965_drv_video/i965_media.c2
-rw-r--r--i965_drv_video/intel_batchbuffer.c44
-rw-r--r--i965_drv_video/intel_batchbuffer.h13
3 files changed, 58 insertions, 1 deletions
diff --git a/i965_drv_video/i965_media.c b/i965_drv_video/i965_media.c
index 8945444..036c452 100644
--- a/i965_drv_video/i965_media.c
+++ b/i965_drv_video/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/i965_drv_video/intel_batchbuffer.c b/i965_drv_video/intel_batchbuffer.c
index e561e8b..87c2abc 100644
--- a/i965_drv_video/intel_batchbuffer.c
+++ b/i965_drv_video/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/i965_drv_video/intel_batchbuffer.h b/i965_drv_video/intel_batchbuffer.h
index 99ab08d..7c8e6f5 100644
--- a/i965_drv_video/intel_batchbuffer.h
+++ b/i965_drv_video/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_ */