Skip to contentSkip to conversation

Header: Add rotation property fields

PATCH In review Robert Foss 5 participants 9 messages Apr 17, 2017 – May 2, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Header: Add rotation property fields

From: Sean Paul <[email protected]>

From drm_crtc.h, for use with the plane "rotation" property.

---
Changes since v1:
- Added r-b

 include/drm/drm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/drm/drm.h +8 -0
index 1e7a4bc7a505..656c90045161 100644
@@ -74,6 +74,14 @@ extern "C" {
 #define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
 
+/* Rotation property bits */
+#define DRM_ROTATE_0		0
+#define DRM_ROTATE_90		1
+#define DRM_ROTATE_180		2
+#define DRM_ROTATE_270		3
+#define DRM_REFLECT_X		4
+#define DRM_REFLECT_Y		5
+
 typedef unsigned int drm_context_t;
 typedef unsigned int drm_drawable_t;
 typedef unsigned int drm_magic_t;
Signature · 6 lines
2.11.0.453.g787f75f05

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 7 lines · Emil Velikov
Quoted 4 lines · Robert Foss

From: Sean Paul <[email protected]>

From drm_crtc.h, for use with the plane "rotation" property.

Please see the include/drm/README.

To elaborate a bit:
The headers in include/drm should be synced via make headers_install + copy, as seen in git log and described in the README file.

Although for the properties here we seems to be in a pickle. These are defined in drm_blend.h which is not exported as part of the ABI. Yet the defines _are_ part of the ABI - see the lovely warning, which was added when someone broke and ABI and hence userspace.

My suggestion - fix this in the kernel first.
- Move the DRM_ROTATE* and DRM_REFLECT_* to an ABI header.
Having a slight preference about drm_mode.h but drm.h should also be fine.
- Optional: skim through for other properties that should be moved to
the ABI headers.
- Update libdrm as described in the README (please send patches if
the documentation is not clear)

Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to Robert Foss
Quoted 19 lines · Robert Foss

From: Sean Paul <[email protected]>

From drm_crtc.h, for use with the plane "rotation" property.

---
Changes since v1:
- Added r-b

 include/drm/drm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/drm/drm.h +0 -0
index 1e7a4bc7a505..656c90045161 100644

include/drm/drm.h extern "C" { · line 83

Quoted 10 lines
include/drm/drm.h +7 -0
@@ -74,6 +74,14 @@ extern "C" {
 #define _DRM_LOCK_IS_CONT(lock)           ((lock) & _DRM_LOCK_CONT)
 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
 
+/* Rotation property bits */
+#define DRM_ROTATE_0           0
+#define DRM_ROTATE_90          1
+#define DRM_ROTATE_180         2
+#define DRM_ROTATE_270         3
+#define DRM_REFLECT_X          4
+#define DRM_REFLECT_Y          5

As far as I understand the property mechanism, the numeric values aren't actually ABI. The string names of the enum values are the ABI and you're supposed to parse the enum info and discover the numerical values. For example:
https://git.collabora.com/cgit/user/daniels/weston.git/tree/libweston/compositor-drm.c?h=wip/2017-03/atomic-v10-WIP#n570

Kristian

Quoted 11 lines
include/drm/drm.h +1 -1
+
 typedef unsigned int drm_context_t;
 typedef unsigned int drm_drawable_t;
 typedef unsigned int drm_magic_t;
--

2.11.0.453.g787f75f05

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 23 lines · Kristian Høgsberg
Quoted 22 lines · Robert Foss

From: Sean Paul <[email protected]>

From drm_crtc.h, for use with the plane "rotation" property.

---
Changes since v1:
- Added r-b

 include/drm/drm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/drm/drm.h +0 -0
index 1e7a4bc7a505..656c90045161 100644
@@ -74,6 +74,14 @@ extern "C" {
 #define _DRM_LOCK_IS_CONT(lock)           ((lock) & _DRM_LOCK_CONT)
 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
 
Quoted 14 lines

include/drm/drm.h extern "C" { · line 83

Quoted 7 lines
include/drm/drm.h +7 -0
+/* Rotation property bits */
+#define DRM_ROTATE_0           0
+#define DRM_ROTATE_90          1
+#define DRM_ROTATE_180         2
+#define DRM_ROTATE_270         3
+#define DRM_REFLECT_X          4
+#define DRM_REFLECT_Y          5

As far as I understand the property mechanism, the numeric values aren't actually ABI. The string names of the enum values are the ABI and you're supposed to parse the enum info and discover the numerical values. For example:
https://git.collabora.com/cgit/user/daniels/weston.git/tree/libweston/compositor-drm.c?h=wip/2017-03/atomic-v10-WIP#n570

Note sure I agree, yet then again my kernel experience is less than yours. Do check the following commit and feel free to search the ML thread that inspired it.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/drm/drm_blend.h?id=226714dc7c6af6d0acee449eb2afce08d128edad

Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 38 lines · Emil Velikov
Quoted 23 lines · Kristian Høgsberg
Quoted 22 lines · Robert Foss

From: Sean Paul <[email protected]>

From drm_crtc.h, for use with the plane "rotation" property.

---
Changes since v1:
- Added r-b

 include/drm/drm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/drm/drm.h +0 -0
index 1e7a4bc7a505..656c90045161 100644
@@ -74,6 +74,14 @@ extern "C" {
 #define _DRM_LOCK_IS_CONT(lock)           ((lock) & _DRM_LOCK_CONT)
 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
 
Quoted 14 lines

include/drm/drm.h extern "C" { · line 83

Quoted 7 lines
include/drm/drm.h +7 -0
+/* Rotation property bits */
+#define DRM_ROTATE_0           0
+#define DRM_ROTATE_90          1
+#define DRM_ROTATE_180         2
+#define DRM_ROTATE_270         3
+#define DRM_REFLECT_X          4
+#define DRM_REFLECT_Y          5

As far as I understand the property mechanism, the numeric values aren't actually ABI. The string names of the enum values are the ABI and you're supposed to parse the enum info and discover the numerical values. For example:
https://git.collabora.com/cgit/user/daniels/weston.git/tree/libweston/compositor-drm.c?h=wip/2017-03/atomic-v10-WIP#n570

Quoted 3 lines

Note sure I agree, yet then again my kernel experience is less than yours. Do check the following commit and feel free to search the ML thread that inspired it.

I haven't worked much with the property mechanism tbh, but I know Daniel (Stone) jumped through all those hoops to avoid hard-coding the enum values.

Quoted 4 lines

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/drm/drm_blend.h?id=226714dc7c6af6d0acee449eb2afce08d128edad

Thanks
Emil

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
Quoted 6 lines · Kristian Høgsberg
Quoted 6 lines
Quoted 6 lines

As far as I understand the property mechanism, the numeric values aren't actually ABI. The string names of the enum values are the ABI and you're supposed to parse the enum info and discover the numerical values. For example:
https://git.collabora.com/cgit/user/daniels/weston.git/tree/libweston/compositor-drm.c?h=wip/2017-03/atomic-v10-WIP#n570

Quoted 7 lines
Quoted 3 lines

Note sure I agree, yet then again my kernel experience is less than yours. Do check the following commit and feel free to search the ML thread that inspired it.

I haven't worked much with the property mechanism tbh, but I know Daniel (Stone) jumped through all those hoops to avoid hard-coding the enum values.

In theory, this is correct and is how it's supposed to be done. In practice, for a bunch of properties at least, we deal with the reality of userspace being lazy and assuming that the enum values match with the encode they send over the wire and tears result if we ever chance that. I still think that going through the strings should be the better way, since it makes it much easier to add/remove certain enum values, depending upon what the hw/driverr combo can pull off.

The story is different for the properties themselves, there you definitely need to make the name->prop id lookup, and you also need to do that mapping for each object separately (because the value range is attached to the prop, for uabi reasons, but might need to be per-object).
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
Quoted 23 lines · Daniel Vetter
Quoted 6 lines · Kristian Høgsberg
Quoted 6 lines
Quoted 6 lines

As far as I understand the property mechanism, the numeric values aren't actually ABI. The string names of the enum values are the ABI and you're supposed to parse the enum info and discover the numerical values. For example:
https://git.collabora.com/cgit/user/daniels/weston.git/tree/libweston/compositor-drm.c?h=wip/2017-03/atomic-v10-WIP#n570

Quoted 7 lines
Quoted 3 lines

Note sure I agree, yet then again my kernel experience is less than yours. Do check the following commit and feel free to search the ML thread that inspired it.

I haven't worked much with the property mechanism tbh, but I know Daniel (Stone) jumped through all those hoops to avoid hard-coding the enum values.

In theory, this is correct and is how it's supposed to be done. In practice, for a bunch of properties at least, we deal with the reality of userspace being lazy and assuming that the enum values match with the encode they send over the wire and tears result if we ever chance that. I still think that going through the strings should be the better way, since it makes it much easier to add/remove certain enum values, depending upon what the hw/driverr combo can pull off.

Quoted 5 lines

The story is different for the properties themselves, there you definitely need to make the name->prop id lookup, and you also need to do that mapping for each object separately (because the value range is attached to the prop, for uabi reasons, but might need to be per-object).

Daniel, this that mean that we're OK with moving DRM_ROTATE* [+others] to a ABI header?

Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
Quoted 24 lines · Emil Velikov
Quoted 23 lines · Daniel Vetter
Quoted 6 lines · Kristian Høgsberg
Quoted 6 lines
Quoted 6 lines

As far as I understand the property mechanism, the numeric values aren't actually ABI. The string names of the enum values are the ABI and you're supposed to parse the enum info and discover the numerical values. For example:
https://git.collabora.com/cgit/user/daniels/weston.git/tree/libweston/compositor-drm.c?h=wip/2017-03/atomic-v10-WIP#n570

Quoted 7 lines
Quoted 3 lines

Note sure I agree, yet then again my kernel experience is less than yours. Do check the following commit and feel free to search the ML thread that inspired it.

I haven't worked much with the property mechanism tbh, but I know Daniel (Stone) jumped through all those hoops to avoid hard-coding the enum values.

In theory, this is correct and is how it's supposed to be done. In practice, for a bunch of properties at least, we deal with the reality of userspace being lazy and assuming that the enum values match with the encode they send over the wire and tears result if we ever chance that. I still think that going through the strings should be the better way, since it makes it much easier to add/remove certain enum values, depending upon what the hw/driverr combo can pull off.

Quoted 8 lines
Quoted 5 lines

The story is different for the properties themselves, there you definitely need to make the name->prop id lookup, and you also need to do that mapping for each object separately (because the value range is attached to the prop, for uabi reasons, but might need to be per-object).

Daniel, this that mean that we're OK with moving DRM_ROTATE* [+others] to a ABI header?

With a big comment, but yeah this is special.
-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