Skip to contentSkip to conversation

Reorganize the register picking macros

PATCH In review Paulo Zanoni 6 participants 20 messages Jun 13, 2017 – Jun 19, 2017

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

cover Reorganize the register picking macros

We have 3 different types of macros to pick registers with multiple instances and each of these types is coded in a different way. I like consistency, so I wrote this series in order to try to make our code a little more clear regarding our options and their differences.

Besides the consistency aspect, this series also does a few renames. I'm kinda afraid this series may get stuck in an endless bikeshed regarding the names. I know the current names are not very good, but at least the naming is consistent now, so I think there's value in merging the series. Regardless, I'm completely open to good naming suggestions.

The only test I've done in the series was to boot SKL. Let's see what the CI system has to say about it.

Cc Rodrigo Vivi <[email protected]>

Paulo Zanoni (7):
drm/i915: reorder the register picking macros drm/i915: _MMIO_PORT3 takes a port as an argument drm/i915: use variable arguments for the macros that call _PICK drm/i915: rename _PICK to _PICK3
drm/i915: add _PICK macro for the "a + index * (b - a)" macros drm/i915: also move version 2 of the register picking macros up drm/i915: extract a _PICK2 macro

 drivers/gpu/drm/i915/i915_reg.h | 69 +++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 33 deletions(-)
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/7 drm/i915: reorder the register picking macros

We currently have pipe, plane, trans, port, pll and phy versions of these macros. Reorder their definitions so all macros of each type are in their own group, separated by blank lines.

---
 drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -3
index 88e4707..a1d3cca 100644
@@ -52,19 +52,24 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
+#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
+
 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
+
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
+
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
-#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 #define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
 #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
 	_MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
+
+#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
+#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
+
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] drm/i915: reorder the register picking macros

Quoted 48 lines · Paulo Zanoni

We currently have pipe, plane, trans, port, pll and phy versions of these macros. Reorder their definitions so all macros of each type are in their own group, separated by blank lines.

---
 drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -4
index 88e4707..a1d3cca 100644
@@ -52,19 +52,24 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
+#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
+
 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
+
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
+
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
-#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 #define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
 #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)                        \
        _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
+
+#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
+#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
+
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
--

2.9.4

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 2/7 drm/i915: _MMIO_PORT3 takes a port as an argument

In reply to Paulo Zanoni

The macro takes a port as an argument, not a pipe.

---
 drivers/gpu/drm/i915/i915_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
index a1d3cca..1983b75 100644
@@ -62,7 +62,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
+#define _MMIO_PORT3(port, a, b, c) _MMIO(_PICK(port, a, b, c))
 #define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
 #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
 	_MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/7
#4 lore raw

Re: [PATCH 2/7] drm/i915: _MMIO_PORT3 takes a port as an argument

Although I'd prefer to kill it, this patch is right, so

Quoted 27 lines · Paulo Zanoni

The macro takes a port as an argument, not a pipe.

---
 drivers/gpu/drm/i915/i915_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -2
index a1d3cca..1983b75 100644
@@ -62,7 +62,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
+#define _MMIO_PORT3(port, a, b, c) _MMIO(_PICK(port, a, b, c))
 #define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
 #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)                        \
        _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
--

2.9.4

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 3/7 drm/i915: use variable arguments for the macros that call _PICK

In reply to Paulo Zanoni

There's no need to create a new macro every time the number of parameters change.

---
 drivers/gpu/drm/i915/i915_reg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -4
index 1983b75..1d5a0f8 100644
@@ -52,7 +52,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
+#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
@@ -62,8 +62,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PORT3(port, a, b, c) _MMIO(_PICK(port, a, b, c))
-#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
+#define _MMIO_PORT3(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
+#define _MMIO_PORT6(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
 	_MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
@@ -71,7 +71,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
-#define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
+#define _MMIO_PHY3(phy, ...) _MMIO(_PHY3(phy, __VA_ARGS__))
 
 #define _MASKED_FIELD(mask, value) ({					   \
 	if (__builtin_constant_p(mask))					   \
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 3/7] drm/i915: use variable arguments for the macros that call _PICK

Quoted 2 lines · Paulo Zanoni

There's no need to create a new macro every time the number of parameters change.

fully agree

Quoted 20 lines
---
 drivers/gpu/drm/i915/i915_reg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
index 1983b75..1d5a0f8 100644
@@ -52,7 +52,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
+#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 66

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +2 -2
@@ -62,8 +62,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PORT3(port, a, b, c) _MMIO(_PICK(port, a, b, c))
-#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
+#define _MMIO_PORT3(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
+#define _MMIO_PORT6(port, ...) _MMIO(_PICK(port, __VA_ARGS__))

so, what about unifying MMIO_PORT3 and MMIO_PORT6 at least?

MMIO_PORTS, MMIO_PICK?

Quoted 19 lines
drivers/gpu/drm/i915/i915_reg.h +1 -2
 #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)                        \
        _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
@@ -71,7 +71,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
-#define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
+#define _MMIO_PHY3(phy, ...) _MMIO(_PHY3(phy, __VA_ARGS__))
 
 #define _MASKED_FIELD(mask, value) ({                                     \
        if (__builtin_constant_p(mask))                                    \
--

2.9.4

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 4/7 drm/i915: rename _PICK to _PICK3

In reply to Paulo Zanoni

All of the macros that call _PICK are named _X_3, so let's rename _PICK to _PICK3. The reason we're doing this is because we're going to have _PICK and _PICK2. Consider _PICK3 as the third variation of the PICK macros (well, actually it *is* the third variation...).

---
 drivers/gpu/drm/i915/i915_reg.h | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +16 -17
index 1d5a0f8..d271098 100644
@@ -48,11 +48,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 	return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
 }
 
-#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
+#define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK(pipe, __VA_ARGS__))
+#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
@@ -62,15 +62,14 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PORT3(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
-#define _MMIO_PORT6(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
-#define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
-	_MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
+#define _MMIO_PORT3(port, ...) _MMIO(_PICK3(port, __VA_ARGS__))
+#define _MMIO_PORT3_LN(port, ln, a0, a1, b, c, d, e, f)			\
+	_MMIO(_PICK3(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
 #define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
-#define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
+#define _PHY3(phy, ...) _PICK3(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, ...) _MMIO(_PHY3(phy, __VA_ARGS__))
 
 #define _MASKED_FIELD(mask, value) ({					   \
@@ -1709,14 +1708,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_PCS_DW1_LN0_C		0x162C04
 #define _CNL_PORT_PCS_DW1_LN0_D		0x162E04
 #define _CNL_PORT_PCS_DW1_LN0_F		0x162804
-#define CNL_PORT_PCS_DW1_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_PCS_DW1_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_PCS_DW1_GRP_AE, \
 						    _CNL_PORT_PCS_DW1_GRP_B, \
 						    _CNL_PORT_PCS_DW1_GRP_C, \
 						    _CNL_PORT_PCS_DW1_GRP_D, \
 						    _CNL_PORT_PCS_DW1_GRP_AE, \
 						    _CNL_PORT_PCS_DW1_GRP_F)
-#define CNL_PORT_PCS_DW1_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_PCS_DW1_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_PCS_DW1_LN0_AE, \
 						    _CNL_PORT_PCS_DW1_LN0_B, \
 						    _CNL_PORT_PCS_DW1_LN0_C, \
@@ -1735,14 +1734,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW2_LN0_C		0x162C48
 #define _CNL_PORT_TX_DW2_LN0_D		0x162E48
 #define _CNL_PORT_TX_DW2_LN0_F		0x162A48
-#define CNL_PORT_TX_DW2_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW2_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW2_GRP_AE, \
 						    _CNL_PORT_TX_DW2_GRP_B, \
 						    _CNL_PORT_TX_DW2_GRP_C, \
 						    _CNL_PORT_TX_DW2_GRP_D, \
 						    _CNL_PORT_TX_DW2_GRP_AE, \
 						    _CNL_PORT_TX_DW2_GRP_F)
-#define CNL_PORT_TX_DW2_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW2_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW2_LN0_AE, \
 						    _CNL_PORT_TX_DW2_LN0_B, \
 						    _CNL_PORT_TX_DW2_LN0_C, \
@@ -1764,14 +1763,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW4_LN0_C		0x162C50
 #define _CNL_PORT_TX_DW4_LN0_D		0x162E50
 #define _CNL_PORT_TX_DW4_LN0_F		0x162850
-#define CNL_PORT_TX_DW4_GRP(port)       _MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW4_GRP(port)       _MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW4_GRP_AE, \
 						    _CNL_PORT_TX_DW4_GRP_B, \
 						    _CNL_PORT_TX_DW4_GRP_C, \
 						    _CNL_PORT_TX_DW4_GRP_D, \
 						    _CNL_PORT_TX_DW4_GRP_AE, \
 						    _CNL_PORT_TX_DW4_GRP_F)
-#define CNL_PORT_TX_DW4_LN(port, ln)       _MMIO_PORT6_LN(port, ln,	\
+#define CNL_PORT_TX_DW4_LN(port, ln)       _MMIO_PORT3_LN(port, ln,	\
 						    _CNL_PORT_TX_DW4_LN0_AE, \
 						    _CNL_PORT_TX_DW4_LN1_AE, \
 						    _CNL_PORT_TX_DW4_LN0_B, \
@@ -1794,14 +1793,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW5_LN0_C		0x162C54
 #define _CNL_PORT_TX_DW5_LN0_D		0x162ED4
 #define _CNL_PORT_TX_DW5_LN0_F		0x162854
-#define CNL_PORT_TX_DW5_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW5_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW5_GRP_AE, \
 						    _CNL_PORT_TX_DW5_GRP_B, \
 						    _CNL_PORT_TX_DW5_GRP_C, \
 						    _CNL_PORT_TX_DW5_GRP_D, \
 						    _CNL_PORT_TX_DW5_GRP_AE, \
 						    _CNL_PORT_TX_DW5_GRP_F)
-#define CNL_PORT_TX_DW5_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW5_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW5_LN0_AE, \
 						    _CNL_PORT_TX_DW5_LN0_B, \
 						    _CNL_PORT_TX_DW5_LN0_C, \
@@ -1823,14 +1822,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW7_LN0_C		0x162C5C
 #define _CNL_PORT_TX_DW7_LN0_D		0x162EDC
 #define _CNL_PORT_TX_DW7_LN0_F		0x16285C
-#define CNL_PORT_TX_DW7_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW7_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW7_GRP_AE, \
 						    _CNL_PORT_TX_DW7_GRP_B, \
 						    _CNL_PORT_TX_DW7_GRP_C, \
 						    _CNL_PORT_TX_DW7_GRP_D, \
 						    _CNL_PORT_TX_DW7_GRP_AE, \
 						    _CNL_PORT_TX_DW7_GRP_F)
-#define CNL_PORT_TX_DW7_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW7_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW7_LN0_AE, \
 						    _CNL_PORT_TX_DW7_LN0_B, \
 						    _CNL_PORT_TX_DW7_LN0_C, \
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#8 lore raw

Re: [PATCH 4/7] drm/i915: rename _PICK to _PICK3

Quoted 4 lines · Paulo Zanoni

All of the macros that call _PICK are named _X_3, so let's rename _PICK to _PICK3. The reason we're doing this is because we're going to have _PICK and _PICK2. Consider _PICK3 as the third variation of the PICK macros (well, actually it *is* the third variation...).

I named it PICK because it "picks" one of a list, i.e. it doesn't compute anything. I guess I'd like to keep the name.

BR,
Jani.

Quoted 129 lines
---
 drivers/gpu/drm/i915/i915_reg.h | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +16 -17
index 1d5a0f8..d271098 100644
@@ -48,11 +48,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 	return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
 }
 
-#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
+#define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK(pipe, __VA_ARGS__))
+#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
 #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
@@ -62,15 +62,14 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
-#define _MMIO_PORT3(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
-#define _MMIO_PORT6(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
-#define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f)			\
-	_MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
+#define _MMIO_PORT3(port, ...) _MMIO(_PICK3(port, __VA_ARGS__))
+#define _MMIO_PORT3_LN(port, ln, a0, a1, b, c, d, e, f)			\
+	_MMIO(_PICK3(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
 #define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
-#define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
+#define _PHY3(phy, ...) _PICK3(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, ...) _MMIO(_PHY3(phy, __VA_ARGS__))
 
 #define _MASKED_FIELD(mask, value) ({					   \
@@ -1709,14 +1708,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_PCS_DW1_LN0_C		0x162C04
 #define _CNL_PORT_PCS_DW1_LN0_D		0x162E04
 #define _CNL_PORT_PCS_DW1_LN0_F		0x162804
-#define CNL_PORT_PCS_DW1_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_PCS_DW1_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_PCS_DW1_GRP_AE, \
 						    _CNL_PORT_PCS_DW1_GRP_B, \
 						    _CNL_PORT_PCS_DW1_GRP_C, \
 						    _CNL_PORT_PCS_DW1_GRP_D, \
 						    _CNL_PORT_PCS_DW1_GRP_AE, \
 						    _CNL_PORT_PCS_DW1_GRP_F)
-#define CNL_PORT_PCS_DW1_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_PCS_DW1_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_PCS_DW1_LN0_AE, \
 						    _CNL_PORT_PCS_DW1_LN0_B, \
 						    _CNL_PORT_PCS_DW1_LN0_C, \
@@ -1735,14 +1734,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW2_LN0_C		0x162C48
 #define _CNL_PORT_TX_DW2_LN0_D		0x162E48
 #define _CNL_PORT_TX_DW2_LN0_F		0x162A48
-#define CNL_PORT_TX_DW2_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW2_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW2_GRP_AE, \
 						    _CNL_PORT_TX_DW2_GRP_B, \
 						    _CNL_PORT_TX_DW2_GRP_C, \
 						    _CNL_PORT_TX_DW2_GRP_D, \
 						    _CNL_PORT_TX_DW2_GRP_AE, \
 						    _CNL_PORT_TX_DW2_GRP_F)
-#define CNL_PORT_TX_DW2_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW2_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW2_LN0_AE, \
 						    _CNL_PORT_TX_DW2_LN0_B, \
 						    _CNL_PORT_TX_DW2_LN0_C, \
@@ -1764,14 +1763,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW4_LN0_C		0x162C50
 #define _CNL_PORT_TX_DW4_LN0_D		0x162E50
 #define _CNL_PORT_TX_DW4_LN0_F		0x162850
-#define CNL_PORT_TX_DW4_GRP(port)       _MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW4_GRP(port)       _MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW4_GRP_AE, \
 						    _CNL_PORT_TX_DW4_GRP_B, \
 						    _CNL_PORT_TX_DW4_GRP_C, \
 						    _CNL_PORT_TX_DW4_GRP_D, \
 						    _CNL_PORT_TX_DW4_GRP_AE, \
 						    _CNL_PORT_TX_DW4_GRP_F)
-#define CNL_PORT_TX_DW4_LN(port, ln)       _MMIO_PORT6_LN(port, ln,	\
+#define CNL_PORT_TX_DW4_LN(port, ln)       _MMIO_PORT3_LN(port, ln,	\
 						    _CNL_PORT_TX_DW4_LN0_AE, \
 						    _CNL_PORT_TX_DW4_LN1_AE, \
 						    _CNL_PORT_TX_DW4_LN0_B, \
@@ -1794,14 +1793,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW5_LN0_C		0x162C54
 #define _CNL_PORT_TX_DW5_LN0_D		0x162ED4
 #define _CNL_PORT_TX_DW5_LN0_F		0x162854
-#define CNL_PORT_TX_DW5_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW5_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW5_GRP_AE, \
 						    _CNL_PORT_TX_DW5_GRP_B, \
 						    _CNL_PORT_TX_DW5_GRP_C, \
 						    _CNL_PORT_TX_DW5_GRP_D, \
 						    _CNL_PORT_TX_DW5_GRP_AE, \
 						    _CNL_PORT_TX_DW5_GRP_F)
-#define CNL_PORT_TX_DW5_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW5_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW5_LN0_AE, \
 						    _CNL_PORT_TX_DW5_LN0_B, \
 						    _CNL_PORT_TX_DW5_LN0_C, \
@@ -1823,14 +1822,14 @@ enum skl_disp_power_wells {
 #define _CNL_PORT_TX_DW7_LN0_C		0x162C5C
 #define _CNL_PORT_TX_DW7_LN0_D		0x162EDC
 #define _CNL_PORT_TX_DW7_LN0_F		0x16285C
-#define CNL_PORT_TX_DW7_GRP(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW7_GRP(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW7_GRP_AE, \
 						    _CNL_PORT_TX_DW7_GRP_B, \
 						    _CNL_PORT_TX_DW7_GRP_C, \
 						    _CNL_PORT_TX_DW7_GRP_D, \
 						    _CNL_PORT_TX_DW7_GRP_AE, \
 						    _CNL_PORT_TX_DW7_GRP_F)
-#define CNL_PORT_TX_DW7_LN0(port)	_MMIO_PORT6(port, \
+#define CNL_PORT_TX_DW7_LN0(port)	_MMIO_PORT3(port, \
 						    _CNL_PORT_TX_DW7_LN0_AE, \
 						    _CNL_PORT_TX_DW7_LN0_B, \
 						    _CNL_PORT_TX_DW7_LN0_C, \
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 5/7 drm/i915: add _PICK macro for the "a + index * (b - a)" macros

In reply to Paulo Zanoni

Instead of duplicating the macro everywhere, add a single definition for it and call it just like we do with the _PICK3 macros.

---
 drivers/gpu/drm/i915/i915_reg.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -7
index d271098..3e46ba1 100644
@@ -48,25 +48,26 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 	return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
 }
 
+#define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
-#define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
+#define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
-#define _PLANE(plane, a, b) _PIPE(plane, a, b)
-#define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
+#define _PLANE(plane, a, b) _PICK(plane, a, b)
+#define _MMIO_PLANE(plane, a, b) _MMIO(_PLANE(plane, a, b))
 
-#define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
+#define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 
-#define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
+#define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
 #define _MMIO_PORT3(port, ...) _MMIO(_PICK3(port, __VA_ARGS__))
 #define _MMIO_PORT3_LN(port, ln, a0, a1, b, c, d, e, f)			\
 	_MMIO(_PICK3(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
-#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
+#define _PLL(pll, a, b) _PICK(pll, a, b)
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
 #define _PHY3(phy, ...) _PICK3(phy, __VA_ARGS__)
@@ -6415,7 +6416,7 @@ enum {
 #define _PS_ECC_STAT_2B     0x68AD0
 #define _PS_ECC_STAT_1C     0x691D0
 
-#define _ID(id, a, b) ((a) + (id)*((b)-(a)))
+#define _ID(id, a, b) _PICK(id, a, b)
 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe,        \
 			_ID(id, _PS_1A_CTRL, _PS_2A_CTRL),       \
 			_ID(id, _PS_1B_CTRL, _PS_2B_CTRL))
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#10 lore raw

Re: [PATCH 5/7] drm/i915: add _PICK macro for the "a + index * (b - a)" macros

Quoted 13 lines · Paulo Zanoni

Instead of duplicating the macro everywhere, add a single definition for it and call it just like we do with the _PICK3 macros.

---
 drivers/gpu/drm/i915/i915_reg.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index d271098..3e46ba1 100644

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 51

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -48,25 +48,26 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 	return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
 }
 
+#define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))

The change overall is good but I'd name this in a way that emphasizes the registers are evenly spaced. _LINEAR?

BR,
Jani.

Quoted 37 lines
drivers/gpu/drm/i915/i915_reg.h +7 -7
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
-#define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
+#define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
-#define _PLANE(plane, a, b) _PIPE(plane, a, b)
-#define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
+#define _PLANE(plane, a, b) _PICK(plane, a, b)
+#define _MMIO_PLANE(plane, a, b) _MMIO(_PLANE(plane, a, b))
 
-#define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
+#define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 
-#define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
+#define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
 #define _MMIO_PORT3(port, ...) _MMIO(_PICK3(port, __VA_ARGS__))
 #define _MMIO_PORT3_LN(port, ln, a0, a1, b, c, d, e, f)			\
 	_MMIO(_PICK3(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
-#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
+#define _PLL(pll, a, b) _PICK(pll, a, b)
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
 #define _PHY3(phy, ...) _PICK3(phy, __VA_ARGS__)
@@ -6415,7 +6416,7 @@ enum {
 #define _PS_ECC_STAT_2B     0x68AD0
 #define _PS_ECC_STAT_1C     0x691D0
 
-#define _ID(id, a, b) ((a) + (id)*((b)-(a)))
+#define _ID(id, a, b) _PICK(id, a, b)
 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe,        \
 			_ID(id, _PS_1A_CTRL, _PS_2A_CTRL),       \
 			_ID(id, _PS_1B_CTRL, _PS_2B_CTRL))
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH 5/7] drm/i915: add _PICK macro for the "a + index * (b - a)" macros

Quoted 25 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Jani Nikula
Sent: Friday, June 16, 2017 1:56 AM
To: Zanoni, Paulo R <[email protected]>; intel- [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 5/7] drm/i915: add _PICK macro for the "a + index * (b - a)" macros

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t

Quoted 13 lines · Paulo Zanoni

Instead of duplicating the macro everywhere, add a single definition for it and call it just like we do with the _PICK3 macros.

---
 drivers/gpu/drm/i915/i915_reg.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h index d271098..3e46ba1 100644

drivers/gpu/drm/i915/i915_reg.h +0 -0
@@ -48,25 +48,26 @@ static inline bool i915_mmio_reg_valid(i915_reg_t

reg)

Quoted 6 lines

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 51

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
 	return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);  }
 
+#define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))

The change overall is good but I'd name this in a way that emphasizes the registers are evenly spaced. _LINEAR?

Also as we discussed, will publish the changes for handling scenario when a>b. Currently it will work only when b>a.

Regards,
Madhav

Quoted 38 lines

BR,
Jani.

Quoted 12 lines
drivers/gpu/drm/i915/i915_reg.h +3 -2
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__
 })[__index])
 
-#define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
+#define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))  #define
 _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
-#define _PLANE(plane, a, b) _PIPE(plane, a, b) -#define
 _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
+#define _PLANE(plane, a, b) _PICK(plane, a, b) #define
+_MMIO_PLANE(plane, a, b) _MMIO(_PLANE(plane, a, b))

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg)

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +2 -2
 
-#define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
+#define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 
-#define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
+#define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))  #define
 _MMIO_PORT3(port, ...) _MMIO(_PICK3(port, __VA_ARGS__))
 #define _MMIO_PORT3_LN(port, ln, a0, a1, b, c, d, e, f)
	\
Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
 	_MMIO(_PICK3(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
 
-#define _PLL(pll, a, b) ((a) + (pll)*((b)-(a)))
+#define _PLL(pll, a, b) _PICK(pll, a, b)
 #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
 
 #define _PHY3(phy, ...) _PICK3(phy, __VA_ARGS__) @@ -6415,7 +6416,7

@@ enum {
#define _PS_ECC_STAT_2B 0x68AD0
#define _PS_ECC_STAT_1C 0x691D0

Quoted 12 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 6422

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
-#define _ID(id, a, b) ((a) + (id)*((b)-(a)))
+#define _ID(id, a, b) _PICK(id, a, b)
 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe,        \
 			_ID(id, _PS_1A_CTRL, _PS_2A_CTRL),       \
 			_ID(id, _PS_1B_CTRL, _PS_2B_CTRL))

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

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

#12 lore raw

PATCH 6/7 drm/i915: also move version 2 of the register picking macros up

In reply to Paulo Zanoni

Make sure all the macros are next to each other so it's easier to spot all the options available.

---
 drivers/gpu/drm/i915/i915_reg.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -8
index 3e46ba1..a97af4a 100644
@@ -53,6 +53,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
+#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
+	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
+	dev_priv->info.display_mmio_offset)
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PICK(plane, a, b)
@@ -60,6 +63,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
+#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
+	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
+	dev_priv->info.display_mmio_offset)
 
 #define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
@@ -3700,10 +3706,6 @@ enum {
 #define CHV_TRANSCODER_C_OFFSET 0x63000
 #define TRANSCODER_EDP_OFFSET 0x6f000
 
-#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
-	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
-
 #define HTOTAL(trans)		_MMIO_TRANS2(trans, _HTOTAL_A)
 #define HBLANK(trans)		_MMIO_TRANS2(trans, _HBLANK_A)
 #define HSYNC(trans)		_MMIO_TRANS2(trans, _HSYNC_A)
@@ -5189,10 +5191,6 @@ enum {
  */
 #define PIPE_EDP_OFFSET	0x7f000
 
-#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
-	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
-
 #define PIPECONF(pipe)		_MMIO_PIPE2(pipe, _PIPEACONF)
 #define PIPEDSL(pipe)		_MMIO_PIPE2(pipe, _PIPEADSL)
 #define PIPEFRAME(pipe)		_MMIO_PIPE2(pipe, _PIPEAFRAMEHIGH)
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#13 lore raw

Re: [PATCH 6/7] drm/i915: also move version 2 of the register picking macros up

Quoted 2 lines · Paulo Zanoni

Make sure all the macros are next to each other so it's easier to spot all the options available.

Please also move _MIPI_PORT and _MMIO_MIPI up. Btw they're another variant...

BR,
Jani.

Quoted 52 lines
---
 drivers/gpu/drm/i915/i915_reg.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -8
index 3e46ba1..a97af4a 100644
@@ -53,6 +53,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
+#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
+	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
+	dev_priv->info.display_mmio_offset)
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PICK(plane, a, b)
@@ -60,6 +63,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
+#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
+	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
+	dev_priv->info.display_mmio_offset)
 
 #define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
@@ -3700,10 +3706,6 @@ enum {
 #define CHV_TRANSCODER_C_OFFSET 0x63000
 #define TRANSCODER_EDP_OFFSET 0x6f000
 
-#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
-	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
-
 #define HTOTAL(trans)		_MMIO_TRANS2(trans, _HTOTAL_A)
 #define HBLANK(trans)		_MMIO_TRANS2(trans, _HBLANK_A)
 #define HSYNC(trans)		_MMIO_TRANS2(trans, _HSYNC_A)
@@ -5189,10 +5191,6 @@ enum {
  */
 #define PIPE_EDP_OFFSET	0x7f000
 
-#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
-	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
-
 #define PIPECONF(pipe)		_MMIO_PIPE2(pipe, _PIPEACONF)
 #define PIPEDSL(pipe)		_MMIO_PIPE2(pipe, _PIPEADSL)
 #define PIPEFRAME(pipe)		_MMIO_PIPE2(pipe, _PIPEAFRAMEHIGH)
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 7/7 drm/i915: extract a _PICK2 macro

In reply to Paulo Zanoni

Do it just like we do with _PICK and _PICK3, so our code looks a little more uniform.

---
 drivers/gpu/drm/i915/i915_reg.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -6
index a97af4a..3fb7b63 100644
@@ -49,13 +49,14 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 }
 
 #define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))
+#define _PICK2(__index, __offsets, a) (__offsets[__index] - __offsets[0] + \
+				       (a) + dev_priv->info.display_mmio_offset)
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
 #define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
-	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
+#define _MMIO_PIPE2(pipe, reg) _MMIO(_PICK2(pipe, dev_priv->info.pipe_offsets, \
+					    reg))
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PICK(plane, a, b)
@@ -63,9 +64,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
-#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
-	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
+#define _MMIO_TRANS2(tran, reg) _MMIO(_PICK2(tran, \
+					     dev_priv->info.trans_offsets, reg))
 
 #define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [PATCH 7/7] drm/i915: extract a _PICK2 macro

Quoted 31 lines · Paulo Zanoni

Do it just like we do with _PICK and _PICK3, so our code looks a little more uniform.

---
 drivers/gpu/drm/i915/i915_reg.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -3
index a97af4a..3fb7b63 100644
@@ -49,13 +49,14 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 }
 
 #define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))
+#define _PICK2(__index, __offsets, a) (__offsets[__index] - __offsets[0] + \
+				       (a) + dev_priv->info.display_mmio_offset)
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
 #define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
-	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
+#define _MMIO_PIPE2(pipe, reg) _MMIO(_PICK2(pipe, dev_priv->info.pipe_offsets, \
+					    reg))
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PICK(plane, a, b)

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 68

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +2 -3
@@ -63,9 +64,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
-#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
-	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
+#define _MMIO_TRANS2(tran, reg) _MMIO(_PICK2(tran, \
+					     dev_priv->info.trans_offsets, reg))

No love for cursor/palette offsets?

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
 #define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [PATCH 7/7] drm/i915: extract a _PICK2 macro

Em Qua, 2017-06-14 às 18:16 +0300, Ville Syrjälä escreveu:

Quoted 44 lines · Paulo Zanoni
Quoted 43 lines

Do it just like we do with _PICK and _PICK3, so our code looks a little more uniform.

---
 drivers/gpu/drm/i915/i915_reg.h | 12 ++++++------

 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index a97af4a..3fb7b63 100644
@@ -49,13 +49,14 @@ static inline bool
 i915_mmio_reg_valid(i915_reg_t reg)
  }


 #define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a))) +#define _PICK2(__index, __offsets, a) (__offsets[__index] - __offsets[0] + \

drivers/gpu/drm/i915/i915_reg.h +1 -0
+				       (a) + dev_priv-
Quoted 1 line

info.display_mmio_offset)

 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])

 #define _PIPE(pipe, a, b) _PICK(pipe, a, b) #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b)) -#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv-

Quoted 1 line

info.pipe_offsets[pipe] - \

drivers/gpu/drm/i915/i915_reg.h +1 -2
-	dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
+#define _MMIO_PIPE2(pipe, reg) _MMIO(_PICK2(pipe, dev_priv-
Quoted 1 line

info.pipe_offsets, \

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					    reg))

 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 #define _PLANE(plane, a, b) _PICK(plane, a, b)

drivers/gpu/drm/i915/i915_reg.h +0 -0
@@ -63,9 +64,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t
 reg)


 #define _TRANS(tran, a, b) _PICK(tran, a, b) #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b)) -#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv-

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

info.trans_offsets[(pipe)] - \

drivers/gpu/drm/i915/i915_reg.h +2 -2
-	dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-	dev_priv->info.display_mmio_offset)
+#define _MMIO_TRANS2(tran, reg) _MMIO(_PICK2(tran, \
+					     dev_priv-
Quoted 1 line

info.trans_offsets, reg))

No love for cursor/palette offsets?

I missed them. _CURSOR definitely fits the model. I'll see what we can do with PALLETTE.

Quoted 7 lines
Quoted 7 lines


 #define _PORT(port, a, b) _PICK(port, a, b) #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b)) --
2.9.4

Quoted 6 lines
Quoted 4 lines

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

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

#17 lore raw

Re: [PATCH 7/7] drm/i915: extract a _PICK2 macro

In reply to Ville Syrjälä
Quoted 9 lines · Ville Syrjälä
Quoted 8 lines · Paulo Zanoni

Do it just like we do with _PICK and _PICK3, so our code looks a little more uniform.

---
 drivers/gpu/drm/i915/i915_reg.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Quoted 7 lines

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 50

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
index a97af4a..3fb7b63 100644
@@ -49,13 +49,14 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 }
 

yeap, as you predicted on the cover letter here starts the name bikeshedings ;)

Quoted 1 line

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 51

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +0 -0
 #define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))

for me this is more like a "guess" based on the gap, but specially I have concern about reusing the name that was for a totally different use. PICK before this list is a "select from a list" and after this series is "select base on uniform gap"

Quoted 2 lines

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 53

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+#define _PICK2(__index, __offsets, a) (__offsets[__index] - __offsets[0] + \
+                                    (a) + dev_priv->info.display_mmio_offset)

and this is a select based on common base offset.

Quoted 1 line

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 54

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +0 -0
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])

and this is actual pick from a list

also I don't like the numbers as versions of the macro... I'd prefer to use just in number of arguments as before.

so, what about:

s/PICK(/PICK_GAP
s/PICK2/PICK_OFFSET
s/PICK3/PICK_LIST

?

or

s/PICK(/SELECT_GAP
s/PICK2/SELECT_OFFSET
s/PICK3/SELECT_LIST

?

Quoted 41 lines
Quoted 12 lines
drivers/gpu/drm/i915/i915_reg.h +2 -3
 #define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
-     dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-     dev_priv->info.display_mmio_offset)
+#define _MMIO_PIPE2(pipe, reg) _MMIO(_PICK2(pipe, dev_priv->info.pipe_offsets, \
+                                         reg))
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PICK(plane, a, b)

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 68

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +2 -3
@@ -63,9 +64,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
-#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
-     dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-     dev_priv->info.display_mmio_offset)
+#define _MMIO_TRANS2(tran, reg) _MMIO(_PICK2(tran, \
+                                          dev_priv->info.trans_offsets, reg))

No love for cursor/palette offsets?

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +0 -1
 #define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
--

2.9.4

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

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#18 lore raw

Re: [PATCH 7/7] drm/i915: extract a _PICK2 macro

Quoted 37 lines · Rodrigo Vivi
Quoted 9 lines · Ville Syrjälä
Quoted 8 lines · Paulo Zanoni

Do it just like we do with _PICK and _PICK3, so our code looks a little more uniform.

---
 drivers/gpu/drm/i915/i915_reg.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Quoted 7 lines

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 50

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
index a97af4a..3fb7b63 100644
@@ -49,13 +49,14 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 }
 

yeap, as you predicted on the cover letter here starts the name bikeshedings ;)

Quoted 1 line

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 51

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +0 -0
 #define _PICK(__index, a, b) ((a) + (__index) * ((b) - (a)))

for me this is more like a "guess" based on the gap, but specially I have concern about reusing the name that was for a totally different use. PICK before this list is a "select from a list" and after this series is "select base on uniform gap"

Quoted 2 lines

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 53

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+#define _PICK2(__index, __offsets, a) (__offsets[__index] - __offsets[0] + \
+                                    (a) + dev_priv->info.display_mmio_offset)

and this is a select based on common base offset.

Quoted 1 line

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 54

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +0 -0
 #define _PICK3(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])

and this is actual pick from a list

Quoted 8 lines

also I don't like the numbers as versions of the macro... I'd prefer to use just in number of arguments as before.

so, what about:

s/PICK(/PICK_GAP
s/PICK2/PICK_OFFSET
s/PICK3/PICK_LIST

Just _LINEAR, _ARRAY, _PICK.

Or PICK_LINEAR, PICK_ARRAY, PICK_VA (or PICK_ARGS).

BR,
Jani.

Quoted 52 lines

?

or

s/PICK(/SELECT_GAP
s/PICK2/SELECT_OFFSET
s/PICK3/SELECT_LIST

?

Quoted 41 lines
Quoted 12 lines
drivers/gpu/drm/i915/i915_reg.h +2 -3
 #define _PIPE(pipe, a, b) _PICK(pipe, a, b)
 #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
-#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
-     dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
-     dev_priv->info.display_mmio_offset)
+#define _MMIO_PIPE2(pipe, reg) _MMIO(_PICK2(pipe, dev_priv->info.pipe_offsets, \
+                                         reg))
 #define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK3(pipe, __VA_ARGS__))
 
 #define _PLANE(plane, a, b) _PICK(plane, a, b)

drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 68

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +2 -3
@@ -63,9 +64,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 
 #define _TRANS(tran, a, b) _PICK(tran, a, b)
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
-#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
-     dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
-     dev_priv->info.display_mmio_offset)
+#define _MMIO_TRANS2(tran, reg) _MMIO(_PICK2(tran, \
+                                          dev_priv->info.trans_offsets, reg))

No love for cursor/palette offsets?

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +0 -1
 #define _PORT(port, a, b) _PICK(port, a, b)
 #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
--

2.9.4

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

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

✓ Fi.CI.BAT: success for Reorganize the register picking macros

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: Reorganize the register picking macros
URL : https://patchwork.freedesktop.org/series/25730/
State : success

== Summary ==

Series 25730v1 Reorganize the register picking macros
https://patchwork.freedesktop.org/api/1.0/series/25730/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-r) fdo#100125

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:440s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:431s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:581s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:510s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:481s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:476s
fi-glk-2a        total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:585s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:430s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:417s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:417s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:488s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:465s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:463s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:570s
fi-kbl-r         total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time:579s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:468s
fi-skl-6700hq    total:278  pass:228  dwarn:1   dfail:0   fail:27  skip:22  time:404s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:467s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:478s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:435s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:539s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:405s

d4bedb8b0f9ba91df2e8cb136a489145a83e96a7 drm-tip: 2017y-06m-13d-14h-22m-46s UTC integration manifest 293f16c drm/i915: extract a _PICK2 macro
d16974b drm/i915: also move version 2 of the register picking macros up
f88a397 drm/i915: add _PICK macro for the "a + index * (b - a)" macros
9beadfe drm/i915: rename _PICK to _PICK3
0b0036b drm/i915: use variable arguments for the macros that call _PICK
2c8d3c4 drm/i915: _MMIO_PORT3 takes a port as an argument
6311637 drm/i915: reorder the register picking macros

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4944/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx