drm/atomic: Don't reject reflect-only rotations
Subsystems (2)
PATCH 1/1 drm/atomic: Don't reject reflect-only rotations
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
--- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +2 -1
@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) +if ((val &DRM_ROTATE_MASK ) && + !is_power_of_2 (val &DRM_ROTATE_MASK ))return -EINVAL ; state->rotation = val; }else if (property == plane->zpos_property) {
Signature · 6 lines
1.7.9.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Brian,
2016-12-07 Brian Starkey <[email protected]>:
Quoted 4 lines
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Quoted 8 lines
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Gustavo
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +0
-0
drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 849
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) + if ((val & DRM_ROTATE_MASK) &&
If val & DRM_ROTATE_MASK is zero, val must be REFLECT_X | REFLECT_Y. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 14 lines · Chris Wilson
Quoted 13 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines
drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 849
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) + if ((val & DRM_ROTATE_MASK) &&If val &
DRM_ROTATE_MASKis zero, val must beREFLECT_X|REFLECT_Y.
While we bikeshed this check: Validation like this should be somewhere behind ->atomic_check, since if it's only here then you can sneak invalid stuff in through the legacy/compat set_property ioctls. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 28 lines · Daniel Vetter
Quoted 14 lines · Chris Wilson
Quoted 13 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Quoted 12 lines
drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 849
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) + if ((val & DRM_ROTATE_MASK) &&If val &
DRM_ROTATE_MASKis zero, val must beREFLECT_X|REFLECT_Y.
Quoted 3 lines
While we bikeshed this check: Validation like this should be somewhere behind ->atomic_check, since if it's only here then you can sneak invalid stuff in through the legacy/compat
set_propertyioctls.
Not if you use drm_atomic_helper_plane_set_property().
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 29 lines · Ville Syrjälä
Quoted 28 lines · Daniel Vetter
Quoted 26 lines · Chris Wilson
Quoted 18 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +0
-0drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 849
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) + if ((val & DRM_ROTATE_MASK) &&If val &
DRM_ROTATE_MASKis zero, val must beREFLECT_X|REFLECT_Y.
Quoted 5 lines
Quoted 3 lines
While we bikeshed this check: Validation like this should be somewhere behind ->atomic_check, since if it's only here then you can sneak invalid stuff in through the legacy/compat
set_propertyioctls.Not if you use
drm_atomic_helper_plane_set_property().
Oh right, I mixed up the callchain maze in my head again. I still feel like putting all the validation code in one place might be a good idea. But yeah not strictly needed.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 34 lines · Daniel Vetter
Quoted 33 lines · Ville Syrjälä
Quoted 31 lines · Daniel Vetter
Quoted 14 lines · Chris Wilson
Quoted 13 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Quoted 12 lines
drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 849
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) + if ((val & DRM_ROTATE_MASK) &&If val &
DRM_ROTATE_MASKis zero, val must beREFLECT_X|REFLECT_Y.While we bikeshed this check: Validation like this should be somewhere behind ->atomic_check, since if it's only here then you can sneak invalid stuff in through the legacy/compat
set_propertyioctls.
Quoted 5 lines
Quoted 1 line
Not if you use
drm_atomic_helper_plane_set_property().Oh right, I mixed up the callchain maze in my head again. I still feel like putting all the validation code in one place might be a good idea. But yeah not strictly needed.
Well, we do quite a bit of checking already earlier. Eg. drm_property_change_valid(), and obj ID lookups. I think this sort of "totally invalid use of the API" check fits in pretty well with that crowd.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +0
-0
drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 850
Quoted 6 lines
drivers/gpu/drm/drm_atomic.c +2
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) +if ((val &DRM_ROTATE_MASK ) && + !is_power_of_2 (val &DRM_ROTATE_MASK ))
NAK. You must always set one and only one rotation bit.
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +0
-0return -EINVAL ; state->rotation = val; }else if (property == plane->zpos_property) {Signature · 1 line
1.7.9.5
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 14 lines · Ville Syrjälä
Quoted 13 lines · Brian Starkey
The check to reject combinations of multiple rotation angles is overly restrictive and has the side-effect of also failing any rotation value which consists only of reflections.
Fix this by relaxing the check to ignore values which contain no rotation flags.
Fixes 6e0c7c3358d4 ("drm/atomic: Reject attempts to use multiple rotation angles at once")Signed-off-by Brian Starkey <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 14 lines
drivers/gpu/drm/drm_atomic.c int drm_atomic_plane_set_property(struct drm_plane *plane, · line 850
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c +2
-1@@ -846,7 +846,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->prop_src_h) { state->src_h = val; }else if (property == plane->rotation_property) { -if (!is_power_of_2 (val &DRM_ROTATE_MASK )) +if ((val &DRM_ROTATE_MASK ) && + !is_power_of_2 (val &DRM_ROTATE_MASK ))NAK. You must always set one and only one rotation bit.
How do you do (DRM_ROTATE_90 | DRM_REFLECT_X) then?
Could you suggest the correct fix? Because right now a commit which sets rotation = "reflect-x" fails on this check
Thanks,
Brian
Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +0
-1return -EINVAL ; state->rotation = val; }else if (property == plane->zpos_property) { --1.7.9.5
Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel