drm/i915/dsb: Fix DSB command buffer size checks
free_pos is in dwords, DSB_BUF_SIZE in bytes. Directly comparing the two is nonsense. Fix it up, and make sure we also account for the 8byte alignment requirement for each instruction, and also assume that each instruction normally eats two dwords. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221216003810.13338-5-ville.syrjala@linux.intel.com Reviewed-by: Animesh Manna <animesh.manna@intel.com>
This commit is contained in:
parent
3229319e44
commit
488dd07583
@ -97,7 +97,7 @@ void intel_dsb_indexed_reg_write(struct intel_dsb *dsb,
|
||||
u32 *buf = dsb->cmd_buf;
|
||||
u32 reg_val;
|
||||
|
||||
if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
|
||||
if (drm_WARN_ON(&dev_priv->drm, ALIGN(dsb->free_pos, 2) > DSB_BUF_SIZE / 4 - 2)) {
|
||||
drm_dbg_kms(&dev_priv->drm, "DSB buffer overflow\n");
|
||||
return;
|
||||
}
|
||||
@ -167,7 +167,7 @@ void intel_dsb_reg_write(struct intel_dsb *dsb,
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
u32 *buf = dsb->cmd_buf;
|
||||
|
||||
if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
|
||||
if (drm_WARN_ON(&dev_priv->drm, ALIGN(dsb->free_pos, 2) > DSB_BUF_SIZE / 4 - 2)) {
|
||||
drm_dbg_kms(&dev_priv->drm, "DSB buffer overflow\n");
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user