On Sun, 2020-12-13 at 17:22 +0000, Simon Ser wrote:
Can you add some drm_dbg_atomic logs when the damage is invalid, to make it easier for user-space to understand why an atomic commit failed?
sure, this is enough? will wait for a couple of more days before send another version.
diff --git a/drivers/gpu/drm/drm_damage_helper.c b/drivers/gpu/drm/drm_damage_helper.c index 9adb369440ba..b598b137d27f 100644 --- a/drivers/gpu/drm/drm_damage_helper.c +++ b/drivers/gpu/drm/drm_damage_helper.c @@ -33,6 +33,7 @@ #include <drm/drm_atomic.h> #include <drm/drm_damage_helper.h> #include <drm/drm_device.h> +#include <drm/drm_print.h>
/** * DOC: overview @@ -152,16 +153,25 @@ int drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state,
for (; num_clips; num_clips--, damaged_clips++) { if (damaged_clips->x1 < 0 || damaged_clips->x2 < 0 || - damaged_clips->y1 < 0 || damaged_clips->y2 < 0) + damaged_clips->y1 < 0 || damaged_clips->y2 < 0) { + drm_dbg_atomic(state->dev, + "Invalid damage clip, negative coordinate\n"); return -EINVAL; + }
if (damaged_clips->x2 < damaged_clips->x1 || - damaged_clips->y2 < damaged_clips->y1) + damaged_clips->y2 < damaged_clips->y1) { + drm_dbg_atomic(state->dev, + "Invalid damage clip, negative width or height\n"); return -EINVAL; + }
if ((damaged_clips->x2 - damaged_clips->x1) > w || - (damaged_clips->y2 - damaged_clips->y1) > h) + (damaged_clips->y2 - damaged_clips->y1) > h) { + drm_dbg_atomic(state->dev, + "Invalid damage clip, width or height larger than plane\n"); return -EINVAL; + } }
return 0;