@@ -190,3 +190,46 @@ void intel_dsb_reg_write(struct intel_dsb *dsb, i915_reg_t reg, u32 val)
DSB_OPCODE_SHIFT) | DSB_BYTE_EN |
i915_mmio_reg_offset(reg);
}
+
+void intel_dsb_commit(struct intel_dsb *dsb)
+{
+ struct intel_crtc *crtc = dsb->crtc;
+ struct drm_device *dev = crtc->base.dev;
+ struct drm_i915_private *dev_priv = to_i915(dev);
+ enum pipe pipe = crtc->pipe;
+ u32 cmd_buf_tail, cmd_buf_size;
+
+ if (!dsb->free_pos)
+ return;
+
+ if (!intel_dsb_enable_engine(dsb))
+ goto reset;
+
+ if (is_dsb_busy(dsb)) {
+ DRM_DEBUG_KMS("HEAD_PTR write failed - dsb engine is busy.\n");
+ goto reset;
+ }
+ I915_WRITE(DSB_HEAD_PTR(pipe, dsb->id), dsb->cmd_buf_head);
+
+ cmd_buf_size = dsb->free_pos * 4;
+ cmd_buf_tail = round_up((dsb->cmd_buf_head + cmd_buf_size),
+ CACHELINE_BYTES);
+
+ if (is_dsb_busy(dsb)) {
+ DRM_DEBUG_KMS("TAIL_PTR write failed - dsb engine is busy.\n");
+ goto reset;
+ }
+ DRM_DEBUG_KMS("DSB execution started - buf-size %u, head 0x%x,"
+ "tail 0x%x\n", cmd_buf_size, dsb->cmd_buf_head,
+ cmd_buf_tail);
+ I915_WRITE(DSB_TAIL_PTR(pipe, dsb->id), cmd_buf_tail);
+ if (wait_for(!is_dsb_busy(dsb), 1)) {
+ DRM_ERROR("Timed out waiting for DSB workload completion.\n");
+ goto reset;
+ }
+
+reset:
+ memset(dsb->cmd_buf, 0, DSB_BUF_SIZE);
+ dsb->free_pos = 0;
+ intel_dsb_disable_engine(dsb);
+}
@@ -42,5 +42,6 @@ struct intel_dsb {
struct intel_dsb *
intel_dsb_get(struct intel_crtc *crtc);
void intel_dsb_reg_write(struct intel_dsb *dsb, i915_reg_t reg, u32 val);
+void intel_dsb_commit(struct intel_dsb *dsb);
#endif
Batch buffer will be created through dsb-reg-write function which can have single/multiple request based on usecase and once the buffer is ready commit function will trigger the execution of the batch buffer. All the registers will be updated simultaneously. Cc: Imre Deak <imre.deak@intel.com> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Animesh Manna <animesh.manna@intel.com> --- drivers/gpu/drm/i915/intel_dsb.c | 43 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dsb.h | 1 + 2 files changed, 44 insertions(+)