Skip to contentSkip to conversation

Some initial tidy-ups and refactoring

PATCH Joel Holdsworth 3 participants 4 messages Aug 11, 2014 – Aug 12, 2014 2 messages not in the archive

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

The patches contain some tidy-up work, and refactoring that has arisen as a by-product of my initial work on adding TV support to nv50.

Best Regards
Joel Holdsworth

From 3bb0d2f6d3c08bdd5fbcf953f2b4d327e4624663 Mon Sep 17 00:00:00 2001
From: Joel Holdsworth <joel-IJEoVVyKhCJXvIrf17iDB/[email protected]>
Date: Sat, 7 Jun 2014 13:10:59 +0100
Subject: [PATCH 1/4] drm/nouveau: Removed unneeded include in nvc0_fence.c

---
 drivers/gpu/drm/nouveau/nvc0_fence.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/nouveau/nvc0_fence.c +0 -2
index becf19a..c9fc6f7 100644
@@ -26,8 +26,6 @@
 #include "nouveau_dma.h"
 #include "nouveau_fence.h"
 
-#include "nv50_display.h"
-
 static int
 nvc0_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
 {
Signature · 1 line
1.9.1

From b47ad53d2bb492d480b4d42b6229902dd4d9728e Mon Sep 17 00:00:00 2001
From: Joel Holdsworth <joel-IJEoVVyKhCJXvIrf17iDB/[email protected]>
Date: Mon, 11 Aug 2014 18:42:54 +0100
Subject: [PATCH 2/4] drm/nouveau: Replaced magic numbers with defines from
nouveau_reg

---
 drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c | 27 +++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c +16 -11
index b36addf..61e29d6 100644
@@ -31,11 +31,12 @@
 #include <subdev/timer.h>
 
 #include "nv50.h"
+#include "nouveau_reg.h"
 
 int
 nv50_dac_power(NV50_DISP_MTHD_V1)
 {
-	const u32 doff = outp->or * 0x800;
+	const u32 dpms_ctrl = NV50_PDISPLAY_DAC_DPMS_CTRL(outp->or);
 	union {
 		struct nv50_disp_dac_pwr_v0 v0;
 	} *args = data;
@@ -55,19 +56,21 @@ nv50_dac_power(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
-	nv_wait(priv, 0x61a004 + doff, 0x80000000, 0x00000000);
-	nv_mask(priv, 0x61a004 + doff, 0xc000007f, 0x80000000 | stat);
-	nv_wait(priv, 0x61a004 + doff, 0x80000000, 0x00000000);
+	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
+	nv_mask(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x4000007f,
+		NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | stat);
+	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
 	return 0;
 }
 
 int
 nv50_dac_sense(NV50_DISP_MTHD_V1)
 {
+	const u32 dpms_ctrl = NV50_PDISPLAY_DAC_DPMS_CTRL(outp->or);
+	const u32 load_ctrl = NV50_PDISPLAY_DAC_LOAD_CTRL(outp->or);
 	union {
 		struct nv50_disp_dac_load_v0 v0;
 	} *args = data;
-	const u32 doff = outp->or * 0x800;
 	u32 loadval;
 	int ret;
 
@@ -81,16 +84,18 @@ nv50_dac_sense(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
-	nv_mask(priv, 0x61a004 + doff, 0x807f0000, 0x80150000);
-	nv_wait(priv, 0x61a004 + doff, 0x80000000, 0x00000000);
+	nv_mask(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x007f0000,
+		NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x00150000);
+	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
 
-	nv_wr32(priv, 0x61a00c + doff, 0x00100000 | loadval);
+	nv_wr32(priv, load_ctrl, 0x00100000 | loadval);
 	mdelay(9);
 	udelay(500);
-	loadval = nv_mask(priv, 0x61a00c + doff, 0xffffffff, 0x00000000);
+	loadval = nv_mask(priv, load_ctrl, 0xffffffff, 0x00000000);
 
-	nv_mask(priv, 0x61a004 + doff, 0x807f0000, 0x80550000);
-	nv_wait(priv, 0x61a004 + doff, 0x80000000, 0x00000000);
+	nv_mask(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x007f0000,
+		NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x00550000);
+	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
 
 	nv_debug(priv, "DAC%d sense: 0x%08x\n", outp->or, loadval);
 	if (!(loadval & 0x80000000))
Signature · 1 line
1.9.1

From 643cb54bba1bf8b4ab994da1447f0e91fd682b9c Mon Sep 17 00:00:00 2001
From: Joel Holdsworth <joel-IJEoVVyKhCJXvIrf17iDB/[email protected]>
Date: Mon, 11 Aug 2014 18:44:25 +0100
Subject: [PATCH 3/4] drm/nouveau: Replaced copy-pasted nv_wait with
nv50_wait_dpms_ctrl helper

---
 drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c +10 -4
index 61e29d6..98bded6 100644
@@ -33,6 +33,12 @@
 #include "nv50.h"
 #include "nouveau_reg.h"
 
+static void
+nv50_wait_dpms_ctrl(struct nv50_disp_priv *priv, const u32 dpms_ctrl)
+{
+	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
+}
+
 int
 nv50_dac_power(NV50_DISP_MTHD_V1)
 {
@@ -56,10 +62,10 @@ nv50_dac_power(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
-	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
+	nv50_wait_dpms_ctrl(priv, dpms_ctrl);
 	nv_mask(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x4000007f,
 		NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | stat);
-	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
+	nv50_wait_dpms_ctrl(priv, dpms_ctrl);
 	return 0;
 }
 
@@ -86,7 +92,7 @@ nv50_dac_sense(NV50_DISP_MTHD_V1)
 
 	nv_mask(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x007f0000,
 		NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x00150000);
-	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
+	nv50_wait_dpms_ctrl(priv, dpms_ctrl);
 
 	nv_wr32(priv, load_ctrl, 0x00100000 | loadval);
 	mdelay(9);
@@ -95,7 +101,7 @@ nv50_dac_sense(NV50_DISP_MTHD_V1)
 
 	nv_mask(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x007f0000,
 		NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING | 0x00550000);
-	nv_wait(priv, dpms_ctrl, NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING, 0);
+	nv50_wait_dpms_ctrl(priv, dpms_ctrl);
 
 	nv_debug(priv, "DAC%d sense: 0x%08x\n", outp->or, loadval);
 	if (!(loadval & 0x80000000))
Signature · 1 line
1.9.1

From 0e3a77833e345b45d0fa85857ef38d8cb2976d64 Mon Sep 17 00:00:00 2001
From: Joel Holdsworth <joel-IJEoVVyKhCJXvIrf17iDB/[email protected]>
Date: Sun, 1 Jun 2014 18:52:13 +0100
Subject: [PATCH 4/4] drm/nouveau: Refactored encoder create functions into
common nv50_encoder_create helper

---
 drivers/gpu/drm/nouveau/nv50_display.c | 178 +++++++++++++--------------------
 1 file changed, 71 insertions(+), 107 deletions(-)
drivers/gpu/drm/nouveau/nv50_display.c +71 -107

228 lines not on this page · raw message

Signature · 1 line
1.9.1

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 53E94BAA.9000305-IJEoVVyKhCJXvIrf17iDB/[email protected]

#2 lore raw

Please send these one email per patch, inlined. git send-email will generally do the right thing, but you can do it manually too (just be careful about preserving tabs, not wrapping, etc... most mail clients mess it up one way or another)

Quoted 11 lines · Joel Holdsworth

The patches contain some tidy-up work, and refactoring that has arisen as a by-product of my initial work on adding TV support to nv50.

Best Regards
Joel Holdsworth

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#3 lore raw
Quoted 5 lines · Ilia Mirkin

Please send these one email per patch, inlined. git send-email will generally do the right thing, but you can do it manually too (just be careful about preserving tabs, not wrapping, etc... most mail clients mess it up one way or another)

Quoted 15 lines
Quoted 11 lines · Joel Holdsworth

The patches contain some tidy-up work, and refactoring that has arisen as a by-product of my initial work on adding TV support to nv50.

Best Regards
Joel Holdsworth

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

Ok just resubmitted. The reason for doing it this way is that my SMTP server seems not to be compatible with get send-mail SSL or TLS. I resubmitted via my work SMTP, so hopefully it works for you now.

Joel

A message that is not in the archive (sent off-list or not yet received): 53E9D94A.90805-IJEoVVyKhCJXvIrf17iDB/[email protected]

#5 lore raw
Quoted 4 lines · Joel Holdsworth

Ok just resubmitted. The reason for doing it this way is that my SMTP server seems not to be compatible with get send-mail SSL or TLS. I resubmitted via my work SMTP, so hopefully it works for you now.

It went through ;) Thanks, it will be easier to review and comment.