Skip to contentSkip to conversation

drm/atomic: Add new reverse iterator over all plane state (V2)

PATCH In review S, Shirish 4 participants 4 messages Mar 1, 2018 – Mar 6, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1519890811-3638-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

S, Shirish

author
#2 lore raw

PATCH 1/1 drm/atomic: Add new reverse iterator over all plane state (V2)

From: Shirish S <[email protected]>

Add reverse iterator for_each_oldnew_plane_in_state_reverse to compliment the for_each_oldnew_plane_in_state way or reading plane states.

The plane states are required to be read in reverse order for amd drivers, cause the z order convention followed in linux is opposite to how the planes are supposed to be presented to DC engine, which is in common to both windows and linux.

V2: fix compile time errors due to -Werror flag.

---
 include/drm/drm_atomic.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
include/drm/drm_atomic.h +25 -0
@@ -754,6 +754,28 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
 			      (new_plane_state) = (__state)->planes[__i].new_state, 1))
 
 /**
+ * for_each_oldnew_plane_in_state_reverse - iterate over all planes in 
+an atomic
+ * update in reverse order
+ * @__state: &struct drm_atomic_state pointer
+ * @plane: &struct drm_plane iteration cursor
+ * @old_plane_state: &struct drm_plane_state iteration cursor for the 
+old state
+ * @new_plane_state: &struct drm_plane_state iteration cursor for the 
+new state
+ * @__i: int iteration cursor, for macro-internal use
+ *
+ * This iterates over all planes in an atomic update in reverse order,
+ * tracking both old and  new state. This is useful in places where the
+ * state delta needs to be considered, for example in atomic check functions.
+ */
+#define for_each_oldnew_plane_in_state_reverse(__state, plane, old_plane_state, new_plane_state, __i) \
+	for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1);	\
+	     (__i) >= 0;						\
+	     (__i)--)							\
+		for_each_if ((__state)->planes[__i].ptr &&		\
+			     ((plane) = (__state)->planes[__i].ptr,	\
+			      (old_plane_state) = (__state)->planes[__i].old_state,\
+			      (new_plane_state) = (__state)->planes[__i].new_state, 1))
+
+/**

* for_each_old_plane_in_state - iterate over all planes in an atomic update
* @__state: &struct drm_atomic_state pointer
* @plane: &struct drm_plane iteration cursor
--
2.7.4

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

#3 lore raw
Quoted 18 lines · Shirish

From: Shirish S <[email protected]>

Add reverse iterator for_each_oldnew_plane_in_state_reverse to compliment the for_each_oldnew_plane_in_state way or reading plane states.

The plane states are required to be read in reverse order for amd drivers, cause the z order convention followed in linux is opposite to how the planes are supposed to be presented to DC engine, which is in common to both windows and linux.

V2: fix compile time errors due to -Werror flag.

---
 include/drm/drm_atomic.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

include/drm/drm_atomic.h void drm_state_dump(struct drm_device *dev, struct drm_printer *p); · line 759

Quoted 6 lines
include/drm/drm_atomic.h +3 -0
@@ -754,6 +754,28 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
 			      (new_plane_state) = (__state)->planes[__i].new_state, 1))
 
 /**
+ * for_each_oldnew_plane_in_state_reverse - iterate over all planes in 
+an atomic
+ * update in reverse order

Looks good but can you check if docs build and render well with the newline in here? To build the docs run
make DOCBOOKS="" htmldocs
and then check that it renders correctly in Documentation/output/gpu/drm_kms.html

Harry

Quoted 26 lines
include/drm/drm_atomic.h +22 -1
+ * @__state: &struct drm_atomic_state pointer
+ * @plane: &struct drm_plane iteration cursor
+ * @old_plane_state: &struct drm_plane_state iteration cursor for the 
+old state
+ * @new_plane_state: &struct drm_plane_state iteration cursor for the 
+new state
+ * @__i: int iteration cursor, for macro-internal use
+ *
+ * This iterates over all planes in an atomic update in reverse order,
+ * tracking both old and  new state. This is useful in places where the
+ * state delta needs to be considered, for example in atomic check functions.
+ */
+#define for_each_oldnew_plane_in_state_reverse(__state, plane, old_plane_state, new_plane_state, __i) \
+	for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1);	\
+	     (__i) >= 0;						\
+	     (__i)--)							\
+		for_each_if ((__state)->planes[__i].ptr &&		\
+			     ((plane) = (__state)->planes[__i].ptr,	\
+			      (old_plane_state) = (__state)->planes[__i].old_state,\
+			      (new_plane_state) = (__state)->planes[__i].new_state, 1))
+
+/**
  * for_each_old_plane_in_state - iterate over all planes in an atomic update
  * @__state: &struct drm_atomic_state pointer
  * @plane: &struct drm_plane iteration cursor
--
Quoted 2 lines

2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 3498cf6f-384b-44c9-1924-ccbfa96f3704-5C7GfCeVMHo@public.gmane.org

#5 lore raw

Hi Harry,
It renders fine. I have attached generated doc for reference.

Regards
Pratik

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Harry Wentland
Sent: Tuesday, March 6, 2018 3:58 AM
To: S, Shirish <[email protected]>; Maling list - DRI developers <[email protected]>
Cc: Deucher, Alexander <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/atomic: Add new reverse iterator over all plane state (V2)

Quoted 19 lines · Shirish

From: Shirish S <[email protected]>

Add reverse iterator for_each_oldnew_plane_in_state_reverse to compliment the for_each_oldnew_plane_in_state way or reading plane states.

The plane states are required to be read in reverse order for amd drivers, cause the z order convention followed in linux is opposite to how the planes are supposed to be presented to DC engine, which is in common to both windows and linux.

V2: fix compile time errors due to -Werror flag.

---
 include/drm/drm_atomic.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
include/drm/drm_atomic.h index renamed from include/drm/drm_atomic.h +0 -0

cf13842..3fe8dde 100644

include/drm/drm_atomic.h void drm_state_dump(struct drm_device *dev, struct drm_printer *p); · line 759

Quoted 6 lines
include/drm/drm_atomic.h +3 -0
@@ -754,6 +754,28 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
 			      (new_plane_state) = (__state)->planes[__i].new_state, 1))
 
 /**
+ * for_each_oldnew_plane_in_state_reverse - iterate over all planes 
+in an atomic
+ * update in reverse order

Looks good but can you check if docs build and render well with the newline in here? To build the docs run
make DOCBOOKS="" htmldocs
and then check that it renders correctly in Documentation/output/gpu/drm_kms.html

Harry

Quoted 28 lines
include/drm/drm_atomic.h +24 -1
+ * @__state: &struct drm_atomic_state pointer
+ * @plane: &struct drm_plane iteration cursor
+ * @old_plane_state: &struct drm_plane_state iteration cursor for the 
+old state
+ * @new_plane_state: &struct drm_plane_state iteration cursor for the 
+new state
+ * @__i: int iteration cursor, for macro-internal use
+ *
+ * This iterates over all planes in an atomic update in reverse 
+order,
+ * tracking both old and  new state. This is useful in places where 
+the
+ * state delta needs to be considered, for example in atomic check functions.
+ */
+#define for_each_oldnew_plane_in_state_reverse(__state, plane, old_plane_state, new_plane_state, __i) \
+	for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1);	\
+	     (__i) >= 0;						\
+	     (__i)--)							\
+		for_each_if ((__state)->planes[__i].ptr &&		\
+			     ((plane) = (__state)->planes[__i].ptr,	\
+			      (old_plane_state) = (__state)->planes[__i].old_state,\
+			      (new_plane_state) = (__state)->planes[__i].new_state, 1))
+
+/**
  * for_each_old_plane_in_state - iterate over all planes in an atomic update
  * @__state: &struct drm_atomic_state pointer
  * @plane: &struct drm_plane iteration cursor
--
Quoted 2 lines

2.7.4

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

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

#6 lore raw
In reply to a message not in the archive
Quoted 1 line · Harry Wentland

make DOCBOOKS="" htmldocs

DOCBOOKS is no more. Simply 'make htmldocs' will do the same.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx