All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] drm/nouveau: Enable HDMI Stereoscopy
@ 2017-01-17 22:41 Alastair Bridgewater
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:41 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

This is an initial implementation of HDMI 3D mode support for the
nouveau kernel driver.  It works on all of the hardware that I have
available to test at the moment, but I am unsure as to the overall
approach taken for setting HDMI InfoFrames, there's no support for g84
or gf119 disps, and the criteria for enabling stereo support for an
output seems a bit iffy.

The first four patches arrange to set the HDMI InfoFrames for gt215
and gk104 disps, and provide the parsing side of support for g84 and
gf119 disps.

The fifth patch removes code that sets up the "mandatory" 3D modes.
The requirement is that a display that supports 3D support at least
one of these modes, not that it must support all of them.

The sixth patch enables stereo support on all TMDS outputs, and adds a
term (copied from the i915 driver) to adjust the clock required for
frame-packed stereo modes.  The criteria used here for enabling stereo
on an output seems wrong to me, but it's the least wrong thing that
I've been able to come up with so far.

Even just taking the InfoFrame patches and leaving the stereoscopy
patches until the rest of the InfoFrame support is worked out would
probably be a win.

Alastair Bridgewater (6):
  drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
  drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to
    NVKM
  drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
  drm: Delete "mandatory" stereographic modes
  drm/nouveau: Enable stereoscopic 3D output over HDMI

 drivers/gpu/drm/drm_edid.c                         | 66 --------------------
 drivers/gpu/drm/nouveau/include/nvif/cl5070.h      | 16 ++++-
 drivers/gpu/drm/nouveau/nouveau_connector.c        | 13 ++++
 drivers/gpu/drm/nouveau/nv50_display.c             | 49 ++++++++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 32 +++++++++-
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 32 +++++++++-
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 58 +++++++++++++++---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 70 ++++++++++++++++++----
 8 files changed, 248 insertions(+), 88 deletions(-)

-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-17 22:41   ` Alastair Bridgewater
       [not found]     ` <20170117224204.27516-2-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-01-17 22:42   ` [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
                     ` (6 subsequent siblings)
  7 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:41 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The nouveau driver, in the Linux 3.7 days, used to try and set the
AVI InfoFrame based on the selected display mode.  These days, it
uses a fixed set of InfoFrames.  Start to correct that, by
providing a mechanism whereby InfoFrame data may be passed to the
NVKM functions that do the actual configuration.

At this point, only establish the new parameters and their parsing,
don't actually use the data anywhere yet (since it's not supplied
anywhere).

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/include/nvif/cl5070.h      | 16 ++++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 32 +++++++++++++++++++++-
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 32 +++++++++++++++++++++-
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 32 +++++++++++++++++++++-
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 32 +++++++++++++++++++++-
 5 files changed, 139 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
index ae49dfd..a3ce3bf 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
@@ -76,7 +76,21 @@ struct nv50_disp_sor_hdmi_pwr_v0 {
 	__u8  state;
 	__u8  max_ac_packet;
 	__u8  rekey;
-	__u8  pad04[4];
+	__u8  flags;
+#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME     0x01
+#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME       0x02
+#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME    0x04
+	__u8  pad05[3];
+};
+
+struct nv50_disp_sor_hdmi_pwr_v0_infoframe {
+	__u8  version;
+	__u8  pad01[3];
+	__u32 header;
+	__u32 subpack0_low;
+	__u32 subpack0_high;
+	__u32 subpack1_low;
+	__u32 subpack1_high;
 };
 
 struct nv50_disp_sor_lvds_script_v0 {
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
index 1c4256e..f767588 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
@@ -36,11 +36,14 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -54,6 +57,33 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
+		audio_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *audio_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
+		avi_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *avi_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
+		vendor_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *vendor_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x6165a4 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
index 632f02d..c492cd7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
@@ -36,11 +36,14 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -53,6 +56,33 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
+		audio_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *audio_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
+		avi_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *avi_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
+		vendor_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *vendor_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
index 4e8067d..6c38d6d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
@@ -37,11 +37,14 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -54,6 +57,33 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
+		audio_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *audio_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
+		avi_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *avi_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
+		vendor_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *vendor_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
index f1afc16..e2fbe4c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
@@ -37,11 +37,14 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
+	struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -55,6 +58,33 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
+		audio_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *audio_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
+		avi_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *avi_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (args->v0.flags &
+	    NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
+		vendor_infoframe = data;
+		if ((ret = nvif_unpack(-ENOSYS, &data, &size,
+				       *vendor_infoframe, 0, 0, true)))
+			return ret;
+	}
+
+	if (size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-01-17 22:41   ` [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
@ 2017-01-17 22:42   ` Alastair Bridgewater
       [not found]     ` <20170117224204.27516-3-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-01-17 22:42   ` [PATCH 3/6] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
                     ` (5 subsequent siblings)
  7 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:42 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have mechanism by which to pass mode-dependent HDMI
InfoFrames to the low-level hardware driver, it is incumbent upon
us to do so.

Experimentation on a gt215 device suggests that the Audio InfoFrame
is not required here, possibly being provided by the HDA device
when necessary (because where else would it come from?).

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 49 +++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 2c2c645..d52d0b8 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -23,6 +23,7 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/hdmi.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -31,6 +32,7 @@
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_edid.h>
 
 #include <nvif/class.h>
 #include <nvif/cl0002.h>
@@ -2772,6 +2774,28 @@ nv50_hdmi_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
 	nvif_mthd(disp->disp, 0, &args, sizeof(args));
 }
 
+static ssize_t
+nv50_hdmi_pack_infoframe(struct nv50_disp_sor_hdmi_pwr_v0_infoframe *frame_out,
+			 union hdmi_infoframe *frame_in)
+{
+	uint8_t buffer[17]; /* The header plus two "subpacks" */
+	ssize_t len;
+
+	len = hdmi_infoframe_pack(frame_in, buffer, sizeof(buffer));
+
+	frame_out->header = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16);
+	frame_out->subpack0_low = buffer[3] | (buffer[4] << 8) |
+		(buffer[5] << 16) | (buffer[6] << 24);
+	frame_out->subpack0_high = buffer[7] | (buffer[8] << 8) |
+		(buffer[9] << 16);
+	frame_out->subpack1_low = buffer[10] | (buffer[11] << 8) |
+		(buffer[12] << 16) | (buffer[13] << 24);
+	frame_out->subpack1_high = buffer[14] | (buffer[15] << 8) |
+		(buffer[16] << 16);
+
+	return len;
+}
+
 static void
 nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 {
@@ -2781,6 +2805,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	struct {
 		struct nv50_disp_mthd_v1 base;
 		struct nv50_disp_sor_hdmi_pwr_v0 pwr;
+		struct nv50_disp_sor_hdmi_pwr_v0_infoframe iframe[3];
 	} args = {
 		.base.version = 1,
 		.base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR,
@@ -2792,17 +2817,39 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	};
 	struct nouveau_connector *nv_connector;
 	u32 max_ac_packet;
+	union hdmi_infoframe avi_frame;
+	union hdmi_infoframe vendor_frame;
+	int ret;
+	int size;
+	int frame = 0;
 
 	nv_connector = nouveau_encoder_connector_get(nv_encoder);
 	if (!drm_detect_hdmi_monitor(nv_connector->edid))
 		return;
 
+	/* Audio InfoFrame apparently not required (supplied by HDA device?) */
+
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode);
+	if (ret >= 0) {
+		/* We have an AVI InfoFrame, populate it to the display */
+		args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME;
+		nv50_hdmi_pack_infoframe(&args.iframe[frame++], &avi_frame);
+	}
+
+	ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode);
+	if (ret >= 0) {
+		/* We have a Vendor InfoFrame, populate it to the display */
+		args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME;
+		nv50_hdmi_pack_infoframe(&args.iframe[frame++], &vendor_frame);
+	}
+
 	max_ac_packet  = mode->htotal - mode->hdisplay;
 	max_ac_packet -= args.pwr.rekey;
 	max_ac_packet -= 18; /* constant from tegra */
 	args.pwr.max_ac_packet = max_ac_packet / 32;
 
-	nvif_mthd(disp->disp, 0, &args, sizeof(args));
+	size = sizeof(args.base) + sizeof(args.pwr) + frame * sizeof(args.iframe[0]);
+	nvif_mthd(disp->disp, 0, &args, size);
 	nv50_audio_enable(encoder, mode);
 }
 
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 3/6] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-01-17 22:41   ` [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
  2017-01-17 22:42   ` [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
@ 2017-01-17 22:42   ` Alastair Bridgewater
  2017-01-17 22:42   ` [PATCH 4/6] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:42 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic") InfoFrame.

Also don't enable any InfoFrame that is not provided, and disable
the Vendor InfoFrame when disabling the output.

This change should have two net effects: The Audio infoframe will
no longer be configured (because it's not being supplied, not
that it appears to be necessary), and the AVI and Vendor
InfoFrames will start being emitted correctly for the selected
video mode...  For GT215 hardware only.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 38 ++++++++++++++++------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
index e2fbe4c..fc8e1e4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
@@ -87,6 +87,7 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x61c53c + soff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000000);
 		return 0;
@@ -94,19 +95,36 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x61c528 + soff, 0x000d0282);
-	nvkm_wr32(device, 0x61c52c + soff, 0x0000006f);
-	nvkm_wr32(device, 0x61c530 + soff, 0x00000000);
-	nvkm_wr32(device, 0x61c534 + soff, 0x00000000);
-	nvkm_wr32(device, 0x61c538 + soff, 0x00000000);
-	nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000001);
+	if (avi_infoframe) {
+		nvkm_wr32(device, 0x61c528 + soff, avi_infoframe->header);
+		nvkm_wr32(device, 0x61c52c + soff, avi_infoframe->subpack0_low);
+		nvkm_wr32(device, 0x61c530 + soff, avi_infoframe->subpack0_high);
+		nvkm_wr32(device, 0x61c534 + soff, avi_infoframe->subpack1_low);
+		nvkm_wr32(device, 0x61c538 + soff, avi_infoframe->subpack1_high);
+		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000001);
+	}
 
 	/* Audio InfoFrame */
 	nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x61c508 + soff, 0x000a0184);
-	nvkm_wr32(device, 0x61c50c + soff, 0x00000071);
-	nvkm_wr32(device, 0x61c510 + soff, 0x00000000);
-	nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000001);
+	if (audio_infoframe) {
+		nvkm_wr32(device, 0x61c508 + soff, audio_infoframe->header);
+		nvkm_wr32(device, 0x61c50c + soff, audio_infoframe->subpack0_low);
+		nvkm_wr32(device, 0x61c510 + soff, audio_infoframe->subpack0_high);
+		/* Audio InfoFrame supposedly has only one subpack. */
+		nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000001);
+	}
+
+	/* Vendor InfoFrame */
+	nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010000);
+	if (vendor_infoframe) {
+		nvkm_wr32(device, 0x61c544 + soff, vendor_infoframe->header);
+		nvkm_wr32(device, 0x61c548 + soff, vendor_infoframe->subpack0_low);
+		nvkm_wr32(device, 0x61c54c + soff, vendor_infoframe->subpack0_high);
+		/* Is there a second (or up to fourth?) set of subpack registers here? */
+		/* nvkm_wr32(device, 0x61c550 + soff, vendor_infoframe->subpack1_low); */
+		/* nvkm_wr32(device, 0x61c554 + soff, vendor_infoframe->subpack1_high); */
+		nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010001);
+	}
 
 	nvkm_mask(device, 0x61c5d0 + soff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
 	nvkm_mask(device, 0x61c568 + soff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 4/6] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-01-17 22:42   ` [PATCH 3/6] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
@ 2017-01-17 22:42   ` Alastair Bridgewater
  2017-01-17 22:42   ` [PATCH 5/6] drm: Delete "mandatory" stereographic modes Alastair Bridgewater
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:42 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any InfoFrame that is not provided, and disable
the Vendor InfoFrame when disabling the output.

Ignore the Audio InfoFrame: We don't supply it, and there is no
indication that the hardware supports it through this interface.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 26 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
index 6c38d6d..64b21a4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
@@ -86,6 +86,7 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
 		return 0;
@@ -93,12 +94,25 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x690008 + hdmi, 0x000d0282);
-	nvkm_wr32(device, 0x69000c + hdmi, 0x0000006f);
-	nvkm_wr32(device, 0x690010 + hdmi, 0x00000000);
-	nvkm_wr32(device, 0x690014 + hdmi, 0x00000000);
-	nvkm_wr32(device, 0x690018 + hdmi, 0x00000000);
-	nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000001);
+	if (avi_infoframe) {
+		nvkm_wr32(device, 0x690008 + hdmi, avi_infoframe->header);
+		nvkm_wr32(device, 0x69000c + hdmi, avi_infoframe->subpack0_low);
+		nvkm_wr32(device, 0x690010 + hdmi, avi_infoframe->subpack0_high);
+		nvkm_wr32(device, 0x690014 + hdmi, avi_infoframe->subpack1_low);
+		nvkm_wr32(device, 0x690018 + hdmi, avi_infoframe->subpack1_high);
+		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000001);
+	}
+
+	/* GENERIC(?) / Vendor InfoFrame? */
+	nvkm_mask(device, 0x690100 + hdmi, 0x00010001, 0x00000000);
+	if (vendor_infoframe) {
+		nvkm_wr32(device, 0x690108 + hdmi, vendor_infoframe->header);
+		nvkm_wr32(device, 0x69010c + hdmi, vendor_infoframe->subpack0_low);
+		nvkm_wr32(device, 0x690110 + hdmi, vendor_infoframe->subpack0_high);
+		/* Is there a second (or further?) set of subpack registers here? */
+		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000001);
+	}
+
 
 	/* ??? InfoFrame? */
 	nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-01-17 22:42   ` [PATCH 4/6] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
@ 2017-01-17 22:42   ` Alastair Bridgewater
       [not found]     ` <20170117224204.27516-6-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-01-17 22:42   ` [PATCH 6/6] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
                     ` (2 subsequent siblings)
  7 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:42 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

HDMI specification 1.4a, table 8-15 is very explicitly a "must
support at least one of" table, not a "must support all of" table.
It is not hard to find hardware that does not support some of the
so-called "mandatory" modes.

More seriously, this code generates invalid display modes for both
of the 3D-capable panels that I have (a 42-inch LG TV and a Sony
PlayStation 3D Display).

If we want to be persnickety, one option would be to check the
final list of modes against the table and give some message if
none of them are valid, but it's a whole lot easier just to delete
the code in question.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/drm_edid.c | 66 ----------------------------------------------
 1 file changed, 66 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 336be31..723116a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2926,70 +2926,6 @@ do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len)
 	return modes;
 }
 
-struct stereo_mandatory_mode {
-	int width, height, vrefresh;
-	unsigned int flags;
-};
-
-static const struct stereo_mandatory_mode stereo_mandatory_modes[] = {
-	{ 1920, 1080, 24, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM },
-	{ 1920, 1080, 24, DRM_MODE_FLAG_3D_FRAME_PACKING },
-	{ 1920, 1080, 50,
-	  DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
-	{ 1920, 1080, 60,
-	  DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
-	{ 1280, 720,  50, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM },
-	{ 1280, 720,  50, DRM_MODE_FLAG_3D_FRAME_PACKING },
-	{ 1280, 720,  60, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM },
-	{ 1280, 720,  60, DRM_MODE_FLAG_3D_FRAME_PACKING }
-};
-
-static bool
-stereo_match_mandatory(const struct drm_display_mode *mode,
-		       const struct stereo_mandatory_mode *stereo_mode)
-{
-	unsigned int interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE;
-
-	return mode->hdisplay == stereo_mode->width &&
-	       mode->vdisplay == stereo_mode->height &&
-	       interlaced == (stereo_mode->flags & DRM_MODE_FLAG_INTERLACE) &&
-	       drm_mode_vrefresh(mode) == stereo_mode->vrefresh;
-}
-
-static int add_hdmi_mandatory_stereo_modes(struct drm_connector *connector)
-{
-	struct drm_device *dev = connector->dev;
-	const struct drm_display_mode *mode;
-	struct list_head stereo_modes;
-	int modes = 0, i;
-
-	INIT_LIST_HEAD(&stereo_modes);
-
-	list_for_each_entry(mode, &connector->probed_modes, head) {
-		for (i = 0; i < ARRAY_SIZE(stereo_mandatory_modes); i++) {
-			const struct stereo_mandatory_mode *mandatory;
-			struct drm_display_mode *new_mode;
-
-			if (!stereo_match_mandatory(mode,
-						    &stereo_mandatory_modes[i]))
-				continue;
-
-			mandatory = &stereo_mandatory_modes[i];
-			new_mode = drm_mode_duplicate(dev, mode);
-			if (!new_mode)
-				continue;
-
-			new_mode->flags |= mandatory->flags;
-			list_add_tail(&new_mode->head, &stereo_modes);
-			modes++;
-		}
-	}
-
-	list_splice_tail(&stereo_modes, &connector->probed_modes);
-
-	return modes;
-}
-
 static int add_hdmi_mode(struct drm_connector *connector, u8 vic)
 {
 	struct drm_device *dev = connector->dev;
@@ -3090,8 +3026,6 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len,
 	/* 3D_Present */
 	offset++;
 	if (db[8 + offset] & (1 << 7)) {
-		modes += add_hdmi_mandatory_stereo_modes(connector);
-
 		/* 3D_Multi_present */
 		multi_present = (db[8 + offset] & 0x60) >> 5;
 	}
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 6/6] drm/nouveau: Enable stereoscopic 3D output over HDMI
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-01-17 22:42   ` [PATCH 5/6] drm: Delete "mandatory" stereographic modes Alastair Bridgewater
@ 2017-01-17 22:42   ` Alastair Bridgewater
  2017-03-27 21:57   ` [PATCH v2 00/10] Enable HDMI Stereoscopy Alastair Bridgewater
  2017-04-11 17:11   ` [PATCH v3 00/10] drm/nouveau " Alastair Bridgewater
  7 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-17 22:42 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

This is a bit sketchy in terms of implementation, with some rough
edges, but for the most part IT WORKS.

That is to say, I get an obvious 3D output when using the
"testdisplay" program from intel-gpu-tools with the "-3" parameter
and outputting to a 3D-capable HDMI display.

Rough edges include: the criteria for when to enable 3D mode
selection, and the inconsistent support for setting InfoFrames on
HDMI outputs.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 947c200..11b4977 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -547,6 +547,16 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
 			DRM_MODE_SUBCONNECTOR_DVID :
 			DRM_MODE_SUBCONNECTOR_DVIA);
 	}
+
+	if (nv_encoder->dcb->type == DCB_OUTPUT_TMDS) {
+		/* Can we just ask for the drm connector type? */
+		/*
+		 * FIXME: Does this also kick in for DVI or DP->DVI
+		 * connectors?  It shouldn't.
+		 */
+		/* FIXME: Should only allow when we can set InfoFrames */
+		connector->stereo_allowed = true;
+	}
 }
 
 static enum drm_connector_status
@@ -1044,6 +1054,9 @@ nouveau_connector_mode_valid(struct drm_connector *connector,
 		return MODE_BAD;
 	}
 
+	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+		clock *= 2;
+
 	if (clock < min_clock)
 		return MODE_CLOCK_LOW;
 
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
       [not found]     ` <20170117224204.27516-2-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-18  3:19       ` Ilia Mirkin
  0 siblings, 0 replies; 48+ messages in thread
From: Ilia Mirkin @ 2017-01-18  3:19 UTC (permalink / raw)
  To: Alastair Bridgewater; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tue, Jan 17, 2017 at 5:41 PM, Alastair Bridgewater
<alastair.bridgewater@gmail.com> wrote:
> The nouveau driver, in the Linux 3.7 days, used to try and set the
> AVI InfoFrame based on the selected display mode.  These days, it
> uses a fixed set of InfoFrames.  Start to correct that, by
> providing a mechanism whereby InfoFrame data may be passed to the
> NVKM functions that do the actual configuration.
>
> At this point, only establish the new parameters and their parsing,
> don't actually use the data anywhere yet (since it's not supplied
> anywhere).
>
> Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/include/nvif/cl5070.h      | 16 ++++++++++-
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 32 +++++++++++++++++++++-
>  .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 32 +++++++++++++++++++++-
>  .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 32 +++++++++++++++++++++-
>  .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 32 +++++++++++++++++++++-
>  5 files changed, 139 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
> index ae49dfd..a3ce3bf 100644
> --- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
> +++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
> @@ -76,7 +76,21 @@ struct nv50_disp_sor_hdmi_pwr_v0 {
>         __u8  state;
>         __u8  max_ac_packet;
>         __u8  rekey;
> -       __u8  pad04[4];
> +       __u8  flags;
> +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME     0x01
> +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME       0x02
> +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME    0x04

These should come before flags, not after (based on the other ones).
Also, this is nv50_disp_sor_hdmi_pwr_v0, so they should be

NV50_DISP_SOR_HDMI_PWR_V0_FLAG_AUDIO_INFOFRAME

and so on.

> +       __u8  pad05[3];
> +};
> +
> +struct nv50_disp_sor_hdmi_pwr_v0_infoframe {
> +       __u8  version;

Why do you need a version here? Do you anticipate mixing and matching,
e.g. calling the sor_hdmi_pwr_v0 method with v0 or v1 infoframes
attached, and needing to tell them apart? I'd just as soon drop it and
not use nvif_unpack for these.

> +       __u8  pad01[3];
> +       __u32 header;
> +       __u32 subpack0_low;
> +       __u32 subpack0_high;
> +       __u32 subpack1_low;
> +       __u32 subpack1_high;

Is this nomenclature from the spec? I've never seen it... (not that
I'm some spec expert). Why not make it a __u8 buffer[20]?

>  };
>
>  struct nv50_disp_sor_lvds_script_v0 {
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
> index 1c4256e..f767588 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
> @@ -36,11 +36,14 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         union {
>                 struct nv50_disp_sor_hdmi_pwr_v0 v0;
>         } *args = data;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
>         u32 ctrl;
>         int ret = -ENOSYS;
>
>         nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
> -       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
> +       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
>                 nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
>                                    "max_ac_packet %d rekey %d\n",
>                            args->v0.version, args->v0.state,
> @@ -54,6 +57,33 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         } else
>                 return ret;
>
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
> +               audio_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *audio_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
> +               avi_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *avi_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
> +               vendor_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *vendor_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (size)
> +               return -E2BIG;
> +
>         if (!(ctrl & 0x40000000)) {
>                 nvkm_mask(device, 0x6165a4 + hoff, 0x40000000, 0x00000000);
>                 nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
> index 632f02d..c492cd7 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
> @@ -36,11 +36,14 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         union {
>                 struct nv50_disp_sor_hdmi_pwr_v0 v0;
>         } *args = data;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
>         u32 ctrl;
>         int ret = -ENOSYS;
>
>         nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
> -       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
> +       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
>                 nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
>                                    "max_ac_packet %d rekey %d\n",
>                            args->v0.version, args->v0.state,
> @@ -53,6 +56,33 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         } else
>                 return ret;
>
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
> +               audio_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *audio_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
> +               avi_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *avi_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
> +               vendor_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *vendor_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (size)
> +               return -E2BIG;
> +
>         if (!(ctrl & 0x40000000)) {
>                 nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
>                 nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
> index 4e8067d..6c38d6d 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
> @@ -37,11 +37,14 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         union {
>                 struct nv50_disp_sor_hdmi_pwr_v0 v0;
>         } *args = data;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
>         u32 ctrl;
>         int ret = -ENOSYS;
>
>         nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
> -       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
> +       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
>                 nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
>                                    "max_ac_packet %d rekey %d\n",
>                            args->v0.version, args->v0.state,
> @@ -54,6 +57,33 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         } else
>                 return ret;
>
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
> +               audio_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *audio_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
> +               avi_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *avi_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
> +               vendor_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *vendor_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (size)
> +               return -E2BIG;
> +
>         if (!(ctrl & 0x40000000)) {
>                 nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
>                 nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
> index f1afc16..e2fbe4c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
> @@ -37,11 +37,14 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         union {
>                 struct nv50_disp_sor_hdmi_pwr_v0 v0;
>         } *args = data;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL;
> +       struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL;
>         u32 ctrl;
>         int ret = -ENOSYS;
>
>         nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
> -       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
> +       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
>                 nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
>                                    "max_ac_packet %d rekey %d\n",
>                            args->v0.version, args->v0.state,
> @@ -55,6 +58,33 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
>         } else
>                 return ret;
>
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) {
> +               audio_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *audio_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) {
> +               avi_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *avi_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (args->v0.flags &
> +           NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) {
> +               vendor_infoframe = data;
> +               if ((ret = nvif_unpack(-ENOSYS, &data, &size,
> +                                      *vendor_infoframe, 0, 0, true)))
> +                       return ret;
> +       }
> +
> +       if (size)
> +               return -E2BIG;
> +
>         if (!(ctrl & 0x40000000)) {
>                 nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
>                 nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
> --
> 2.10.2
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
       [not found]     ` <20170117224204.27516-3-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-18  3:31       ` Ilia Mirkin
  0 siblings, 0 replies; 48+ messages in thread
From: Ilia Mirkin @ 2017-01-18  3:31 UTC (permalink / raw)
  To: Alastair Bridgewater; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater
<alastair.bridgewater@gmail.com> wrote:
> Now that we have mechanism by which to pass mode-dependent HDMI
> InfoFrames to the low-level hardware driver, it is incumbent upon
> us to do so.
>
> Experimentation on a gt215 device suggests that the Audio InfoFrame
> is not required here, possibly being provided by the HDA device
> when necessary (because where else would it come from?).

Presumably it's necessary on G84, which doesn't have the HDA device?
Looks like there's no helper for computing such a thing in drm_edid.
It's a pretty fixed setup on G84... you're supposed to hook the audio
from your sound card into an internal S/PDIF connector, so just
leaving the default audio infoframe on in there might be enough.

>
> Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/nv50_display.c | 49 +++++++++++++++++++++++++++++++++-
>  1 file changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 2c2c645..d52d0b8 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -23,6 +23,7 @@
>   */
>
>  #include <linux/dma-mapping.h>
> +#include <linux/hdmi.h>
>
>  #include <drm/drmP.h>
>  #include <drm/drm_atomic.h>
> @@ -31,6 +32,7 @@
>  #include <drm/drm_dp_helper.h>
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_plane_helper.h>
> +#include <drm/drm_edid.h>
>
>  #include <nvif/class.h>
>  #include <nvif/cl0002.h>
> @@ -2772,6 +2774,28 @@ nv50_hdmi_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
>         nvif_mthd(disp->disp, 0, &args, sizeof(args));
>  }
>
> +static ssize_t
> +nv50_hdmi_pack_infoframe(struct nv50_disp_sor_hdmi_pwr_v0_infoframe *frame_out,
> +                        union hdmi_infoframe *frame_in)
> +{
> +       uint8_t buffer[17]; /* The header plus two "subpacks" */
> +       ssize_t len;
> +
> +       len = hdmi_infoframe_pack(frame_in, buffer, sizeof(buffer));
> +
> +       frame_out->header = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16);
> +       frame_out->subpack0_low = buffer[3] | (buffer[4] << 8) |
> +               (buffer[5] << 16) | (buffer[6] << 24);
> +       frame_out->subpack0_high = buffer[7] | (buffer[8] << 8) |
> +               (buffer[9] << 16);
> +       frame_out->subpack1_low = buffer[10] | (buffer[11] << 8) |
> +               (buffer[12] << 16) | (buffer[13] << 24);
> +       frame_out->subpack1_high = buffer[14] | (buffer[15] << 8) |
> +               (buffer[16] << 16);
> +
> +       return len;
> +}
> +
>  static void
>  nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>  {
> @@ -2781,6 +2805,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>         struct {
>                 struct nv50_disp_mthd_v1 base;
>                 struct nv50_disp_sor_hdmi_pwr_v0 pwr;
> +               struct nv50_disp_sor_hdmi_pwr_v0_infoframe iframe[3];
>         } args = {
>                 .base.version = 1,
>                 .base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR,
> @@ -2792,17 +2817,39 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>         };
>         struct nouveau_connector *nv_connector;
>         u32 max_ac_packet;
> +       union hdmi_infoframe avi_frame;
> +       union hdmi_infoframe vendor_frame;
> +       int ret;
> +       int size;
> +       int frame = 0;
>
>         nv_connector = nouveau_encoder_connector_get(nv_encoder);
>         if (!drm_detect_hdmi_monitor(nv_connector->edid))
>                 return;
>
> +       /* Audio InfoFrame apparently not required (supplied by HDA device?) */
> +
> +       ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode);
> +       if (ret >= 0) {

if (!ret) or if (ret == 0) is more idiomatic.

> +               /* We have an AVI InfoFrame, populate it to the display */
> +               args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME;
> +               nv50_hdmi_pack_infoframe(&args.iframe[frame++], &avi_frame);
> +       }
> +
> +       ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode);
> +       if (ret >= 0) {
> +               /* We have a Vendor InfoFrame, populate it to the display */
> +               args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME;
> +               nv50_hdmi_pack_infoframe(&args.iframe[frame++], &vendor_frame);
> +       }
> +
>         max_ac_packet  = mode->htotal - mode->hdisplay;
>         max_ac_packet -= args.pwr.rekey;
>         max_ac_packet -= 18; /* constant from tegra */
>         args.pwr.max_ac_packet = max_ac_packet / 32;
>
> -       nvif_mthd(disp->disp, 0, &args, sizeof(args));
> +       size = sizeof(args.base) + sizeof(args.pwr) + frame * sizeof(args.iframe[0]);
> +       nvif_mthd(disp->disp, 0, &args, size);
>         nv50_audio_enable(encoder, mode);
>  }
>
> --
> 2.10.2
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]     ` <20170117224204.27516-6-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-18  5:10       ` Ilia Mirkin
       [not found]         ` <CAKb7UvigMUdD93eqa=3bM9VHSGztV3DWgv-8hx8ho7EmHrhtqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Ilia Mirkin @ 2017-01-18  5:10 UTC (permalink / raw)
  To: Alastair Bridgewater, Damien Lespiau, Ville Syrjälä
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater
<alastair.bridgewater@gmail.com> wrote:
> HDMI specification 1.4a, table 8-15 is very explicitly a "must
> support at least one of" table, not a "must support all of" table.
> It is not hard to find hardware that does not support some of the
> so-called "mandatory" modes.
>
> More seriously, this code generates invalid display modes for both
> of the 3D-capable panels that I have (a 42-inch LG TV and a Sony
> PlayStation 3D Display).
>
> If we want to be persnickety, one option would be to check the
> final list of modes against the table and give some message if
> none of them are valid, but it's a whole lot easier just to delete
> the code in question.

Damien added this in commit c858cfcae6d some 3 years ago.

Damien, do you remember why you added these "required" modes? Did you
have a monitor that only advertised 3D support without the actual
modes?

>
> Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 66 ----------------------------------------------
>  1 file changed, 66 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 336be31..723116a 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2926,70 +2926,6 @@ do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len)
>         return modes;
>  }
>
> -struct stereo_mandatory_mode {
> -       int width, height, vrefresh;
> -       unsigned int flags;
> -};
> -
> -static const struct stereo_mandatory_mode stereo_mandatory_modes[] = {
> -       { 1920, 1080, 24, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM },
> -       { 1920, 1080, 24, DRM_MODE_FLAG_3D_FRAME_PACKING },
> -       { 1920, 1080, 50,
> -         DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
> -       { 1920, 1080, 60,
> -         DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
> -       { 1280, 720,  50, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM },
> -       { 1280, 720,  50, DRM_MODE_FLAG_3D_FRAME_PACKING },
> -       { 1280, 720,  60, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM },
> -       { 1280, 720,  60, DRM_MODE_FLAG_3D_FRAME_PACKING }
> -};
> -
> -static bool
> -stereo_match_mandatory(const struct drm_display_mode *mode,
> -                      const struct stereo_mandatory_mode *stereo_mode)
> -{
> -       unsigned int interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE;
> -
> -       return mode->hdisplay == stereo_mode->width &&
> -              mode->vdisplay == stereo_mode->height &&
> -              interlaced == (stereo_mode->flags & DRM_MODE_FLAG_INTERLACE) &&
> -              drm_mode_vrefresh(mode) == stereo_mode->vrefresh;
> -}
> -
> -static int add_hdmi_mandatory_stereo_modes(struct drm_connector *connector)
> -{
> -       struct drm_device *dev = connector->dev;
> -       const struct drm_display_mode *mode;
> -       struct list_head stereo_modes;
> -       int modes = 0, i;
> -
> -       INIT_LIST_HEAD(&stereo_modes);
> -
> -       list_for_each_entry(mode, &connector->probed_modes, head) {
> -               for (i = 0; i < ARRAY_SIZE(stereo_mandatory_modes); i++) {
> -                       const struct stereo_mandatory_mode *mandatory;
> -                       struct drm_display_mode *new_mode;
> -
> -                       if (!stereo_match_mandatory(mode,
> -                                                   &stereo_mandatory_modes[i]))
> -                               continue;
> -
> -                       mandatory = &stereo_mandatory_modes[i];
> -                       new_mode = drm_mode_duplicate(dev, mode);
> -                       if (!new_mode)
> -                               continue;
> -
> -                       new_mode->flags |= mandatory->flags;
> -                       list_add_tail(&new_mode->head, &stereo_modes);
> -                       modes++;
> -               }
> -       }
> -
> -       list_splice_tail(&stereo_modes, &connector->probed_modes);
> -
> -       return modes;
> -}
> -
>  static int add_hdmi_mode(struct drm_connector *connector, u8 vic)
>  {
>         struct drm_device *dev = connector->dev;
> @@ -3090,8 +3026,6 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len,
>         /* 3D_Present */
>         offset++;
>         if (db[8 + offset] & (1 << 7)) {
> -               modes += add_hdmi_mandatory_stereo_modes(connector);
> -
>                 /* 3D_Multi_present */
>                 multi_present = (db[8 + offset] & 0x60) >> 5;
>         }
> --
> 2.10.2
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]         ` <CAKb7UvigMUdD93eqa=3bM9VHSGztV3DWgv-8hx8ho7EmHrhtqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-01-18 11:45           ` Damien Lespiau
       [not found]             ` <20170118114554.GA6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Damien Lespiau @ 2017-01-18 11:45 UTC (permalink / raw)
  To: Ilia Mirkin
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä

On Wed, Jan 18, 2017 at 12:10:56AM -0500, Ilia Mirkin wrote:
> On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater
> <alastair.bridgewater@gmail.com> wrote:
> > HDMI specification 1.4a, table 8-15 is very explicitly a "must
> > support at least one of" table, not a "must support all of" table.
> > It is not hard to find hardware that does not support some of the
> > so-called "mandatory" modes.
> >
> > More seriously, this code generates invalid display modes for both
> > of the 3D-capable panels that I have (a 42-inch LG TV and a Sony
> > PlayStation 3D Display).
> >
> > If we want to be persnickety, one option would be to check the
> > final list of modes against the table and give some message if
> > none of them are valid, but it's a whole lot easier just to delete
> > the code in question.
> 
> Damien added this in commit c858cfcae6d some 3 years ago.
> 
> Damien, do you remember why you added these "required" modes? Did you
> have a monitor that only advertised 3D support without the actual
> modes?

Another quick glance at the specs leads me to believe c858cfcae6d is
correct.

8-15 does say that a sink supporting 3D must at lesst support one of the
modes listed in that table. But that's just the very start of the story
and we are really talking about the 3D_present bit in the HMDI VSDB and
the associated "mandatory" modes (the term comes from the spec).

HDMI 1.4a Page 155:

"3D_present [1bit] This bit indicates 3D support by the HDMI Sink,
including the mandatory formats. If set (=1), an HDMI Sink supports the
3D video formats that are mandatory formats," 

Continuing page 157:

"If 3D_present is set (=1), an HDMI Sink shall support 3D video formats
per the following requirements.
・An HDMI Sink which supports at least one 59.94 / 60Hz 2D video format
shall support *all* of <list of mandatory formats>"
・An HDMI Sink which supports at least one 50Hz 2D video format shall
support *all* of <list of mandatory formats>" 

The 3D pdf extraction from the spec is available would one want to
triple check the above:

   http://www.hdmi.org/manufacturer/specification.aspx

I have even dug up a direct link that someone made available:

  https://etmriwi.home.xs4all.nl/forum/hdmi_spec1.4a_3dextraction.pdf

Look for 3D_present, p. 15 and 17.

If the above is indeed correct, there may still be an issue in the way
we derive the mandatory modes - that part isn't really clear. Or, it
could be that people don't follow standards!

HTH,

-- 
Damien


_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]             ` <20170118114554.GA6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
@ 2017-01-18 16:27               ` Ilia Mirkin
       [not found]                 ` <CAKb7Uvg0wgmZG+S39XNP-r0Qny6ikDhwvyy9TAspOZQ_dEp1RQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Ilia Mirkin @ 2017-01-18 16:27 UTC (permalink / raw)
  To: Damien Lespiau
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä

On Wed, Jan 18, 2017 at 6:45 AM, Damien Lespiau
<damien.lespiau@intel.com> wrote:
> On Wed, Jan 18, 2017 at 12:10:56AM -0500, Ilia Mirkin wrote:
>> On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater
>> <alastair.bridgewater@gmail.com> wrote:
>> > HDMI specification 1.4a, table 8-15 is very explicitly a "must
>> > support at least one of" table, not a "must support all of" table.
>> > It is not hard to find hardware that does not support some of the
>> > so-called "mandatory" modes.
>> >
>> > More seriously, this code generates invalid display modes for both
>> > of the 3D-capable panels that I have (a 42-inch LG TV and a Sony
>> > PlayStation 3D Display).
>> >
>> > If we want to be persnickety, one option would be to check the
>> > final list of modes against the table and give some message if
>> > none of them are valid, but it's a whole lot easier just to delete
>> > the code in question.
>>
>> Damien added this in commit c858cfcae6d some 3 years ago.
>>
>> Damien, do you remember why you added these "required" modes? Did you
>> have a monitor that only advertised 3D support without the actual
>> modes?
>
> Another quick glance at the specs leads me to believe c858cfcae6d is
> correct.
>
> 8-15 does say that a sink supporting 3D must at lesst support one of the
> modes listed in that table. But that's just the very start of the story
> and we are really talking about the 3D_present bit in the HMDI VSDB and
> the associated "mandatory" modes (the term comes from the spec).
>
> HDMI 1.4a Page 155:
>
> "3D_present [1bit] This bit indicates 3D support by the HDMI Sink,
> including the mandatory formats. If set (=1), an HDMI Sink supports the
> 3D video formats that are mandatory formats,"
>
> Continuing page 157:
>
> "If 3D_present is set (=1), an HDMI Sink shall support 3D video formats
> per the following requirements.
> ・An HDMI Sink which supports at least one 59.94 / 60Hz 2D video format
> shall support *all* of <list of mandatory formats>"
> ・An HDMI Sink which supports at least one 50Hz 2D video format shall
> support *all* of <list of mandatory formats>"
>
> The 3D pdf extraction from the spec is available would one want to
> triple check the above:
>
>    http://www.hdmi.org/manufacturer/specification.aspx
>
> I have even dug up a direct link that someone made available:
>
>   https://etmriwi.home.xs4all.nl/forum/hdmi_spec1.4a_3dextraction.pdf
>
> Look for 3D_present, p. 15 and 17.
>
> If the above is indeed correct, there may still be an issue in the way
> we derive the mandatory modes - that part isn't really clear. Or, it
> could be that people don't follow standards!

OK, so the text definitely makes it seem like you're right.

Damien - did you ever test these mandatory modes on an actual
commercial 3D TV or similar device?

Alastair - I think this warrants some more attempts at getting those
"extra" modes to work. I'd be especially curious whether the blob
shows support for these modes, or what Windows shows with any
hardware.
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]                 ` <CAKb7Uvg0wgmZG+S39XNP-r0Qny6ikDhwvyy9TAspOZQ_dEp1RQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-01-18 16:33                   ` Damien Lespiau
       [not found]                     ` <20170118163343.GD6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Damien Lespiau @ 2017-01-18 16:33 UTC (permalink / raw)
  To: Ilia Mirkin
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä

On Wed, Jan 18, 2017 at 11:27:16AM -0500, Ilia Mirkin wrote:
> Damien - did you ever test these mandatory modes on an actual
> commercial 3D TV or similar device?

My main testing device was a Samsung TV with this 3D_present bit set and
all the advertised modes were working. Can't quite remember if that
included the interleaved mode.

-- 
Damien
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]                     ` <20170118163343.GD6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
@ 2017-01-18 16:41                       ` Damien Lespiau
  2017-01-18 16:57                         ` [Nouveau] " Ilia Mirkin
  0 siblings, 1 reply; 48+ messages in thread
From: Damien Lespiau @ 2017-01-18 16:41 UTC (permalink / raw)
  To: Ilia Mirkin
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä

On Wed, Jan 18, 2017 at 04:33:43PM +0000, Damien Lespiau wrote:
> On Wed, Jan 18, 2017 at 11:27:16AM -0500, Ilia Mirkin wrote:
> > Damien - did you ever test these mandatory modes on an actual
> > commercial 3D TV or similar device?
> 
> My main testing device was a Samsung TV with this 3D_present bit set and
> all the advertised modes were working. Can't quite remember if that
> included the interleaved mode.

I even pushed the EDID of that TV to edid-decode [1] if someone needs to
check that the EDID parsing is correct. It'd be interesting to see what
the tool has to say about the edid of the sink causing problems, in
particular compare the mandatory modes to the other modes advertised by
that TV. Maybe we could see some kind of pattern emerge, like the 3D
modes supported being the ones with the timings in table 8-15.

-- 
Damien

[1] https://cgit.freedesktop.org/xorg/app/edid-decode/
    data/samsung-UE40D8000YU-hmdi
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [Nouveau] [PATCH 5/6] drm: Delete "mandatory" stereographic modes
  2017-01-18 16:41                       ` Damien Lespiau
@ 2017-01-18 16:57                         ` Ilia Mirkin
  2017-01-18 18:48                           ` Ilia Mirkin
  0 siblings, 1 reply; 48+ messages in thread
From: Ilia Mirkin @ 2017-01-18 16:57 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: nouveau, Alastair Bridgewater, dri-devel

On Wed, Jan 18, 2017 at 11:41 AM, Damien Lespiau
<damien.lespiau@intel.com> wrote:
> On Wed, Jan 18, 2017 at 04:33:43PM +0000, Damien Lespiau wrote:
>> On Wed, Jan 18, 2017 at 11:27:16AM -0500, Ilia Mirkin wrote:
>> > Damien - did you ever test these mandatory modes on an actual
>> > commercial 3D TV or similar device?
>>
>> My main testing device was a Samsung TV with this 3D_present bit set and
>> all the advertised modes were working. Can't quite remember if that
>> included the interleaved mode.
>
> I even pushed the EDID of that TV to edid-decode [1] if someone needs to
> check that the EDID parsing is correct. It'd be interesting to see what
> the tool has to say about the edid of the sink causing problems, in
> particular compare the mandatory modes to the other modes advertised by
> that TV. Maybe we could see some kind of pattern emerge, like the 3D
> modes supported being the ones with the timings in table 8-15.

This is Alastair's display (one of them): http://paste.lisp.org/display/335893

I believe this is the interesting part:

  Video data block
    VIC  16 1920x1080@60Hz
    VIC  31 1920x1080@50Hz
    VIC   5 1920x1080i@60Hz
    VIC  20 1920x1080i@50Hz
    VIC   4 1280x720@60Hz
    VIC  19 1280x720@50Hz
    VIC   3 720x480@60Hz
    VIC   2 720x480@60Hz
    VIC  18 720x576@50Hz
    VIC  17 720x576@50Hz
    VIC   7 1440x480i@60Hz
    VIC   6 1440x480i@60Hz
    VIC  22 1440x576i@50Hz
    VIC  21 1440x576i@50Hz
    VIC  32 1920x1080@24Hz
    VIC   1 640x480@60Hz
...
    Extended HDMI video details:
      3D present
      Base EDID image size is in units of 1cm
      VIC index 2 supports side-by-side (half, horizontal)
      VIC index 3 supports side-by-side (half, horizontal)
      VIC index 4 supports side-by-side (half, horizontal)
      VIC index 5 supports side-by-side (half, horizontal)
      VIC index 14 supports side-by-side (half, horizontal)
      VIC index 0 supports top-and-bottom
      VIC index 1 supports top-and-bottom
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [Nouveau] [PATCH 5/6] drm: Delete "mandatory" stereographic modes
  2017-01-18 16:57                         ` [Nouveau] " Ilia Mirkin
@ 2017-01-18 18:48                           ` Ilia Mirkin
       [not found]                             ` <CAKb7UviODH0YPH-EMUmO9Ssu5BrBb3GVa82SGawbQbiO5NKXAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Ilia Mirkin @ 2017-01-18 18:48 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: nouveau, Alastair Bridgewater, dri-devel

On Wed, Jan 18, 2017 at 11:57 AM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Wed, Jan 18, 2017 at 11:41 AM, Damien Lespiau
> <damien.lespiau@intel.com> wrote:
>> On Wed, Jan 18, 2017 at 04:33:43PM +0000, Damien Lespiau wrote:
>>> On Wed, Jan 18, 2017 at 11:27:16AM -0500, Ilia Mirkin wrote:
>>> > Damien - did you ever test these mandatory modes on an actual
>>> > commercial 3D TV or similar device?
>>>
>>> My main testing device was a Samsung TV with this 3D_present bit set and
>>> all the advertised modes were working. Can't quite remember if that
>>> included the interleaved mode.
>>
>> I even pushed the EDID of that TV to edid-decode [1] if someone needs to
>> check that the EDID parsing is correct. It'd be interesting to see what
>> the tool has to say about the edid of the sink causing problems, in
>> particular compare the mandatory modes to the other modes advertised by
>> that TV. Maybe we could see some kind of pattern emerge, like the 3D
>> modes supported being the ones with the timings in table 8-15.
>
> This is Alastair's display (one of them): http://paste.lisp.org/display/335893
>
> I believe this is the interesting part:
>
>   Video data block
>     VIC  16 1920x1080@60Hz
>     VIC  31 1920x1080@50Hz
>     VIC   5 1920x1080i@60Hz
>     VIC  20 1920x1080i@50Hz
>     VIC   4 1280x720@60Hz
>     VIC  19 1280x720@50Hz
>     VIC   3 720x480@60Hz
>     VIC   2 720x480@60Hz
>     VIC  18 720x576@50Hz
>     VIC  17 720x576@50Hz
>     VIC   7 1440x480i@60Hz
>     VIC   6 1440x480i@60Hz
>     VIC  22 1440x576i@50Hz
>     VIC  21 1440x576i@50Hz
>     VIC  32 1920x1080@24Hz
>     VIC   1 640x480@60Hz
> ...
>     Extended HDMI video details:
>       3D present
>       Base EDID image size is in units of 1cm
>       VIC index 2 supports side-by-side (half, horizontal)
>       VIC index 3 supports side-by-side (half, horizontal)
>       VIC index 4 supports side-by-side (half, horizontal)
>       VIC index 5 supports side-by-side (half, horizontal)
>       VIC index 14 supports side-by-side (half, horizontal)
>       VIC index 0 supports top-and-bottom
>       VIC index 1 supports top-and-bottom

And for the record, this is his other TV (available at the same paste
url as above):

  Video data block
    VIC  16 1920x1080@60Hz (native)
    VIC  34 1920x1080@30Hz
    VIC  32 1920x1080@24Hz
    VIC   5 1920x1080i@60Hz
    VIC   4 1280x720@60Hz
    VIC   3 720x480@60Hz
    VIC   2 720x480@60Hz
    VIC   1 640x480@60Hz
    Extended HDMI video details:
      3D present
      3D-capable-VIC mask present
      3D: Side-by-side (half, horizontal)
      3D: Top-and-bottom
      3D VIC indices: 2 4
      VIC index 0 supports side-by-side (half, horizontal)
      VIC index 1 supports side-by-side (half, horizontal)
      VIC index 2 supports side-by-side (half, horizontal)
      VIC index 3 supports side-by-side (half, horizontal)
      VIC index 4 supports side-by-side (half, horizontal)

After some more conversations with Alastair, it sounds like what's
actually going on is that it's just the frame-packing modes that
aren't working, but all the side-by-side and top-and-bottom modes from
the "mandatory" list work. At this point, I'm more inclined to believe
that there's an issue in the nouveau implementation for frame-packed
modes. But it could still be the TVs themselves that don't support
that at all.

Cheers,

  -ilia
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]                             ` <CAKb7UviODH0YPH-EMUmO9Ssu5BrBb3GVa82SGawbQbiO5NKXAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-01-18 19:01                               ` Damien Lespiau
       [not found]                                 ` <20170118190119.GF6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Damien Lespiau @ 2017-01-18 19:01 UTC (permalink / raw)
  To: Ilia Mirkin
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä

On Wed, Jan 18, 2017 at 01:48:04PM -0500, Ilia Mirkin wrote:
> After some more conversations with Alastair, it sounds like what's
> actually going on is that it's just the frame-packing modes that
> aren't working, but all the side-by-side and top-and-bottom modes from
> the "mandatory" list work. At this point, I'm more inclined to believe
> that there's an issue in the nouveau implementation for frame-packed
> modes. But it could still be the TVs themselves that don't support
> that at all.

If Alastair has an intel GPU as well, an "easy" way to check if the
frame packing modes of those TVs work would be to use the testdisplay[1]
tool of intel-gpu-tools.

Shameless plug: http://damien.lespiau.name/2013/10/hdmi-stereo-3d-kms.html

Towards the end of the post, there are test display usage examples to go
and test FP modes. Mind you, people have been trying to make
intel-gpu-tools run on any DRM driver when possible, not sure how far we
are with that though.

-- 
Damien

[1] http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/tests/testdisplay.c
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes
       [not found]                                 ` <20170118190119.GF6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
@ 2017-01-18 21:35                                   ` Alastair Bridgewater
  0 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-01-18 21:35 UTC (permalink / raw)
  To: Damien Lespiau
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä


[-- Attachment #1.1: Type: text/plain, Size: 3196 bytes --]

On Wed, Jan 18, 2017 at 2:01 PM, Damien Lespiau <damien.lespiau-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
wrote:
>
> On Wed, Jan 18, 2017 at 01:48:04PM -0500, Ilia Mirkin wrote:
> > After some more conversations with Alastair, it sounds like what's
> > actually going on is that it's just the frame-packing modes that
> > aren't working, but all the side-by-side and top-and-bottom modes from
> > the "mandatory" list work. At this point, I'm more inclined to believe
> > that there's an issue in the nouveau implementation for frame-packed
> > modes. But it could still be the TVs themselves that don't support
> > that at all.

By now, and having re-read the relevant spec extract a couple of times,
I'm convinced that the "mandatory" stereographic modes are just that, but
also that the current implementation is incorrect (if anything, too
conservative about adding modes).  In the unlikely event that a display
advertises only a 512x384x1bpp@60Hz mode (I don't even know if that's
possible in terms of an EDID, but let's take it as an example), but also
sets the 3D flag, it must support five specific 3D modes, but the current
implementation would match none.

I'm definitely willing to table changing the mandatory mode logic for the
time being, at least until the question of frame packing on my hardware
is sorted out.

> If Alastair has an intel GPU as well, an "easy" way to check if the
> frame packing modes of those TVs work would be to use the testdisplay[1]
> tool of intel-gpu-tools.

If I have an intel GPU handy, I think that it's getting disabled by the
system BIOS or something due to hardware configuration.  I have a couple
of things to try, and there might be a machine with an intel GPU that I
can borrow next week, though.

Should any intel GPU with an HDMI output work, or do I need to look for
something more specific?

I should also have access to the restore disks that came with some of my
hardware as of this weekend, so I can see what the, ah, *other* operating
system has to say about things.

> Shameless plug: http://damien.lespiau.name/2013/10/hdmi-stereo-3d-kms.html

I had found this, which led me to intel-gpu-tools, and thus testdisplay,
which is what I've been using.  It's a very nice explanation of how things
should work overall...  But it calls one question to mind: Is there userland
software other than testdisplay that does anything with stereo 3D support?

> Towards the end of the post, there are test display usage examples to go
> and test FP modes. Mind you, people have been trying to make
> intel-gpu-tools run on any DRM driver when possible, not sure how far we
> are with that though.

... Which raises the number of possibilities that we're dealing with to
three:

 1. The displays really don't support frame packing.

 2. There's something not yet right with nouveau that breaks frame packing.

 3. There's something not yet right with testdisplay that breaks frame
packing
    on nouveau (I had previously presumed that testdisplay wasn't going to
be
    a problem, but it sounds like it might be worth me digging into).

> --
> Damien
>
> [1]
http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/tests/testdisplay.c

-- Alastair

[-- Attachment #1.2: Type: text/html, Size: 5232 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v2 00/10] Enable HDMI Stereoscopy
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (5 preceding siblings ...)
  2017-01-17 22:42   ` [PATCH 6/6] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
@ 2017-03-27 21:57   ` Alastair Bridgewater
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-04-11 17:11   ` [PATCH v3 00/10] drm/nouveau " Alastair Bridgewater
  7 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:57 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

HDMI 3D mode support, round two.  Revisions include no longer dealing
with audio InfoFrames, passing infoframe data to NVKM as bags of bytes
rather than as data pre-packed for the hardware, more-normal return
value checking for drm_hdmi_*_infoframe_from_display_mode() results,
Frame-Packing mode support, more-principled logic for enabling stereo
mode support on a connector, and support for all four nv50+ DISPs.
Additionally, this patch set is being sent to the dri-devel list as
well as the nouveau list.  Dropped in this version is the removal of
the "mandatory" 3D mode logic.  After discussion, I'm still convinced
that it's wrong, but now I'm convinced that it's too conservative
rather than my original belief which was that it was too liberal.

Thanks to Ilia Mirkin, Damien Lespiau, and Ben Skeggs for feedback on
the original patch set.  If I have neglected to mention anyone, mea
culpa.

The first patch perhaps isn't technically necessary, but simplifies
the later logic for fixing frame-packing mode timing.  There may be
some effect from applying this, as drm_mode_set_crtcinfo() does
something with vscan which can affect the given CRTC timing.  I'm
not sure what's going on there, if there's any behavioral change or
not, and if there is what to do about it (other than using
drm_mode_set_crtcinfo() twice, once with CRTC_NO_VSCAN and once
without).

The second through eighth patches are all the InfoFrame logic again,
this time with support for all four DISP types.  This does not appear
to cause regressions in HDMI audio on GT215, GF119, or GK104.  I hope
that it doesn't cause a regression on G84, but haven't yet managed to
set up a test case for G84 and HDMI audio.

The ninth patch is to fix up frame-packing mode timings and geometry.
As the patch comment says, there are clearly-correct parts, and there
are possibly-hacky parts.  But it gets frame-packing modes working,
and we can revise from there if necessary.

And the tenth patch enables stereo mode support...  on HDMI and DPort
connectors on nv50+ hardware.  HDMI connectors because obvious.  DPort
connectors because of DPort to HDMI adaptors.  eDP connectors because
it shouldn't do any harm, and someone might have been maniac enough to
set up an eDP port to point to something with an HDMI 3D setup.  And
nv50+ hardware only because while I'm not aware of any pre-nv50 cards
that have HDMI outputs, there could be a setup out there like the PS3
that uses an external HDMI encoder on pre-nv50 hardware, at which
point none of the mode timing or InfoFrame support is in place for it.

Alastair Bridgewater (10):
  drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan /
    ilace
  drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
  drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to
    NVKM
  drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware
    format
  drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
  drm/nouveau: Handle frame-packing mode geometry and timing effects
  drm/nouveau: Enable stereoscopic 3D output over HDMI

 drivers/gpu/drm/nouveau/include/nvif/cl5070.h      |  4 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c        | 10 +++
 drivers/gpu/drm/nouveau/nv50_display.c             | 80 ++++++++++++++++------
 drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild    |  1 +
 .../drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c  | 66 ++++++++++++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 46 +++++++++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 49 +++++++++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 45 ++++++++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 46 +++++++++++--
 drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h    | 11 +++
 10 files changed, 307 insertions(+), 51 deletions(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c

-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v2 01/10] drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan / ilace
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-03-27 21:57       ` Alastair Bridgewater
  2017-03-27 21:57       ` [PATCH v2 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
                         ` (9 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:57 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

  * drm_mode_set_crtcinfo() does compensation for interlace and
doublescan timing effects already, so do it first and use the
compensated figures instead of the constant "vscan / ilace" terms
that we had before.

  * Also prefer using the mode->crtc_* fields generally instead of
the non-crtc_-prefixed versions, largely to avoid potential
confusion as to why some fields are the crtc_ versions and some
are not, but also in case drm_mode_set_crtcinfo() adds some more
mode-specific logic that we might want to use.

  * In one case, we use the non-crtc_-prefixed version of a mode
field, because the original form didn't include a "vscan / ilace"
term.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 32097fd..1acbb5a 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2032,32 +2032,34 @@ static void
 nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
 	struct drm_display_mode *mode = &asyh->state.adjusted_mode;
-	u32 ilace   = (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 2 : 1;
-	u32 vscan   = (mode->flags & DRM_MODE_FLAG_DBLSCAN) ? 2 : 1;
-	u32 hbackp  =  mode->htotal - mode->hsync_end;
-	u32 vbackp  = (mode->vtotal - mode->vsync_end) * vscan / ilace;
-	u32 hfrontp =  mode->hsync_start - mode->hdisplay;
-	u32 vfrontp = (mode->vsync_start - mode->vdisplay) * vscan / ilace;
 	struct nv50_head_mode *m = &asyh->mode;
+	u32 hbackp, vbackp, hfrontp, vfrontp;
 
-	m->h.active = mode->htotal;
-	m->h.synce  = mode->hsync_end - mode->hsync_start - 1;
+	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+
+	hbackp = mode->crtc_htotal - mode->crtc_hsync_end;
+	vbackp = mode->crtc_vtotal - mode->crtc_vsync_end;
+	hfrontp =  mode->crtc_hsync_start - mode->crtc_hdisplay;
+	vfrontp = mode->crtc_vsync_start - mode->crtc_vdisplay;
+
+	m->h.active = mode->crtc_htotal;
+	m->h.synce  = mode->crtc_hsync_end - mode->crtc_hsync_start - 1;
 	m->h.blanke = m->h.synce + hbackp;
-	m->h.blanks = mode->htotal - hfrontp - 1;
+	m->h.blanks = mode->crtc_htotal - hfrontp - 1;
 
-	m->v.active = mode->vtotal * vscan / ilace;
-	m->v.synce  = ((mode->vsync_end - mode->vsync_start) * vscan / ilace) - 1;
+	m->v.active = mode->crtc_vtotal;
+	m->v.synce  = (mode->crtc_vsync_end - mode->crtc_vsync_start) - 1;
 	m->v.blanke = m->v.synce + vbackp;
 	m->v.blanks = m->v.active - vfrontp - 1;
 
 	/*XXX: Safe underestimate, even "0" works */
 	m->v.blankus = (m->v.active - mode->vdisplay - 2) * m->h.active;
 	m->v.blankus *= 1000;
-	m->v.blankus /= mode->clock;
+	m->v.blankus /= mode->crtc_clock;
 
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
 		m->v.blank2e =  m->v.active + m->v.synce + vbackp;
-		m->v.blank2s =  m->v.blank2e + (mode->vdisplay * vscan / ilace);
+		m->v.blank2s =  m->v.blank2e + mode->crtc_vdisplay;
 		m->v.active  = (m->v.active * 2) + 1;
 		m->interlace = true;
 	} else {
@@ -2065,9 +2067,8 @@ nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
 		m->v.blank2s = 1;
 		m->interlace = false;
 	}
-	m->clock = mode->clock;
+	m->clock = mode->crtc_clock;
 
-	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 	asyh->set.mode = true;
 }
 
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-03-27 21:57       ` [PATCH v2 01/10] drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan / ilace Alastair Bridgewater
@ 2017-03-27 21:57       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
                         ` (8 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:57 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The nouveau driver, in the Linux 3.7 days, used to try and set the
AVI InfoFrame based on the selected display mode.  These days, it
uses a fixed set of InfoFrames.  Start to correct that, by
providing a mechanism whereby InfoFrame data may be passed to the
NVKM functions that do the actual configuration.

At this point, only establish the new parameters and their parsing,
don't actually use the data anywhere yet (since it's not supplied
anywhere).

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/include/nvif/cl5070.h        | 4 +++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c   | 9 ++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c | 9 ++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c | 9 ++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c | 9 ++++++++-
 5 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
index ae49dfd..9d46eba 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
@@ -76,7 +76,9 @@ struct nv50_disp_sor_hdmi_pwr_v0 {
 	__u8  state;
 	__u8  max_ac_packet;
 	__u8  rekey;
-	__u8  pad04[4];
+	__u8  avi_infoframe_length;
+	__u8  vendor_infoframe_length;
+	__u8  pad06[2];
 };
 
 struct nv50_disp_sor_lvds_script_v0 {
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
index 1c4256e..77e5f5a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
@@ -40,7 +40,7 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -54,6 +54,13 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x6165a4 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
index 632f02d..66ee883 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
@@ -40,7 +40,7 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -53,6 +53,13 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
index 4e8067d..3c8c26a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
@@ -41,7 +41,7 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -54,6 +54,13 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
index f1afc16..8ed00db 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
@@ -41,7 +41,7 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -55,6 +55,13 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-03-27 21:57       ` [PATCH v2 01/10] drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan / ilace Alastair Bridgewater
  2017-03-27 21:57       ` [PATCH v2 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
                         ` (7 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have mechanism by which to pass mode-dependent HDMI
InfoFrames to the low-level hardware driver, it is incumbent upon
us to do so.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 1acbb5a..008aea6 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -23,6 +23,7 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/hdmi.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -31,6 +32,7 @@
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_edid.h>
 
 #include <nvif/class.h>
 #include <nvif/cl0002.h>
@@ -2782,6 +2784,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	struct {
 		struct nv50_disp_mthd_v1 base;
 		struct nv50_disp_sor_hdmi_pwr_v0 pwr;
+		u8 infoframes[2 * 17]; /* two frames, up to 17 bytes each */
 	} args = {
 		.base.version = 1,
 		.base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR,
@@ -2793,17 +2796,42 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	};
 	struct nouveau_connector *nv_connector;
 	u32 max_ac_packet;
+	union hdmi_infoframe avi_frame;
+	union hdmi_infoframe vendor_frame;
+	int ret;
+	int size;
 
 	nv_connector = nouveau_encoder_connector_get(nv_encoder);
 	if (!drm_detect_hdmi_monitor(nv_connector->edid))
 		return;
 
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode);
+	if (!ret) {
+		/* We have an AVI InfoFrame, populate it to the display */
+		args.pwr.avi_infoframe_length
+			= hdmi_infoframe_pack(&avi_frame, args.infoframes, 17);
+	}
+
+	ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode);
+	if (!ret) {
+		/* We have a Vendor InfoFrame, populate it to the display */
+		args.pwr.vendor_infoframe_length
+			= hdmi_infoframe_pack(&vendor_frame,
+					      args.infoframes
+					      + args.pwr.avi_infoframe_length,
+					      17);
+	}
+
 	max_ac_packet  = mode->htotal - mode->hdisplay;
 	max_ac_packet -= args.pwr.rekey;
 	max_ac_packet -= 18; /* constant from tegra */
 	args.pwr.max_ac_packet = max_ac_packet / 32;
 
-	nvif_mthd(disp->disp, 0, &args, sizeof(args));
+	size = sizeof(args.base)
+		+ sizeof(args.pwr)
+		+ args.pwr.avi_infoframe_length
+		+ args.pwr.vendor_infoframe_length;
+	nvif_mthd(disp->disp, 0, &args, size);
 	nv50_audio_enable(encoder, mode);
 }
 
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (2 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
                         ` (6 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

HDMI InfoFrames are passed to NVKM as bags of bytes, but the
hardware needs them to be packed into words.  Rather than having
four (or more) copies of the packing logic introduce a single copy
now, in a central place.

We currently need these for AVI and Vendor InfoFrames, but we may
also expect to need them for Audio InfoFrames at some point.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild    |  1 +
 .../drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c  | 66 ++++++++++++++++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h    | 11 ++++
 3 files changed, 78 insertions(+)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
index fa05d16..65ae870 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
@@ -29,6 +29,7 @@ nvkm-y += nvkm/engine/disp/conn.o
 nvkm-y += nvkm/engine/disp/hdagt215.o
 nvkm-y += nvkm/engine/disp/hdagf119.o
 
+nvkm-y += nvkm/engine/disp/hdmi_infoframe.o
 nvkm-y += nvkm/engine/disp/hdmig84.o
 nvkm-y += nvkm/engine/disp/hdmigt215.o
 nvkm-y += nvkm/engine/disp/hdmigf119.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c
new file mode 100644
index 0000000..e04f2e8
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c
@@ -0,0 +1,66 @@
+#include "nv50.h"
+
+void pack_hdmi_infoframe(struct packed_hdmi_infoframe *packed_frame,
+			 u8 *raw_frame, ssize_t len)
+{
+	u32 header = 0;
+	u32 subpack0_low = 0;
+	u32 subpack0_high = 0;
+	u32 subpack1_low = 0;
+	u32 subpack1_high = 0;
+
+	switch (len) {
+		/*
+		 * "When in doubt, use brute force."
+		 *     -- Ken Thompson.
+		 */
+	default:
+		/*
+		 * We presume that no valid frame is longer than 17
+		 * octets, including header...  And truncate to that
+		 * if it's longer.
+		 */
+	case 17:
+		subpack1_high = (raw_frame[16] << 16);
+	case 16:
+		subpack1_high |= (raw_frame[15] << 8);
+	case 15:
+		subpack1_high |= raw_frame[14];
+	case 14:
+		subpack1_low = (raw_frame[13] << 24);
+	case 13:
+		subpack1_low |= (raw_frame[12] << 16);
+	case 12:
+		subpack1_low |= (raw_frame[11] << 8);
+	case 11:
+		subpack1_low |= raw_frame[10];
+	case 10:
+		subpack0_high = (raw_frame[9] << 16);
+	case 9:
+		subpack0_high |= (raw_frame[8] << 8);
+	case 8:
+		subpack0_high |= raw_frame[7];
+	case 7:
+		subpack0_low = (raw_frame[6] << 24);
+	case 6:
+		subpack0_low |= (raw_frame[5] << 16);
+	case 5:
+		subpack0_low |= (raw_frame[4] << 8);
+	case 4:
+		subpack0_low |= raw_frame[3];
+	case 3:
+		header = (raw_frame[2] << 16);
+	case 2:
+		header |= (raw_frame[1] << 8);
+	case 1:
+		header |= raw_frame[0];
+	case 0:
+		break;
+	}
+
+	packed_frame->header = header;
+	packed_frame->subpack0_low = subpack0_low;
+	packed_frame->subpack0_high = subpack0_high;
+	packed_frame->subpack1_low = subpack1_low;
+	packed_frame->subpack1_high = subpack1_high;
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
index 1e1de6b..37ec2a1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
@@ -40,6 +40,17 @@ int nv50_dac_sense(NV50_DISP_MTHD_V1);
 int gt215_hda_eld(NV50_DISP_MTHD_V1);
 int gf119_hda_eld(NV50_DISP_MTHD_V1);
 
+struct packed_hdmi_infoframe {
+	u32 header;
+	u32 subpack0_low;
+	u32 subpack0_high;
+	u32 subpack1_low;
+	u32 subpack1_high;
+};
+
+void pack_hdmi_infoframe(struct packed_hdmi_infoframe *packed_frame,
+			 u8 *raw_frame, ssize_t len);
+
 int g84_hdmi_ctrl(NV50_DISP_MTHD_V1);
 int gt215_hdmi_ctrl(NV50_DISP_MTHD_V1);
 int gf119_hdmi_ctrl(NV50_DISP_MTHD_V1);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (3 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
                         ` (5 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any AVI or Vendor InfoFrame that is not provided,
and disable the Vendor InfoFrame when disabling the output.

Ignore the Audio InfoFrame: We don't supply it, and altering HDMI
audio semantics (for better or worse) on this hardware is out of
scope for me at this time.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
index 77e5f5a..139344e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
@@ -36,6 +36,8 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -61,8 +63,17 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x6165a4 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x61653c + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x616500 + hoff, 0x00000001, 0x00000000);
 		return 0;
@@ -70,12 +81,14 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x616528 + hoff, 0x000d0282);
-	nvkm_wr32(device, 0x61652c + hoff, 0x0000006f);
-	nvkm_wr32(device, 0x616530 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x616534 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x616538 + hoff, 0x00000000);
-	nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x616528 + hoff, avi_infoframe.header);
+		nvkm_wr32(device, 0x61652c + hoff, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x616530 + hoff, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x616534 + hoff, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x616538 + hoff, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000001);
+	}
 
 	/* Audio InfoFrame */
 	nvkm_mask(device, 0x616500 + hoff, 0x00000001, 0x00000000);
@@ -84,6 +97,18 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	nvkm_wr32(device, 0x616510 + hoff, 0x00000000);
 	nvkm_mask(device, 0x616500 + hoff, 0x00000001, 0x00000001);
 
+	/* Vendor InfoFrame */
+	nvkm_mask(device, 0x61653c + hoff, 0x00010001, 0x00010000);
+	if (args->v0.vendor_infoframe_length) {
+		nvkm_wr32(device, 0x616544 + hoff, vendor_infoframe.header);
+		nvkm_wr32(device, 0x616548 + hoff, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x61654c + hoff, vendor_infoframe.subpack0_high);
+		/* Is there a second (or up to fourth?) set of subpack registers here? */
+		/* nvkm_wr32(device, 0x616550 + hoff, vendor_infoframe->subpack1_low); */
+		/* nvkm_wr32(device, 0x616554 + hoff, vendor_infoframe->subpack1_high); */
+		nvkm_mask(device, 0x61653c + hoff, 0x00010001, 0x00010001);
+	}
+
 	nvkm_mask(device, 0x6165d0 + hoff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
 	nvkm_mask(device, 0x616568 + hoff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
 	nvkm_mask(device, 0x616578 + hoff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (4 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
                         ` (4 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic") InfoFrame.

Also don't enable any AVI or Vendor InfoFrame that is not provided,
and disable the Vendor InfoFrame when disabling the output.

Ignore the Audio InfoFrame: We don't supply it, and altering HDMI
audio semantics (for better or worse) on this hardware is out of
scope for me at this time.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
index 8ed00db..257f7c7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
@@ -37,6 +37,8 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -62,8 +64,17 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x61c53c + soff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000000);
 		return 0;
@@ -71,12 +82,14 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x61c528 + soff, 0x000d0282);
-	nvkm_wr32(device, 0x61c52c + soff, 0x0000006f);
-	nvkm_wr32(device, 0x61c530 + soff, 0x00000000);
-	nvkm_wr32(device, 0x61c534 + soff, 0x00000000);
-	nvkm_wr32(device, 0x61c538 + soff, 0x00000000);
-	nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x61c528 + soff, avi_infoframe.header);
+		nvkm_wr32(device, 0x61c52c + soff, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x61c530 + soff, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x61c534 + soff, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x61c538 + soff, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000001);
+	}
 
 	/* Audio InfoFrame */
 	nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000000);
@@ -85,6 +98,18 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	nvkm_wr32(device, 0x61c510 + soff, 0x00000000);
 	nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000001);
 
+	/* Vendor InfoFrame */
+	nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010000);
+	if (args->v0.vendor_infoframe_length) {
+		nvkm_wr32(device, 0x61c544 + soff, vendor_infoframe.header);
+		nvkm_wr32(device, 0x61c548 + soff, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x61c54c + soff, vendor_infoframe.subpack0_high);
+		/* Is there a second (or up to fourth?) set of subpack registers here? */
+		/* nvkm_wr32(device, 0x61c550 + soff, vendor_infoframe.subpack1_low); */
+		/* nvkm_wr32(device, 0x61c554 + soff, vendor_infoframe.subpack1_high); */
+		nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010001);
+	}
+
 	nvkm_mask(device, 0x61c5d0 + soff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
 	nvkm_mask(device, 0x61c568 + soff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
 	nvkm_mask(device, 0x61c578 + soff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (5 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
                         ` (3 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any InfoFrame that is not provided, and disable
the Vendor InfoFrame when disabling the output.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 40 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
index 66ee883..d80e86c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
@@ -36,6 +36,8 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -60,8 +62,17 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x616730 + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000000);
 		return 0;
@@ -69,12 +80,29 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x61671c + hoff, 0x000d0282);
-	nvkm_wr32(device, 0x616720 + hoff, 0x0000006f);
-	nvkm_wr32(device, 0x616724 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x616728 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x61672c + hoff, 0x00000000);
-	nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x61671c + hoff, avi_infoframe.header);
+		nvkm_wr32(device, 0x616720 + hoff, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x616724 + hoff, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x616728 + hoff, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x61672c + hoff, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000001);
+	}
+
+	/* GENERIC(?) / Vendor InfoFrame? */
+	nvkm_mask(device, 0x616730 + hoff, 0x00010001, 0x00010000);
+	if (args->v0.vendor_infoframe_length) {
+		/*
+		 * These appear to be the audio infoframe registers,
+		 * but no other set of infoframe registers has yet
+		 * been found.
+		 */
+		nvkm_wr32(device, 0x616738 + hoff, vendor_infoframe.header);
+		nvkm_wr32(device, 0x61673c + hoff, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x616740 + hoff, vendor_infoframe.subpack0_high);
+		/* Is there a second (or further?) set of subpack registers here? */
+		nvkm_mask(device, 0x616730 + hoff, 0x00000001, 0x00000001);
+	}
 
 	/* ??? InfoFrame? */
 	nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (6 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-27 21:58       ` [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
                         ` (2 subsequent siblings)
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any InfoFrame that is not provided, and disable
the Vendor InfoFrame when disabling the output.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 36 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
index 3c8c26a..99d2731 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
@@ -37,6 +37,8 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -61,8 +63,17 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
 		return 0;
@@ -70,12 +81,25 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x690008 + hdmi, 0x000d0282);
-	nvkm_wr32(device, 0x69000c + hdmi, 0x0000006f);
-	nvkm_wr32(device, 0x690010 + hdmi, 0x00000000);
-	nvkm_wr32(device, 0x690014 + hdmi, 0x00000000);
-	nvkm_wr32(device, 0x690018 + hdmi, 0x00000000);
-	nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x690008 + hdmi, avi_infoframe.header);
+		nvkm_wr32(device, 0x69000c + hdmi, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x690010 + hdmi, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x690014 + hdmi, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x690018 + hdmi, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000001);
+	}
+
+	/* GENERIC(?) / Vendor InfoFrame? */
+	nvkm_mask(device, 0x690100 + hdmi, 0x00010001, 0x00000000);
+	if (args->v0.vendor_infoframe_length) {
+		nvkm_wr32(device, 0x690108 + hdmi, vendor_infoframe.header);
+		nvkm_wr32(device, 0x69010c + hdmi, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x690110 + hdmi, vendor_infoframe.subpack0_high);
+		/* Is there a second (or further?) set of subpack registers here? */
+		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000001);
+	}
+
 
 	/* ??? InfoFrame? */
 	nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (7 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
       [not found]         ` <20170327215807.8461-10-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-03-27 21:58       ` [PATCH v2 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
  2017-03-29 12:02       ` [PATCH v2 00/10] Enable HDMI Stereoscopy Ville Syrjälä
  10 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

  * Frame-packing modes add an extra vtotal raster lines to each
frame above and beyond what the basic mode description calls for.
Account for this during scaler configuration (possibly a bit of a
hack), during CRTC configuration (clearly not a hack), and when
checking that a mode is vaild for a given connector (cribbed from
the i915 driver).

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c |  3 +++
 drivers/gpu/drm/nouveau/nv50_display.c      | 21 ++++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 947c200..4e3563e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1044,6 +1044,9 @@ nouveau_connector_mode_valid(struct drm_connector *connector,
 		return MODE_BAD;
 	}
 
+	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+		clock *= 2;
+
 	if (clock < min_clock)
 		return MODE_CLOCK_LOW;
 
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 008aea6..fa97604 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1963,6 +1963,7 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	struct drm_display_mode *umode = &asyh->state.mode;
 	int mode = asyc->scaler.mode;
 	struct edid *edid;
+	int umode_vdisplay, omode_hdisplay, omode_vdisplay;
 
 	if (connector->edid_blob_ptr)
 		edid = (struct edid *)connector->edid_blob_ptr->data;
@@ -1977,12 +1978,18 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 		mode = DRM_MODE_SCALE_FULLSCREEN;
 	}
 
+	/* For the user-specified mode, we must ignore doublescan and
+	 * the like, but honor frame packing.
+	 */
+	umode_vdisplay = umode->vdisplay;
+	if ((umode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+		umode_vdisplay += umode->vtotal;
 	asyh->view.iW = umode->hdisplay;
-	asyh->view.iH = umode->vdisplay;
-	asyh->view.oW = omode->hdisplay;
-	asyh->view.oH = omode->vdisplay;
-	if (omode->flags & DRM_MODE_FLAG_DBLSCAN)
-		asyh->view.oH *= 2;
+	asyh->view.iH = umode_vdisplay;
+	/* For the ouput mode, we can just use the stock helper. */
+	drm_crtc_get_hv_timing(omode, &omode_hdisplay, &omode_vdisplay);
+	asyh->view.oW = omode_hdisplay;
+	asyh->view.oH = omode_vdisplay;
 
 	/* Add overscan compensation if necessary, will keep the aspect
 	 * ratio the same as the backend mode unless overridden by the
@@ -2012,7 +2019,7 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	switch (mode) {
 	case DRM_MODE_SCALE_CENTER:
 		asyh->view.oW = min((u16)umode->hdisplay, asyh->view.oW);
-		asyh->view.oH = min((u16)umode->vdisplay, asyh->view.oH);
+		asyh->view.oH = min((u16)umode_vdisplay, asyh->view.oH);
 		/* fall-through */
 	case DRM_MODE_SCALE_ASPECT:
 		if (asyh->view.oH < asyh->view.oW) {
@@ -2037,7 +2044,7 @@ nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
 	struct nv50_head_mode *m = &asyh->mode;
 	u32 hbackp, vbackp, hfrontp, vfrontp;
 
-	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V | CRTC_STEREO_DOUBLE);
 
 	hbackp = mode->crtc_htotal - mode->crtc_hsync_end;
 	vbackp = mode->crtc_vtotal - mode->crtc_vsync_end;
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (8 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
@ 2017-03-27 21:58       ` Alastair Bridgewater
  2017-03-29 12:02       ` [PATCH v2 00/10] Enable HDMI Stereoscopy Ville Syrjälä
  10 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-27 21:58 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Enable stereoscopic output for HDMI and DisplayPort connectors on
NV50+ (G80+) hardware.  We do not enable stereoscopy on older
hardware in case there is some older board that still has HDMI
output but for which we have no logic for setting the Vendor
InfoFrame.

With this, I get an obvious 3D output when using the "testdisplay"
program from intel-gpu-tools with the "-3" parameter and outputting
to a 3D-capable HDMI display, for all available 3D modes (be they
TB, SBSH, or FP) on all four G80+ DISPs.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 4e3563e..a2ee93a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1322,6 +1322,13 @@ nouveau_connector_create(struct drm_device *dev, int index)
 		break;
 	}
 
+	/* HDMI 3D support */
+	if ((disp->disp.oclass >= NV50_DISP)
+	    && ((type == DRM_MODE_CONNECTOR_DisplayPort)
+		|| (type == DRM_MODE_CONNECTOR_eDP)
+		|| (type == DRM_MODE_CONNECTOR_HDMIA)))
+		connector->stereo_allowed = true;
+
 	/* defaults, will get overridden in detect() */
 	connector->interlace_allowed = false;
 	connector->doublescan_allowed = false;
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects
       [not found]         ` <20170327215807.8461-10-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-03-28  1:54           ` kbuild test robot
  0 siblings, 0 replies; 48+ messages in thread
From: kbuild test robot @ 2017-03-28  1:54 UTC (permalink / raw)
  To: Alastair Bridgewater
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, kbuild-all-JC7UmRfGjtg,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]

Hi Alastair,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.11-rc4 next-20170327]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alastair-Bridgewater/Enable-HDMI-Stereoscopy/20170328-090906
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-s0-201713 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/nouveau/nv50_display.c: In function 'nv50_head_atomic_check_view':
>> drivers/gpu/drm/nouveau/nv50_display.c:1995:2: error: implicit declaration of function 'drm_crtc_get_hv_timing' [-Werror=implicit-function-declaration]
     drm_crtc_get_hv_timing(omode, &omode_hdisplay, &omode_vdisplay);
     ^~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/drm_crtc_get_hv_timing +1995 drivers/gpu/drm/nouveau/nv50_display.c

  1989		umode_vdisplay = umode->vdisplay;
  1990		if ((umode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
  1991			umode_vdisplay += umode->vtotal;
  1992		asyh->view.iW = umode->hdisplay;
  1993		asyh->view.iH = umode_vdisplay;
  1994		/* For the ouput mode, we can just use the stock helper. */
> 1995		drm_crtc_get_hv_timing(omode, &omode_hdisplay, &omode_vdisplay);
  1996		asyh->view.oW = omode_hdisplay;
  1997		asyh->view.oH = omode_vdisplay;
  1998	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31292 bytes --]

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/10] Enable HDMI Stereoscopy
       [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (9 preceding siblings ...)
  2017-03-27 21:58       ` [PATCH v2 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
@ 2017-03-29 12:02       ` Ville Syrjälä
       [not found]         ` <20170329120247.GX30290-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  10 siblings, 1 reply; 48+ messages in thread
From: Ville Syrjälä @ 2017-03-29 12:02 UTC (permalink / raw)
  To: Alastair Bridgewater
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Mon, Mar 27, 2017 at 05:57:57PM -0400, Alastair Bridgewater wrote:
> HDMI 3D mode support, round two.  Revisions include no longer dealing
> with audio InfoFrames, passing infoframe data to NVKM as bags of bytes
> rather than as data pre-packed for the hardware, more-normal return
> value checking for drm_hdmi_*_infoframe_from_display_mode() results,
> Frame-Packing mode support, more-principled logic for enabling stereo
> mode support on a connector, and support for all four nv50+ DISPs.
> Additionally, this patch set is being sent to the dri-devel list as
> well as the nouveau list.  Dropped in this version is the removal of
> the "mandatory" 3D mode logic.  After discussion, I'm still convinced
> that it's wrong, but now I'm convinced that it's too conservative
> rather than my original belief which was that it was too liberal.
> 
> Thanks to Ilia Mirkin, Damien Lespiau, and Ben Skeggs for feedback on
> the original patch set.  If I have neglected to mention anyone, mea
> culpa.
> 
> The first patch perhaps isn't technically necessary, but simplifies
> the later logic for fixing frame-packing mode timing.  There may be
> some effect from applying this, as drm_mode_set_crtcinfo() does
> something with vscan which can affect the given CRTC timing.  I'm
> not sure what's going on there, if there's any behavioral change or
> not, and if there is what to do about it (other than using
> drm_mode_set_crtcinfo() twice, once with CRTC_NO_VSCAN and once
> without).
> 
> The second through eighth patches are all the InfoFrame logic again,
> this time with support for all four DISP types.  This does not appear
> to cause regressions in HDMI audio on GT215, GF119, or GK104.  I hope
> that it doesn't cause a regression on G84, but haven't yet managed to
> set up a test case for G84 and HDMI audio.
> 
> The ninth patch is to fix up frame-packing mode timings and geometry.
> As the patch comment says, there are clearly-correct parts, and there
> are possibly-hacky parts.  But it gets frame-packing modes working,
> and we can revise from there if necessary.
> 
> And the tenth patch enables stereo mode support...  on HDMI and DPort
> connectors on nv50+ hardware.  HDMI connectors because obvious.  DPort
> connectors because of DPort to HDMI adaptors.

Do you mean DP++ or actual protocol converters? DP++ is just HDMI with
a some electrical tweaks, but IIRC proper DP defines 3D stereo quite
differently than HDMI. I'm not sure if we should be able to push HDMI
style 3D through DP->HDMI/DP++ adaptors. The specs are unfortunately
very vague when it comes to such devices.

> eDP connectors because
> it shouldn't do any harm, and someone might have been maniac enough to
> set up an eDP port to point to something with an HDMI 3D setup.  And
> nv50+ hardware only because while I'm not aware of any pre-nv50 cards
> that have HDMI outputs, there could be a setup out there like the PS3
> that uses an external HDMI encoder on pre-nv50 hardware, at which
> point none of the mode timing or InfoFrame support is in place for it.
> 
> Alastair Bridgewater (10):
>   drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan /
>     ilace
>   drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
>   drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to
>     NVKM
>   drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware
>     format
>   drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware
>   drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
>   drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware
>   drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
>   drm/nouveau: Handle frame-packing mode geometry and timing effects
>   drm/nouveau: Enable stereoscopic 3D output over HDMI
> 
>  drivers/gpu/drm/nouveau/include/nvif/cl5070.h      |  4 +-
>  drivers/gpu/drm/nouveau/nouveau_connector.c        | 10 +++
>  drivers/gpu/drm/nouveau/nv50_display.c             | 80 ++++++++++++++++------
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild    |  1 +
>  .../drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c  | 66 ++++++++++++++++++
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 46 +++++++++++--
>  .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 49 +++++++++++--
>  .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 45 ++++++++++--
>  .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 46 +++++++++++--
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h    | 11 +++
>  10 files changed, 307 insertions(+), 51 deletions(-)
>  create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c
> 
> -- 
> 2.10.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/10] Enable HDMI Stereoscopy
       [not found]         ` <20170329120247.GX30290-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-03-29 14:24           ` Alastair Bridgewater
       [not found]             ` <CAEcYz2Qb74b27efw=s+ZSSO4SEQQ2_mVKXz4D3za1GkVh_AHgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-03-29 14:24 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 1527 bytes --]

On Wed, Mar 29, 2017 at 8:02 AM, Ville Syrjälä <
ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
>
> On Mon, Mar 27, 2017 at 05:57:57PM -0400, Alastair Bridgewater wrote:
> > And the tenth patch enables stereo mode support...  on HDMI and DPort
> > connectors on nv50+ hardware.  HDMI connectors because obvious.  DPort
> > connectors because of DPort to HDMI adaptors.
>
> Do you mean DP++ or actual protocol converters? DP++ is just HDMI with
> a some electrical tweaks, but IIRC proper DP defines 3D stereo quite
> differently than HDMI. I'm not sure if we should be able to push HDMI
> style 3D through DP->HDMI/DP++ adaptors. The specs are unfortunately
> very vague when it comes to such devices.

DP++. Good point about the protocol converters, though I don't recall
seeing any way to distinguish between a DP and a DP++ connector in
nouveau, nor do I know if nVidia actually made any boards with DP that
isn't DP++. I guess I have some digging to do in that direction. Thank
you.

> > eDP connectors because
> > it shouldn't do any harm, and someone might have been maniac enough to
> > set up an eDP port to point to something with an HDMI 3D setup.  And
> > nv50+ hardware only because while I'm not aware of any pre-nv50 cards
> > that have HDMI outputs, there could be a setup out there like the PS3
> > that uses an external HDMI encoder on pre-nv50 hardware, at which
> > point none of the mode timing or InfoFrame support is in place for it.

-- Alastair Bridgewater

[-- Attachment #1.2: Type: text/html, Size: 1798 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/10] Enable HDMI Stereoscopy
       [not found]             ` <CAEcYz2Qb74b27efw=s+ZSSO4SEQQ2_mVKXz4D3za1GkVh_AHgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-03-29 14:42               ` Ville Syrjälä
  2017-03-29 14:48               ` Ilia Mirkin
  1 sibling, 0 replies; 48+ messages in thread
From: Ville Syrjälä @ 2017-03-29 14:42 UTC (permalink / raw)
  To: Alastair Bridgewater
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Wed, Mar 29, 2017 at 10:24:05AM -0400, Alastair Bridgewater wrote:
> On Wed, Mar 29, 2017 at 8:02 AM, Ville Syrjälä <
> ville.syrjala@linux.intel.com> wrote:
> >
> > On Mon, Mar 27, 2017 at 05:57:57PM -0400, Alastair Bridgewater wrote:
> > > And the tenth patch enables stereo mode support...  on HDMI and DPort
> > > connectors on nv50+ hardware.  HDMI connectors because obvious.  DPort
> > > connectors because of DPort to HDMI adaptors.
> >
> > Do you mean DP++ or actual protocol converters? DP++ is just HDMI with
> > a some electrical tweaks, but IIRC proper DP defines 3D stereo quite
> > differently than HDMI. I'm not sure if we should be able to push HDMI
> > style 3D through DP->HDMI/DP++ adaptors. The specs are unfortunately
> > very vague when it comes to such devices.
> 
> DP++. Good point about the protocol converters, though I don't recall
> seeing any way to distinguish between a DP and a DP++ connector in
> nouveau, nor do I know if nVidia actually made any boards with DP that
> isn't DP++. I guess I have some digging to do in that direction. Thank
> you.

In i915 we register both a HDMI and a DP connector for the same
physical DP connector, and a sink attached via a DP++ dongle/cable will
appear on the HDMI connector instead of the DP connector. But I don't
know if nouveau follows this same pattern or not.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 00/10] Enable HDMI Stereoscopy
       [not found]             ` <CAEcYz2Qb74b27efw=s+ZSSO4SEQQ2_mVKXz4D3za1GkVh_AHgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-03-29 14:42               ` Ville Syrjälä
@ 2017-03-29 14:48               ` Ilia Mirkin
  1 sibling, 0 replies; 48+ messages in thread
From: Ilia Mirkin @ 2017-03-29 14:48 UTC (permalink / raw)
  To: Alastair Bridgewater
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Ville Syrjälä

On Wed, Mar 29, 2017 at 10:24 AM, Alastair Bridgewater
<alastair.bridgewater@gmail.com> wrote:
> On Wed, Mar 29, 2017 at 8:02 AM, Ville Syrjälä
> <ville.syrjala@linux.intel.com> wrote:
>>
>> On Mon, Mar 27, 2017 at 05:57:57PM -0400, Alastair Bridgewater wrote:
>> > And the tenth patch enables stereo mode support...  on HDMI and DPort
>> > connectors on nv50+ hardware.  HDMI connectors because obvious.  DPort
>> > connectors because of DPort to HDMI adaptors.
>>
>> Do you mean DP++ or actual protocol converters? DP++ is just HDMI with
>> a some electrical tweaks, but IIRC proper DP defines 3D stereo quite
>> differently than HDMI. I'm not sure if we should be able to push HDMI
>> style 3D through DP->HDMI/DP++ adaptors. The specs are unfortunately
>> very vague when it comes to such devices.
>
> DP++. Good point about the protocol converters, though I don't recall
> seeing any way to distinguish between a DP and a DP++ connector in
> nouveau, nor do I know if nVidia actually made any boards with DP that
> isn't DP++. I guess I have some digging to do in that direction. Thank
> you.

I wouldn't be surprised if the externally-encodered G200 DP connectors
didn't support DP++. I do think that the vast majority of DP ports are
actually DP++ (on NVIDIA, and probably everywhere). However since this
is (edge case)^2 [G200 DP, 3D DP], I wouldn't spend too much time
worrying about it. I doubt it's documented anywhere, and equally
doubtful any such sinks exist. Should be able to find a VBIOS with the
external DP encoders though, and you can check the DCB specs that
NVIDIA published at
ftp://download.nvidia.com/open-gpu-doc/DCB/2/DCB-4.x-Specification.html.
(Looks like there is something there under "DFP Specific Information"
-> HDMI, not 100% sure where in nouveau it's decoded though.)
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v3 00/10] drm/nouveau Enable HDMI Stereoscopy
       [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (6 preceding siblings ...)
  2017-03-27 21:57   ` [PATCH v2 00/10] Enable HDMI Stereoscopy Alastair Bridgewater
@ 2017-04-11 17:11   ` Alastair Bridgewater
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  7 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

HDMI 3D mode support, round three.  Rebased to drm-next as it was on
Sunday morning.  Overall structure is the same as v2.

Substantially rewrote the first patch (nv50_head_atomic_check_mode())
since a recent change to the calculation of m->v.blankus caused a
merge conflict and problems with frame-packed and interlaced 3D modes,
and I found a much saner model for how the timing parameters work
while I was sorting that out.  Observable behavior changes from this
patch should be limited to better values for m->v.blankus on
interlaced non-doublescan modes and non-interlaced doublescan modes,
and some sort of effect on any mode with mode->vscan set (I don't know
if this case actually happens, but if it did then I would expect it to
have had some sort of problem in the previous implementation anyway).
Of the entire series, this first patch is more cleanup-and-bugfix than
anything else, and may be a candidate for merging early even if the
rest of the series is deferred until the next merge window.

Typo-busted the ninth patch (frame-packing geometry and timing) and
adjusted for the rename of drm_crtc_get_hv_timing() to
drm_mode_get_hv_timing().

Possibly some minor whitespace changes in one or two patches, plus
reformatted some of the patch comments.

Tested on my gt215 hardware only at this time, since I'm away from the
rest of my test hardware for about another week.  That said, all of
the changes are in the generic nv50 code, rather than being specific
to some chipset or family.

Thanks to Roy Spliet for assistance (mostly background information) in
working out what was going on with m->v.blankus.

Alastair Bridgewater (10):
  drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus
    calculation
  drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
  drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to
    NVKM
  drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware
    format
  drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware
  drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
  drm/nouveau: Handle frame-packing mode geometry and timing effects
  drm/nouveau: Enable stereoscopic 3D output over HDMI

 drivers/gpu/drm/nouveau/include/nvif/cl5070.h      |  4 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c        | 10 +++
 drivers/gpu/drm/nouveau/nv50_display.c             | 93 +++++++++++++++-------
 drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild    |  1 +
 .../drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c  | 66 +++++++++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 46 +++++++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 49 ++++++++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 45 +++++++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 46 +++++++++--
 drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h    | 11 +++
 10 files changed, 314 insertions(+), 57 deletions(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c

-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v3 01/10] drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus calculation
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
                         ` (8 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

drm_mode_set_crtcinfo() does compensation for interlace and
doublescan timing effects already, so do it first and use the
compensated figures instead of the constant "vscan / ilace" terms
that we had before.

And then it turns out that the hardware model for how the timing
parameters are configured is basically the standard model, but
starting one clock before the sync pulse rather than at the start
of the display area, which lets us drastically simplify the
overall timing calculations (verifying the changes by algebraic
operations is left as an exercise for the reader).

Finally, there were a couple of issues with the computation of
m->v.blankus that are addressed here.  Interlaced modes would
generate a negative intermediate result.  Double scan modes would
generate an overestimate rather than an underestimate.  And when
enabling frame-packing modes, a rather extreme overestimate would
be generated.  Fixed, by using the timings as adjusted for the
CRTC to find the length of the vertical blanking period instead of
mixing adjusted and pre-adjustment timing parameters.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 44 ++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index c9910c8..c901f32 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2035,34 +2035,37 @@ static void
 nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
 	struct drm_display_mode *mode = &asyh->state.adjusted_mode;
-	u32 ilace   = (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 2 : 1;
-	u32 vscan   = (mode->flags & DRM_MODE_FLAG_DBLSCAN) ? 2 : 1;
-	u32 hbackp  =  mode->htotal - mode->hsync_end;
-	u32 vbackp  = (mode->vtotal - mode->vsync_end) * vscan / ilace;
-	u32 hfrontp =  mode->hsync_start - mode->hdisplay;
-	u32 vfrontp = (mode->vsync_start - mode->vdisplay) * vscan / ilace;
-	u32 blankus;
 	struct nv50_head_mode *m = &asyh->mode;
+	u32 blankus;
 
-	m->h.active = mode->htotal;
-	m->h.synce  = mode->hsync_end - mode->hsync_start - 1;
-	m->h.blanke = m->h.synce + hbackp;
-	m->h.blanks = mode->htotal - hfrontp - 1;
+	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 
-	m->v.active = mode->vtotal * vscan / ilace;
-	m->v.synce  = ((mode->vsync_end - mode->vsync_start) * vscan / ilace) - 1;
-	m->v.blanke = m->v.synce + vbackp;
-	m->v.blanks = m->v.active - vfrontp - 1;
+	/*
+	 * DRM modes are defined in terms of a repeating interval
+	 * starting with the active display area.  The hardware modes
+	 * are defined in terms of a repeating interval starting one
+	 * unit (pixel or line) into the sync pulse.  So, add bias.
+	 */
+
+	m->h.active = mode->crtc_htotal;
+	m->h.synce  = mode->crtc_hsync_end - mode->crtc_hsync_start - 1;
+	m->h.blanke = mode->crtc_hblank_end - mode->crtc_hsync_start - 1;
+	m->h.blanks = m->h.blanke + mode->crtc_hdisplay;
+
+	m->v.active = mode->crtc_vtotal;
+	m->v.synce  = mode->crtc_vsync_end - mode->crtc_vsync_start - 1;
+	m->v.blanke = mode->crtc_vblank_end - mode->crtc_vsync_start - 1;
+	m->v.blanks = m->v.blanke + mode->crtc_vdisplay;
 
 	/*XXX: Safe underestimate, even "0" works */
-	blankus = (m->v.active - mode->vdisplay - 2) * m->h.active;
+	blankus = (m->v.active - mode->crtc_vdisplay - 2) * m->h.active;
 	blankus *= 1000;
-	blankus /= mode->clock;
+	blankus /= mode->crtc_clock;
 	m->v.blankus = blankus;
 
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
-		m->v.blank2e =  m->v.active + m->v.synce + vbackp;
-		m->v.blank2s =  m->v.blank2e + (mode->vdisplay * vscan / ilace);
+		m->v.blank2e =  m->v.active + m->v.blanke;
+		m->v.blank2s =  m->v.blank2e + mode->crtc_vdisplay;
 		m->v.active  = (m->v.active * 2) + 1;
 		m->interlace = true;
 	} else {
@@ -2070,9 +2073,8 @@ nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
 		m->v.blank2s = 1;
 		m->interlace = false;
 	}
-	m->clock = mode->clock;
+	m->clock = mode->crtc_clock;
 
-	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 	asyh->set.mode = true;
 }
 
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-04-11 17:11       ` [PATCH v3 01/10] drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus calculation Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
                         ` (7 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The nouveau driver, in the Linux 3.7 days, used to try and set the
AVI InfoFrame based on the selected display mode.  These days, it
uses a fixed set of InfoFrames.  Start to correct that, by
providing a mechanism whereby InfoFrame data may be passed to the
NVKM functions that do the actual configuration.

At this point, only establish the new parameters and their parsing,
don't actually use the data anywhere yet (since it's not supplied
anywhere).

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/include/nvif/cl5070.h        | 4 +++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c   | 9 ++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c | 9 ++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c | 9 ++++++++-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c | 9 ++++++++-
 5 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
index ae49dfd..9d46eba 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h
@@ -76,7 +76,9 @@ struct nv50_disp_sor_hdmi_pwr_v0 {
 	__u8  state;
 	__u8  max_ac_packet;
 	__u8  rekey;
-	__u8  pad04[4];
+	__u8  avi_infoframe_length;
+	__u8  vendor_infoframe_length;
+	__u8  pad06[2];
 };
 
 struct nv50_disp_sor_lvds_script_v0 {
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
index 1c4256e..77e5f5a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
@@ -40,7 +40,7 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -54,6 +54,13 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x6165a4 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
index 632f02d..66ee883 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
@@ -40,7 +40,7 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -53,6 +53,13 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
index 4e8067d..3c8c26a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
@@ -41,7 +41,7 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -54,6 +54,13 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
index f1afc16..8ed00db 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
@@ -41,7 +41,7 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	int ret = -ENOSYS;
 
 	nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
+	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
 		nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
 				   "max_ac_packet %d rekey %d\n",
 			   args->v0.version, args->v0.state,
@@ -55,6 +55,13 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	} else
 		return ret;
 
+	if ((args->v0.avi_infoframe_length
+	     + args->v0.vendor_infoframe_length) > size)
+		return -ENOSYS;
+	else if ((args->v0.avi_infoframe_length
+		    + args->v0.vendor_infoframe_length) < size)
+		return -E2BIG;
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
 		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-04-11 17:11       ` [PATCH v3 01/10] drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus calculation Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
                         ` (6 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have mechanism by which to pass mode-dependent HDMI
InfoFrames to the low-level hardware driver, it is incumbent upon
us to do so.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index c901f32..93149ca 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -23,6 +23,7 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/hdmi.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -31,6 +32,7 @@
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_edid.h>
 
 #include <nvif/class.h>
 #include <nvif/cl0002.h>
@@ -2717,6 +2719,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	struct {
 		struct nv50_disp_mthd_v1 base;
 		struct nv50_disp_sor_hdmi_pwr_v0 pwr;
+		u8 infoframes[2 * 17]; /* two frames, up to 17 bytes each */
 	} args = {
 		.base.version = 1,
 		.base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR,
@@ -2728,17 +2731,42 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	};
 	struct nouveau_connector *nv_connector;
 	u32 max_ac_packet;
+	union hdmi_infoframe avi_frame;
+	union hdmi_infoframe vendor_frame;
+	int ret;
+	int size;
 
 	nv_connector = nouveau_encoder_connector_get(nv_encoder);
 	if (!drm_detect_hdmi_monitor(nv_connector->edid))
 		return;
 
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode);
+	if (!ret) {
+		/* We have an AVI InfoFrame, populate it to the display */
+		args.pwr.avi_infoframe_length
+			= hdmi_infoframe_pack(&avi_frame, args.infoframes, 17);
+	}
+
+	ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode);
+	if (!ret) {
+		/* We have a Vendor InfoFrame, populate it to the display */
+		args.pwr.vendor_infoframe_length
+			= hdmi_infoframe_pack(&vendor_frame,
+					      args.infoframes
+					      + args.pwr.avi_infoframe_length,
+					      17);
+	}
+
 	max_ac_packet  = mode->htotal - mode->hdisplay;
 	max_ac_packet -= args.pwr.rekey;
 	max_ac_packet -= 18; /* constant from tegra */
 	args.pwr.max_ac_packet = max_ac_packet / 32;
 
-	nvif_mthd(disp->disp, 0, &args, sizeof(args));
+	size = sizeof(args.base)
+		+ sizeof(args.pwr)
+		+ args.pwr.avi_infoframe_length
+		+ args.pwr.vendor_infoframe_length;
+	nvif_mthd(disp->disp, 0, &args, size);
 	nv50_audio_enable(encoder, mode);
 }
 
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (2 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
                         ` (5 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

HDMI InfoFrames are passed to NVKM as bags of bytes, but the
hardware needs them to be packed into words.  Rather than having
four (or more) copies of the packing logic introduce a single copy
now, in a central place.

We currently need these for AVI and Vendor InfoFrames, but we may
also expect to need them for Audio InfoFrames at some point.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild    |  1 +
 .../drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c  | 66 ++++++++++++++++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h    | 11 ++++
 3 files changed, 78 insertions(+)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
index fa05d16..65ae870 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
@@ -29,6 +29,7 @@ nvkm-y += nvkm/engine/disp/conn.o
 nvkm-y += nvkm/engine/disp/hdagt215.o
 nvkm-y += nvkm/engine/disp/hdagf119.o
 
+nvkm-y += nvkm/engine/disp/hdmi_infoframe.o
 nvkm-y += nvkm/engine/disp/hdmig84.o
 nvkm-y += nvkm/engine/disp/hdmigt215.o
 nvkm-y += nvkm/engine/disp/hdmigf119.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c
new file mode 100644
index 0000000..e04f2e8
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c
@@ -0,0 +1,66 @@
+#include "nv50.h"
+
+void pack_hdmi_infoframe(struct packed_hdmi_infoframe *packed_frame,
+			 u8 *raw_frame, ssize_t len)
+{
+	u32 header = 0;
+	u32 subpack0_low = 0;
+	u32 subpack0_high = 0;
+	u32 subpack1_low = 0;
+	u32 subpack1_high = 0;
+
+	switch (len) {
+		/*
+		 * "When in doubt, use brute force."
+		 *     -- Ken Thompson.
+		 */
+	default:
+		/*
+		 * We presume that no valid frame is longer than 17
+		 * octets, including header...  And truncate to that
+		 * if it's longer.
+		 */
+	case 17:
+		subpack1_high = (raw_frame[16] << 16);
+	case 16:
+		subpack1_high |= (raw_frame[15] << 8);
+	case 15:
+		subpack1_high |= raw_frame[14];
+	case 14:
+		subpack1_low = (raw_frame[13] << 24);
+	case 13:
+		subpack1_low |= (raw_frame[12] << 16);
+	case 12:
+		subpack1_low |= (raw_frame[11] << 8);
+	case 11:
+		subpack1_low |= raw_frame[10];
+	case 10:
+		subpack0_high = (raw_frame[9] << 16);
+	case 9:
+		subpack0_high |= (raw_frame[8] << 8);
+	case 8:
+		subpack0_high |= raw_frame[7];
+	case 7:
+		subpack0_low = (raw_frame[6] << 24);
+	case 6:
+		subpack0_low |= (raw_frame[5] << 16);
+	case 5:
+		subpack0_low |= (raw_frame[4] << 8);
+	case 4:
+		subpack0_low |= raw_frame[3];
+	case 3:
+		header = (raw_frame[2] << 16);
+	case 2:
+		header |= (raw_frame[1] << 8);
+	case 1:
+		header |= raw_frame[0];
+	case 0:
+		break;
+	}
+
+	packed_frame->header = header;
+	packed_frame->subpack0_low = subpack0_low;
+	packed_frame->subpack0_high = subpack0_high;
+	packed_frame->subpack1_low = subpack1_low;
+	packed_frame->subpack1_high = subpack1_high;
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
index 1e1de6b..37ec2a1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
@@ -40,6 +40,17 @@ int nv50_dac_sense(NV50_DISP_MTHD_V1);
 int gt215_hda_eld(NV50_DISP_MTHD_V1);
 int gf119_hda_eld(NV50_DISP_MTHD_V1);
 
+struct packed_hdmi_infoframe {
+	u32 header;
+	u32 subpack0_low;
+	u32 subpack0_high;
+	u32 subpack1_low;
+	u32 subpack1_high;
+};
+
+void pack_hdmi_infoframe(struct packed_hdmi_infoframe *packed_frame,
+			 u8 *raw_frame, ssize_t len);
+
 int g84_hdmi_ctrl(NV50_DISP_MTHD_V1);
 int gt215_hdmi_ctrl(NV50_DISP_MTHD_V1);
 int gf119_hdmi_ctrl(NV50_DISP_MTHD_V1);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (3 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
                         ` (4 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any AVI or Vendor InfoFrame that is not provided,
and disable the Vendor InfoFrame when disabling the output.

Ignore the Audio InfoFrame: We don't supply it, and altering HDMI
audio semantics (for better or worse) on this hardware is out of
scope for me at this time.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
index 77e5f5a..139344e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c
@@ -36,6 +36,8 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -61,8 +63,17 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x6165a4 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x61653c + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x616500 + hoff, 0x00000001, 0x00000000);
 		return 0;
@@ -70,12 +81,14 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x616528 + hoff, 0x000d0282);
-	nvkm_wr32(device, 0x61652c + hoff, 0x0000006f);
-	nvkm_wr32(device, 0x616530 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x616534 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x616538 + hoff, 0x00000000);
-	nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x616528 + hoff, avi_infoframe.header);
+		nvkm_wr32(device, 0x61652c + hoff, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x616530 + hoff, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x616534 + hoff, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x616538 + hoff, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x616520 + hoff, 0x00000001, 0x00000001);
+	}
 
 	/* Audio InfoFrame */
 	nvkm_mask(device, 0x616500 + hoff, 0x00000001, 0x00000000);
@@ -84,6 +97,18 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	nvkm_wr32(device, 0x616510 + hoff, 0x00000000);
 	nvkm_mask(device, 0x616500 + hoff, 0x00000001, 0x00000001);
 
+	/* Vendor InfoFrame */
+	nvkm_mask(device, 0x61653c + hoff, 0x00010001, 0x00010000);
+	if (args->v0.vendor_infoframe_length) {
+		nvkm_wr32(device, 0x616544 + hoff, vendor_infoframe.header);
+		nvkm_wr32(device, 0x616548 + hoff, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x61654c + hoff, vendor_infoframe.subpack0_high);
+		/* Is there a second (or up to fourth?) set of subpack registers here? */
+		/* nvkm_wr32(device, 0x616550 + hoff, vendor_infoframe->subpack1_low); */
+		/* nvkm_wr32(device, 0x616554 + hoff, vendor_infoframe->subpack1_high); */
+		nvkm_mask(device, 0x61653c + hoff, 0x00010001, 0x00010001);
+	}
+
 	nvkm_mask(device, 0x6165d0 + hoff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
 	nvkm_mask(device, 0x616568 + hoff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
 	nvkm_mask(device, 0x616578 + hoff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (4 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
                         ` (3 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic") InfoFrame.

Also don't enable any AVI or Vendor InfoFrame that is not provided,
and disable the Vendor InfoFrame when disabling the output.

Ignore the Audio InfoFrame: We don't supply it, and altering HDMI
audio semantics (for better or worse) on this hardware is out of
scope for me at this time.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
index 8ed00db..257f7c7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c
@@ -37,6 +37,8 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -62,8 +64,17 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x61c5a4 + soff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x61c53c + soff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000000);
 		return 0;
@@ -71,12 +82,14 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x61c528 + soff, 0x000d0282);
-	nvkm_wr32(device, 0x61c52c + soff, 0x0000006f);
-	nvkm_wr32(device, 0x61c530 + soff, 0x00000000);
-	nvkm_wr32(device, 0x61c534 + soff, 0x00000000);
-	nvkm_wr32(device, 0x61c538 + soff, 0x00000000);
-	nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x61c528 + soff, avi_infoframe.header);
+		nvkm_wr32(device, 0x61c52c + soff, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x61c530 + soff, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x61c534 + soff, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x61c538 + soff, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x61c520 + soff, 0x00000001, 0x00000001);
+	}
 
 	/* Audio InfoFrame */
 	nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000000);
@@ -85,6 +98,18 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	nvkm_wr32(device, 0x61c510 + soff, 0x00000000);
 	nvkm_mask(device, 0x61c500 + soff, 0x00000001, 0x00000001);
 
+	/* Vendor InfoFrame */
+	nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010000);
+	if (args->v0.vendor_infoframe_length) {
+		nvkm_wr32(device, 0x61c544 + soff, vendor_infoframe.header);
+		nvkm_wr32(device, 0x61c548 + soff, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x61c54c + soff, vendor_infoframe.subpack0_high);
+		/* Is there a second (or up to fourth?) set of subpack registers here? */
+		/* nvkm_wr32(device, 0x61c550 + soff, vendor_infoframe.subpack1_low); */
+		/* nvkm_wr32(device, 0x61c554 + soff, vendor_infoframe.subpack1_high); */
+		nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010001);
+	}
+
 	nvkm_mask(device, 0x61c5d0 + soff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
 	nvkm_mask(device, 0x61c568 + soff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
 	nvkm_mask(device, 0x61c578 + soff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (5 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
                         ` (2 subsequent siblings)
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any InfoFrame that is not provided, and disable
the Vendor InfoFrame when disabling the output.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 40 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
index 66ee883..d80e86c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c
@@ -36,6 +36,8 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -60,8 +62,17 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x616730 + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000000);
 		return 0;
@@ -69,12 +80,29 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x61671c + hoff, 0x000d0282);
-	nvkm_wr32(device, 0x616720 + hoff, 0x0000006f);
-	nvkm_wr32(device, 0x616724 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x616728 + hoff, 0x00000000);
-	nvkm_wr32(device, 0x61672c + hoff, 0x00000000);
-	nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x61671c + hoff, avi_infoframe.header);
+		nvkm_wr32(device, 0x616720 + hoff, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x616724 + hoff, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x616728 + hoff, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x61672c + hoff, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000001);
+	}
+
+	/* GENERIC(?) / Vendor InfoFrame? */
+	nvkm_mask(device, 0x616730 + hoff, 0x00010001, 0x00010000);
+	if (args->v0.vendor_infoframe_length) {
+		/*
+		 * These appear to be the audio infoframe registers,
+		 * but no other set of infoframe registers has yet
+		 * been found.
+		 */
+		nvkm_wr32(device, 0x616738 + hoff, vendor_infoframe.header);
+		nvkm_wr32(device, 0x61673c + hoff, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x616740 + hoff, vendor_infoframe.subpack0_high);
+		/* Is there a second (or further?) set of subpack registers here? */
+		nvkm_mask(device, 0x616730 + hoff, 0x00000001, 0x00000001);
+	}
 
 	/* ??? InfoFrame? */
 	nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (6 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Now that we have the InfoFrame data being provided, for the most
part, program the hardware to use it.

While we're here, and since the functionality will come in handy
for supporting 3D stereoscopy, implement setting the Vendor
("generic"?) InfoFrame.

Also don't enable any InfoFrame that is not provided, and disable
the Vendor InfoFrame when disabling the output.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 36 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
index 3c8c26a..99d2731 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c
@@ -37,6 +37,8 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 	union {
 		struct nv50_disp_sor_hdmi_pwr_v0 v0;
 	} *args = data;
+	struct packed_hdmi_infoframe avi_infoframe;
+	struct packed_hdmi_infoframe vendor_infoframe;
 	u32 ctrl;
 	int ret = -ENOSYS;
 
@@ -61,8 +63,17 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 		    + args->v0.vendor_infoframe_length) < size)
 		return -E2BIG;
 
+	pack_hdmi_infoframe(&avi_infoframe,
+			    data,
+			    args->v0.avi_infoframe_length);
+
+	pack_hdmi_infoframe(&vendor_infoframe,
+			    data + args->v0.avi_infoframe_length,
+			    args->v0.vendor_infoframe_length);
+
 	if (!(ctrl & 0x40000000)) {
 		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
+		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
 		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
 		return 0;
@@ -70,12 +81,25 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1)
 
 	/* AVI InfoFrame */
 	nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
-	nvkm_wr32(device, 0x690008 + hdmi, 0x000d0282);
-	nvkm_wr32(device, 0x69000c + hdmi, 0x0000006f);
-	nvkm_wr32(device, 0x690010 + hdmi, 0x00000000);
-	nvkm_wr32(device, 0x690014 + hdmi, 0x00000000);
-	nvkm_wr32(device, 0x690018 + hdmi, 0x00000000);
-	nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000001);
+	if (args->v0.avi_infoframe_length) {
+		nvkm_wr32(device, 0x690008 + hdmi, avi_infoframe.header);
+		nvkm_wr32(device, 0x69000c + hdmi, avi_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x690010 + hdmi, avi_infoframe.subpack0_high);
+		nvkm_wr32(device, 0x690014 + hdmi, avi_infoframe.subpack1_low);
+		nvkm_wr32(device, 0x690018 + hdmi, avi_infoframe.subpack1_high);
+		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000001);
+	}
+
+	/* GENERIC(?) / Vendor InfoFrame? */
+	nvkm_mask(device, 0x690100 + hdmi, 0x00010001, 0x00000000);
+	if (args->v0.vendor_infoframe_length) {
+		nvkm_wr32(device, 0x690108 + hdmi, vendor_infoframe.header);
+		nvkm_wr32(device, 0x69010c + hdmi, vendor_infoframe.subpack0_low);
+		nvkm_wr32(device, 0x690110 + hdmi, vendor_infoframe.subpack0_high);
+		/* Is there a second (or further?) set of subpack registers here? */
+		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000001);
+	}
+
 
 	/* ??? InfoFrame? */
 	nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (7 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:11       ` [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
  9 siblings, 0 replies; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Frame-packing modes add an extra vtotal raster lines to each frame
above and beyond what the basic mode description calls for.
Account for this during scaler configuration (possibly a bit of a
hack), during CRTC configuration (clearly not a hack), and when
checking that a mode is valid for a given connector (cribbed from
the i915 driver).

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c |  3 +++
 drivers/gpu/drm/nouveau/nv50_display.c      | 21 ++++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index f802bcd..9a91e79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1045,6 +1045,9 @@ nouveau_connector_mode_valid(struct drm_connector *connector,
 		return MODE_BAD;
 	}
 
+	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+		clock *= 2;
+
 	if (clock < min_clock)
 		return MODE_CLOCK_LOW;
 
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 93149ca..c98ed9a 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1966,6 +1966,7 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	struct drm_display_mode *umode = &asyh->state.mode;
 	int mode = asyc->scaler.mode;
 	struct edid *edid;
+	int umode_vdisplay, omode_hdisplay, omode_vdisplay;
 
 	if (connector->edid_blob_ptr)
 		edid = (struct edid *)connector->edid_blob_ptr->data;
@@ -1980,12 +1981,18 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 		mode = DRM_MODE_SCALE_FULLSCREEN;
 	}
 
+	/* For the user-specified mode, we must ignore doublescan and
+	 * the like, but honor frame packing.
+	 */
+	umode_vdisplay = umode->vdisplay;
+	if ((umode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+		umode_vdisplay += umode->vtotal;
 	asyh->view.iW = umode->hdisplay;
-	asyh->view.iH = umode->vdisplay;
-	asyh->view.oW = omode->hdisplay;
-	asyh->view.oH = omode->vdisplay;
-	if (omode->flags & DRM_MODE_FLAG_DBLSCAN)
-		asyh->view.oH *= 2;
+	asyh->view.iH = umode_vdisplay;
+	/* For the output mode, we can just use the stock helper. */
+	drm_mode_get_hv_timing(omode, &omode_hdisplay, &omode_vdisplay);
+	asyh->view.oW = omode_hdisplay;
+	asyh->view.oH = omode_vdisplay;
 
 	/* Add overscan compensation if necessary, will keep the aspect
 	 * ratio the same as the backend mode unless overridden by the
@@ -2015,7 +2022,7 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	switch (mode) {
 	case DRM_MODE_SCALE_CENTER:
 		asyh->view.oW = min((u16)umode->hdisplay, asyh->view.oW);
-		asyh->view.oH = min((u16)umode->vdisplay, asyh->view.oH);
+		asyh->view.oH = min((u16)umode_vdisplay, asyh->view.oH);
 		/* fall-through */
 	case DRM_MODE_SCALE_ASPECT:
 		if (asyh->view.oH < asyh->view.oW) {
@@ -2040,7 +2047,7 @@ nv50_head_atomic_check_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
 	struct nv50_head_mode *m = &asyh->mode;
 	u32 blankus;
 
-	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V | CRTC_STEREO_DOUBLE);
 
 	/*
 	 * DRM modes are defined in terms of a repeating interval
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI
       [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                         ` (8 preceding siblings ...)
  2017-04-11 17:11       ` [PATCH v3 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
@ 2017-04-11 17:11       ` Alastair Bridgewater
  2017-04-11 17:32         ` [Nouveau] " Ilia Mirkin
  9 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-11 17:11 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Enable stereoscopic output for HDMI and DisplayPort connectors on
NV50+ (G80+) hardware.  We do not enable stereoscopy on older
hardware in case there is some older board that still has HDMI
output but for which we have no logic for setting the Vendor
InfoFrame.

With this, I get an obvious 3D output when using the "testdisplay"
program from intel-gpu-tools with the "-3" parameter and outputting
to a 3D-capable HDMI display, for all available 3D modes (be they
TB, SBSH, or FP) on all four G80+ DISPs.

Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 9a91e79..ff188c7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1324,6 +1324,13 @@ nouveau_connector_create(struct drm_device *dev, int index)
 		break;
 	}
 
+	/* HDMI 3D support */
+	if ((disp->disp.oclass >= NV50_DISP)
+	    && ((type == DRM_MODE_CONNECTOR_DisplayPort)
+		|| (type == DRM_MODE_CONNECTOR_eDP)
+		|| (type == DRM_MODE_CONNECTOR_HDMIA)))
+		connector->stereo_allowed = true;
+
 	/* defaults, will get overridden in detect() */
 	connector->interlace_allowed = false;
 	connector->doublescan_allowed = false;
-- 
2.10.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [Nouveau] [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI
  2017-04-11 17:11       ` [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
@ 2017-04-11 17:32         ` Ilia Mirkin
       [not found]           ` <CAKb7UvjimkWMZdi1-NwWDf6BK99d1epo+i1dwrONQYrcf+n57A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Ilia Mirkin @ 2017-04-11 17:32 UTC (permalink / raw)
  To: Alastair Bridgewater; +Cc: nouveau, Ben Skeggs, dri-devel

On Tue, Apr 11, 2017 at 1:11 PM, Alastair Bridgewater
<alastair.bridgewater@gmail.com> wrote:
> Enable stereoscopic output for HDMI and DisplayPort connectors on
> NV50+ (G80+) hardware.  We do not enable stereoscopy on older
> hardware in case there is some older board that still has HDMI
> output but for which we have no logic for setting the Vendor
> InfoFrame.
>
> With this, I get an obvious 3D output when using the "testdisplay"
> program from intel-gpu-tools with the "-3" parameter and outputting
> to a 3D-capable HDMI display, for all available 3D modes (be they
> TB, SBSH, or FP) on all four G80+ DISPs.
>
> Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 9a91e79..ff188c7 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -1324,6 +1324,13 @@ nouveau_connector_create(struct drm_device *dev, int index)
>                 break;
>         }
>
> +       /* HDMI 3D support */
> +       if ((disp->disp.oclass >= NV50_DISP)

You probably meant G82_DISP. Although I don't know if there were any
G80's with DP or HDMI. Either way, all that logic is in hdmig84.c (and
newer), so ... :)

> +           && ((type == DRM_MODE_CONNECTOR_DisplayPort)
> +               || (type == DRM_MODE_CONNECTOR_eDP)
> +               || (type == DRM_MODE_CONNECTOR_HDMIA)))
> +               connector->stereo_allowed = true;
> +
>         /* defaults, will get overridden in detect() */
>         connector->interlace_allowed = false;
>         connector->doublescan_allowed = false;
> --
> 2.10.2
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI
       [not found]           ` <CAKb7UvjimkWMZdi1-NwWDf6BK99d1epo+i1dwrONQYrcf+n57A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-04-12 15:22             ` Alastair Bridgewater
  2017-04-13  8:34               ` [Nouveau] " Ben Skeggs
  0 siblings, 1 reply; 48+ messages in thread
From: Alastair Bridgewater @ 2017-04-12 15:22 UTC (permalink / raw)
  To: Ilia Mirkin
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 700 bytes --]

On Tue, Apr 11, 2017 at 1:32 PM, Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org> wrote:

> On Tue, Apr 11, 2017 at 1:11 PM, Alastair Bridgewater
> <alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > +       /* HDMI 3D support */
> > +       if ((disp->disp.oclass >= NV50_DISP)
>
> You probably meant G82_DISP. Although I don't know if there were any
> G80's with DP or HDMI. Either way, all that logic is in hdmig84.c (and
> newer), so ... :)
>

Having taken a closer look at the lower level code, I agree. It should be
G82_DISP.  Will correct in the v4 patch series (if there ends up being a v4
patch series). Good catch, and thank you!

-- Alastair Bridgewater

[-- Attachment #1.2: Type: text/html, Size: 1169 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [Nouveau] [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI
  2017-04-12 15:22             ` Alastair Bridgewater
@ 2017-04-13  8:34               ` Ben Skeggs
  0 siblings, 0 replies; 48+ messages in thread
From: Ben Skeggs @ 2017-04-13  8:34 UTC (permalink / raw)
  To: Alastair Bridgewater, Ilia Mirkin; +Cc: nouveau, Ben Skeggs, dri-devel

On 04/13/2017 01:22 AM, Alastair Bridgewater wrote:
> On Tue, Apr 11, 2017 at 1:32 PM, Ilia Mirkin <imirkin@alum.mit.edu
> <mailto:imirkin@alum.mit.edu>> wrote:
>
>     On Tue, Apr 11, 2017 at 1:11 PM, Alastair Bridgewater
>     <alastair.bridgewater@gmail.com
>     <mailto:alastair.bridgewater@gmail.com>> wrote:
>     > +       /* HDMI 3D support */
>     > +       if ((disp->disp.oclass >= NV50_DISP)
>
>     You probably meant G82_DISP. Although I don't know if there were any
>     G80's with DP or HDMI. Either way, all that logic is in hdmig84.c (and
>     newer), so ... :)
>
>
> Having taken a closer look at the lower level code, I agree. It should
> be G82_DISP.  Will correct in the v4 patch series (if there ends up
> being a v4 patch series). Good catch, and thank you!
Hey Alastair,

Firstly, a minor nit-pick:  I modified some of the commit titles a 
little.  For any changes under nvkm/, use 
"drm/nouveau/[SUBDEV][/CHIPSET(s)]:" as a prefix instead of just 
drm/nouveau.

Second, and more importantly, this series looks really good to me.  Nice 
work!

I've given it a quick test on a 3D-capable TV I have, and the TV 
definitely thinks it's getting a 3D mode :)  My glasses are flat, so 
couldn't test any further.

Regardless, I've fixed up the suggestion that Ilia made and merged the 
series.

If there's any other changes to come, there's plenty of time to squash 
those in before the next merge window.

Thanks again,
Ben.

>
> -- Alastair Bridgewater
>
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2017-04-13  8:34 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-17 22:41 [PATCH 0/6] drm/nouveau: Enable HDMI Stereoscopy Alastair Bridgewater
     [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-17 22:41   ` [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
     [not found]     ` <20170117224204.27516-2-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18  3:19       ` Ilia Mirkin
2017-01-17 22:42   ` [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
     [not found]     ` <20170117224204.27516-3-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18  3:31       ` Ilia Mirkin
2017-01-17 22:42   ` [PATCH 3/6] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
2017-01-17 22:42   ` [PATCH 4/6] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
2017-01-17 22:42   ` [PATCH 5/6] drm: Delete "mandatory" stereographic modes Alastair Bridgewater
     [not found]     ` <20170117224204.27516-6-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18  5:10       ` Ilia Mirkin
     [not found]         ` <CAKb7UvigMUdD93eqa=3bM9VHSGztV3DWgv-8hx8ho7EmHrhtqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-18 11:45           ` Damien Lespiau
     [not found]             ` <20170118114554.GA6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2017-01-18 16:27               ` Ilia Mirkin
     [not found]                 ` <CAKb7Uvg0wgmZG+S39XNP-r0Qny6ikDhwvyy9TAspOZQ_dEp1RQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-18 16:33                   ` Damien Lespiau
     [not found]                     ` <20170118163343.GD6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2017-01-18 16:41                       ` Damien Lespiau
2017-01-18 16:57                         ` [Nouveau] " Ilia Mirkin
2017-01-18 18:48                           ` Ilia Mirkin
     [not found]                             ` <CAKb7UviODH0YPH-EMUmO9Ssu5BrBb3GVa82SGawbQbiO5NKXAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-18 19:01                               ` Damien Lespiau
     [not found]                                 ` <20170118190119.GF6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2017-01-18 21:35                                   ` Alastair Bridgewater
2017-01-17 22:42   ` [PATCH 6/6] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
2017-03-27 21:57   ` [PATCH v2 00/10] Enable HDMI Stereoscopy Alastair Bridgewater
     [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-27 21:57       ` [PATCH v2 01/10] drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan / ilace Alastair Bridgewater
2017-03-27 21:57       ` [PATCH v2 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
     [not found]         ` <20170327215807.8461-10-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-28  1:54           ` kbuild test robot
2017-03-27 21:58       ` [PATCH v2 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
2017-03-29 12:02       ` [PATCH v2 00/10] Enable HDMI Stereoscopy Ville Syrjälä
     [not found]         ` <20170329120247.GX30290-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-29 14:24           ` Alastair Bridgewater
     [not found]             ` <CAEcYz2Qb74b27efw=s+ZSSO4SEQQ2_mVKXz4D3za1GkVh_AHgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-29 14:42               ` Ville Syrjälä
2017-03-29 14:48               ` Ilia Mirkin
2017-04-11 17:11   ` [PATCH v3 00/10] drm/nouveau " Alastair Bridgewater
     [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-11 17:11       ` [PATCH v3 01/10] drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus calculation Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
2017-04-11 17:32         ` [Nouveau] " Ilia Mirkin
     [not found]           ` <CAKb7UvjimkWMZdi1-NwWDf6BK99d1epo+i1dwrONQYrcf+n57A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12 15:22             ` Alastair Bridgewater
2017-04-13  8:34               ` [Nouveau] " Ben Skeggs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.