drm: Add DRM_ROTATE_ and DRM_REFLECT_ defines to UAPI
Subsystems (2)
PATCH 1/1 drm: Add DRM_ROTATE_ and DRM_REFLECT_ defines to UAPI
Add DRM_ROTATE_ and DRM_REFLECT_ defines to the UAPI as a convenience.
Ideally the DRM_ROTATE_ and DRM_REFLECT_ property ids are looked up through the atomic API, but realizing that userspace is likely to take shortcuts and assume that the enum values are what is sent over the wire.
As a result these defines are provided purely as a convenience to userspace applications.
--- drivers/gpu/drm/drm_rect.c | 1 + include/drm/drm_blend.h | 18 ------------ include/uapi/drm/drm.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_rect.c +1 -0
@@ -24,6 +24,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/kernel.h> +#include <drm/drm.h> #include <drm/drmP.h> #include <drm/drm_rect.h>
include/drm/drm_blend.h +0 -18
@@ -29,24 +29,6 @@struct drm_device ;struct drm_atomic_state ; -/* -* Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the -* specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and -* DRM_REFLECT_Y reflects the image along the specified axis prior to rotation -* -* WARNING: These defines are UABI since they're exposed in the rotation -* property. -*/ -#define DRM_ROTATE_0 BIT(0) -#define DRM_ROTATE_90 BIT(1) -#define DRM_ROTATE_180 BIT(2) -#define DRM_ROTATE_270 BIT(3) -#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ - DRM_ROTATE_180 | DRM_ROTATE_270) -#define DRM_REFLECT_X BIT(4) -#define DRM_REFLECT_Y BIT(5) -#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) -static inline bool drm_rotation_90_or_270 (unsigned int rotation) {return rotation & (DRM_ROTATE_90 |DRM_ROTATE_270 );
include/uapi/drm/drm.h +73 -0
79 lines not on this page · raw message
Signature · 6 lines
2.11.0.453.g787f75f05 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Rob,
Quoted 34 lines · Robert Foss
Add
DRM_ROTATE_andDRM_REFLECT_defines to the UAPI as a convenience.Ideally the
DRM_ROTATE_andDRM_REFLECT_property ids are looked up through the atomic API, but realizing that userspace is likely to take shortcuts and assume that the enum values are what is sent over the wire.As a result these defines are provided purely as a convenience to userspace applications.
Signed-off-by Robert Foss <[email protected]>--- drivers/gpu/drm/drm_rect.c | 1 + include/drm/drm_blend.h | 18 ------------ include/uapi/drm/drm.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_rect.c +1
-0@@ -24,6 +24,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/kernel.h> +#include <drm/drm.h> #include <drm/drmP.h> #include <drm/drm_rect.h> include/drm/drm_blend.h +0
-0
include/drm/drm_blend.h line 31
Quoted 3 lines
include/drm/drm_blend.h +0
-0@@ -29,24 +29,6 @@struct drm_device ;struct drm_atomic_state ;
Since the defines are used here, move the above include to this file?
include/uapi/drm/drm.h
Quoted 25 lines
include/drm/drm_blend.h +0
-18-/* -* Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the -* specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and -* DRM_REFLECT_Y reflects the image along the specified axis prior to rotation -* -* WARNING: These defines are UABI since they're exposed in the rotation -* property. -*/ -#define DRM_ROTATE_0 BIT(0) -#define DRM_ROTATE_90 BIT(1) -#define DRM_ROTATE_180 BIT(2) -#define DRM_ROTATE_270 BIT(3) -#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ - DRM_ROTATE_180 | DRM_ROTATE_270) -#define DRM_REFLECT_X BIT(4) -#define DRM_REFLECT_Y BIT(5) -#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) -static inline bool drm_rotation_90_or_270 (unsigned int rotation) {return rotation & (DRM_ROTATE_90 |DRM_ROTATE_270 );include/uapi/drm/drm.h +0
-0
drm_mode.h might be a better fit.
include/uapi/drm/drm.h struct drm_prime_handle { · line 705
Quoted 10 lines
include/uapi/drm/drm.h +6
-0@@ -697,6 +697,79 @@ struct drm_prime_handle {__s32 fd; }; +/** DRM_ROTATE_0 +* +* Signals that a drm plane has been rotated 0 degrees. +* +* This define is provided as a convenience, looking up the property id +* using the name->prop id lookup is the preferred method.
Comments look quite good, small question:
Is it plane only? Haven't looked at the code, but gut feeling says no.
include/uapi/drm/drm.h struct drm_prime_handle { · line 708
Quoted 3 lines
include/uapi/drm/drm.h +3
-0+*/ +#define DRM_ROTATE_0 BIT(0) +
The UAPI headers do not use BIT(). Please use (1<<x) instead.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 32 lines · Emil Velikov
Hi Rob,
Quoted 29 lines · Robert Foss
Add
DRM_ROTATE_andDRM_REFLECT_defines to the UAPI as a convenience.Ideally the
DRM_ROTATE_andDRM_REFLECT_property ids are looked up through the atomic API, but realizing that userspace is likely to take shortcuts and assume that the enum values are what is sent over the wire.As a result these defines are provided purely as a convenience to userspace applications.
Signed-off-by Robert Foss <[email protected]>--- drivers/gpu/drm/drm_rect.c | 1 + include/drm/drm_blend.h | 18 ------------ include/uapi/drm/drm.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_rect.c +1
-0@@ -24,6 +24,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/kernel.h> +#include <drm/drm.h> #include <drm/drmP.h> #include <drm/drm_rect.h>
Quoted 9 lines
include/drm/drm_blend.h line 31
Quoted 8 lines
include/drm/drm_blend.h +0
-0@@ -29,24 +29,6 @@struct drm_device ;struct drm_atomic_state ;Since the defines are used here, move the above include to this file?
Done.
Quoted 20 lines
Quoted 20 lines
include/drm/drm_blend.h +0
-18-/* -* Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the -* specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and -* DRM_REFLECT_Y reflects the image along the specified axis prior to rotation -* -* WARNING: These defines are UABI since they're exposed in the rotation -* property. -*/ -#define DRM_ROTATE_0 BIT(0) -#define DRM_ROTATE_90 BIT(1) -#define DRM_ROTATE_180 BIT(2) -#define DRM_ROTATE_270 BIT(3) -#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ - DRM_ROTATE_180 | DRM_ROTATE_270) -#define DRM_REFLECT_X BIT(4) -#define DRM_REFLECT_Y BIT(5) -#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) -static inline bool drm_rotation_90_or_270 (unsigned int rotation)
Quoted 8 lines
include/uapi/drm/drm.h
Quoted 6 lines
include/drm/drm_blend.h +0
-0{return rotation & (DRM_ROTATE_90 |DRM_ROTATE_270 );include/uapi/drm/drm.h +0
-0
drm_mode.hmight be a better fit.
About this, I don't disagree, but other defines in drm_mode.h seem to be prefixed with DRM_MODE_ which this isn't which is why I didn't put it there.
Knowing this, do you still prefer these defines living in drm_mode.h?
Quoted 14 lines
include/uapi/drm/drm.h struct drm_prime_handle { · line 705
Quoted 11 lines
include/uapi/drm/drm.h +6
-0@@ -697,6 +697,79 @@ struct drm_prime_handle {__s32 fd; }; +/** DRM_ROTATE_0 +* +* Signals that a drm plane has been rotated 0 degrees. +* +* This define is provided as a convenience, looking up the property id +* using the name->prop id lookup is the preferred method. Comments look quite good, small question:
Is it plane only? Haven't looked at the code, but gut feeling says no.
Quoted 7 lines
include/uapi/drm/drm.h struct drm_prime_handle { · line 708
Quoted 3 lines
include/uapi/drm/drm.h +3
-0+*/ +#define DRM_ROTATE_0 BIT(0) +The UAPI headers do not use
BIT(). Please use (1<<x) instead.-Emil
Done.
Rob.
Quoted 85 lines · Robert Foss
Quoted 35 lines · Emil Velikov
Hi Rob,
Quoted 31 lines · Robert Foss
Add
DRM_ROTATE_andDRM_REFLECT_defines to the UAPI as a convenience.Ideally the
DRM_ROTATE_andDRM_REFLECT_property ids are looked up through the atomic API, but realizing that userspace is likely to take shortcuts and assume that the enum values are what is sent over the wire.As a result these defines are provided purely as a convenience to userspace applications.
Signed-off-by Robert Foss <[email protected]>--- drivers/gpu/drm/drm_rect.c | 1 + include/drm/drm_blend.h | 18 ------------ include/uapi/drm/drm.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_rect.c +1
-0@@ -24,6 +24,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/kernel.h> +#include <drm/drm.h> #include <drm/drmP.h> #include <drm/drm_rect.h> Quoted 9 lines
include/drm/drm_blend.h line 31
Quoted 8 lines
include/drm/drm_blend.h +0
-0@@ -29,24 +29,6 @@struct drm_device ;struct drm_atomic_state ;Since the defines are used here, move the above include to this file?
Done.
Quoted 23 lines
Quoted 23 lines
include/drm/drm_blend.h +0
-3-/* -* Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the -* specified amount in degrees in counter clockwise direction.
DRM_REFLECT_Xand
- *DRM_REFLECT_Yreflects the image along the specified axis prior to rotation
- *
- * WARNING: These defines are UABI since they're exposed in the rotation
- * property.
- */include/drm/drm_blend.h +0
-10-#define DRM_ROTATE_0 BIT(0) -#define DRM_ROTATE_90 BIT(1) -#define DRM_ROTATE_180 BIT(2) -#define DRM_ROTATE_270 BIT(3) -#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ - DRM_ROTATE_180 | DRM_ROTATE_270) -#define DRM_REFLECT_X BIT(4) -#define DRM_REFLECT_Y BIT(5) -#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) -static inline bool drm_rotation_90_or_270 (unsigned int rotation) {Quoted 8 lines
include/uapi/drm/drm.h
Quoted 5 lines
return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);include/uapi/drm/drm.h +0
-0
drm_mode.hmight be a better fit.
Quoted 5 lines
About this, I don't disagree, but other defines in
drm_mode.hseem to be prefixed withDRM_MODE_which this isn't which is why I didn't put it there.Knowing this, do you still prefer these defines living in
drm_mode.h?
Feel free to give them a DRM_MODE_ prefix or something else - say DRM_MODE_PROP_.
AFAICT drm_mode.h deals with KMS specifics and the prop_id mentioned in the documentation is already there, so it would make sense to add it there.
-Emil
Quoted 89 lines · Emil Velikov
Quoted 88 lines · Robert Foss
Quoted 35 lines · Emil Velikov
Hi Rob,
Quoted 31 lines · Robert Foss
Add
DRM_ROTATE_andDRM_REFLECT_defines to the UAPI as a convenience.Ideally the
DRM_ROTATE_andDRM_REFLECT_property ids are looked up through the atomic API, but realizing that userspace is likely to take shortcuts and assume that the enum values are what is sent over the wire.As a result these defines are provided purely as a convenience to userspace applications.
Signed-off-by Robert Foss <[email protected]>--- drivers/gpu/drm/drm_rect.c | 1 + include/drm/drm_blend.h | 18 ------------ include/uapi/drm/drm.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_rect.c +1
-0@@ -24,6 +24,7 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/kernel.h> +#include <drm/drm.h> #include <drm/drmP.h> #include <drm/drm_rect.h> Quoted 9 lines
include/drm/drm_blend.h line 31
Quoted 8 lines
include/drm/drm_blend.h +0
-0@@ -29,24 +29,6 @@struct drm_device ;struct drm_atomic_state ;Since the defines are used here, move the above include to this file?
Done.
Quoted 23 lines
Quoted 23 lines
include/drm/drm_blend.h +0
-3-/* -* Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the -* specified amount in degrees in counter clockwise direction.
DRM_REFLECT_Xand
- *DRM_REFLECT_Yreflects the image along the specified axis prior to rotation
- *
- * WARNING: These defines are UABI since they're exposed in the rotation
- * property.
- */include/drm/drm_blend.h +0
-10-#define DRM_ROTATE_0 BIT(0) -#define DRM_ROTATE_90 BIT(1) -#define DRM_ROTATE_180 BIT(2) -#define DRM_ROTATE_270 BIT(3) -#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ - DRM_ROTATE_180 | DRM_ROTATE_270) -#define DRM_REFLECT_X BIT(4) -#define DRM_REFLECT_Y BIT(5) -#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) -static inline bool drm_rotation_90_or_270 (unsigned int rotation) {Quoted 8 lines
include/uapi/drm/drm.h
Quoted 5 lines
return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);include/uapi/drm/drm.h +0
-0
drm_mode.hmight be a better fit.About this, I don't disagree, but other defines in
drm_mode.hseem to be prefixed withDRM_MODE_which this isn't which is why I didn't put it there.
Quoted 8 lines
Quoted 2 lines
Knowing this, do you still prefer these defines living in
drm_mode.h?Feel free to give them a
DRM_MODE_prefix or something else - sayDRM_MODE_PROP_.AFAICT
drm_mode.hdeals with KMS specifics and theprop_idmentioned in the documentation is already there, so it would make sense to add it there.
Done.
Rob.
Quoted 3 lines
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel