Commit ff6eec3e authored by Xiang, Haihao's avatar Xiang, Haihao

i965_drv_video: check batch buffer emitting

Signed-off-by: default avatarXiang, Haihao <haihao.xiang@intel.com>
parent b077c907
...@@ -177,7 +177,7 @@ i965_media_depth_buffer(VADriverContextP ctx) ...@@ -177,7 +177,7 @@ i965_media_depth_buffer(VADriverContextP ctx)
OUT_BATCH(ctx, 0); OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0); OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0); OUT_BATCH(ctx, 0);
ADVANCE_BATCH(); ADVANCE_BATCH(ctx);
} }
static void static void
......
...@@ -356,3 +356,47 @@ intel_batchbuffer_end_atomic_bcs(VADriverContextP ctx) ...@@ -356,3 +356,47 @@ intel_batchbuffer_end_atomic_bcs(VADriverContextP ctx)
intel_batchbuffer_end_atomic_helper(intel->batch_bcs); 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);
}
...@@ -18,6 +18,9 @@ struct intel_batchbuffer ...@@ -18,6 +18,9 @@ struct intel_batchbuffer
int atomic; int atomic;
int flag; int flag;
int emit_total;
unsigned char *emit_start;
int (*run)(drm_intel_bo *bo, int used, int (*run)(drm_intel_bo *bo, int used,
drm_clip_rect_t *cliprects, int num_cliprects, drm_clip_rect_t *cliprects, int num_cliprects,
int DR4, int ring_flag); int DR4, int ring_flag);
...@@ -37,6 +40,9 @@ void intel_batchbuffer_start_atomic(VADriverContextP ctx, unsigned int size); ...@@ -37,6 +40,9 @@ void intel_batchbuffer_start_atomic(VADriverContextP ctx, unsigned int size);
void intel_batchbuffer_end_atomic(VADriverContextP ctx); void intel_batchbuffer_end_atomic(VADriverContextP ctx);
Bool intel_batchbuffer_flush(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_dword_bcs(VADriverContextP ctx, unsigned int x);
void intel_batchbuffer_emit_reloc_bcs(VADriverContextP ctx, dri_bo *bo, void intel_batchbuffer_emit_reloc_bcs(VADriverContextP ctx, dri_bo *bo,
uint32_t read_domains, uint32_t write_domains, uint32_t read_domains, uint32_t write_domains,
...@@ -48,8 +54,12 @@ void intel_batchbuffer_start_atomic_bcs(VADriverContextP ctx, unsigned int size) ...@@ -48,8 +54,12 @@ void intel_batchbuffer_start_atomic_bcs(VADriverContextP ctx, unsigned int size)
void intel_batchbuffer_end_atomic_bcs(VADriverContextP ctx); void intel_batchbuffer_end_atomic_bcs(VADriverContextP ctx);
Bool intel_batchbuffer_flush_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 { \ #define BEGIN_BATCH(ctx, n) do { \
intel_batchbuffer_require_space(ctx, (n) * 4); \ intel_batchbuffer_require_space(ctx, (n) * 4); \
intel_batchbuffer_begin_batch(ctx, (n)); \
} while (0) } while (0)
#define OUT_BATCH(ctx, d) do { \ #define OUT_BATCH(ctx, d) do { \
...@@ -63,10 +73,12 @@ Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx); ...@@ -63,10 +73,12 @@ Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx);
} while (0) } while (0)
#define ADVANCE_BATCH(ctx) do { \ #define ADVANCE_BATCH(ctx) do { \
intel_batchbuffer_advance_batch(ctx); \
} while (0) } while (0)
#define BEGIN_BCS_BATCH(ctx, n) do { \ #define BEGIN_BCS_BATCH(ctx, n) do { \
intel_batchbuffer_require_space_bcs(ctx, (n) * 4); \ intel_batchbuffer_require_space_bcs(ctx, (n) * 4); \
intel_batchbuffer_begin_batch_bcs(ctx, (n)); \
} while (0) } while (0)
#define OUT_BCS_BATCH(ctx, d) do { \ #define OUT_BCS_BATCH(ctx, d) do { \
...@@ -80,6 +92,7 @@ Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx); ...@@ -80,6 +92,7 @@ Bool intel_batchbuffer_flush_bcs(VADriverContextP ctx);
} while (0) } while (0)
#define ADVANCE_BCS_BATCH(ctx) do { \ #define ADVANCE_BCS_BATCH(ctx) do { \
intel_batchbuffer_advance_batch_bcs(ctx); \
} while (0) } while (0)
#endif /* _INTEL_BATCHBUFFER_H_ */ #endif /* _INTEL_BATCHBUFFER_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment