Skip to contentSkip to conversation

drm/nouveau: Enable HDMI Stereoscopy

PATCH Superseded Alastair Bridgewater 7 participants 48 messages Jan 17, 2017 – Apr 13, 2017 16 messages not in the archive

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

cover drm/nouveau: Enable HDMI Stereoscopy

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(-)
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/6 drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames

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).

---
 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(-)
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +15 -1
index ae49dfd..a3ce3bf 100644
@@ -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 {
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +31 -1
index 1c4256e..f767588 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +31 -1
index 632f02d..c492cd7 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +31 -1
index 4e8067d..6c38d6d 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +31 -1
index f1afc16..e2fbe4c 100644
@@ -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);
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170117224204.27516-2-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames

Quoted 24 lines · Alastair Bridgewater

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).

---
 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(-)
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +0 -0
index ae49dfd..a3ce3bf 100644

drivers/gpu/drm/nouveau/include/nvif/cl5070.h struct nv50_disp_sor_hdmi_pwr_v0 { · line 82

Quoted 8 lines
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +4 -1
@@ -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.

drivers/gpu/drm/nouveau/include/nvif/cl5070.h struct nv50_disp_sor_hdmi_pwr_v0 { · line 87

Quoted 5 lines
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +5 -0
+       __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.

drivers/gpu/drm/nouveau/include/nvif/cl5070.h struct nv50_disp_sor_hdmi_pwr_v0 { · line 93

Quoted 6 lines
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +6 -0
+       __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]?

Quoted 222 lines
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +0 -0
 };
 
 struct nv50_disp_sor_lvds_script_v0 {
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +31 -1
index 1c4256e..f767588 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +31 -1
index 632f02d..c492cd7 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +31 -1
index 4e8067d..6c38d6d 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +31 -2
index f1afc16..e2fbe4c 100644
@@ -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

Quoted 4 lines

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

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

#5 lore raw

PATCH 2/6 drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM

In reply to a message not in the archive

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?).

---
 drivers/gpu/drm/nouveau/nv50_display.c | 49 +++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv50_display.c +48 -1
index 2c2c645..d52d0b8 100644
@@ -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);
 }
 
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170117224204.27516-3-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#7 lore raw

Re: [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM

Quoted 7 lines · Alastair Bridgewater

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.

Quoted 71 lines
---
 drivers/gpu/drm/nouveau/nv50_display.c | 49 +++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv50_display.c +29 -0
index 2c2c645..d52d0b8 100644
@@ -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;

drivers/gpu/drm/nouveau/nv50_display.c nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) · line 2833

Quoted 10 lines
drivers/gpu/drm/nouveau/nv50_display.c +5 -0
+       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.

Quoted 26 lines
drivers/gpu/drm/nouveau/nv50_display.c +14 -2
+               /* 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

Quoted 4 lines

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

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

#8 lore raw

PATCH 3/6 drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 38 ++++++++++++++++------
 1 file changed, 28 insertions(+), 10 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +28 -10
index e2fbe4c..fc8e1e4 100644
@@ -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, ?? */
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#9 lore raw

PATCH 4/6 drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 26 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +20 -6
index 6c38d6d..64b21a4 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#10 lore raw

PATCH 5/6 drm: Delete "mandatory" stereographic modes

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/drm_edid.c | 66 ----------------------------------------------
 1 file changed, 66 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -66
index 336be31..723116a 100644
@@ -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;
 	}
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170117224204.27516-6-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#12 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 5 lines · Alastair Bridgewater

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.

Quoted 8 lines

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?

Quoted 93 lines
---
 drivers/gpu/drm/drm_edid.c | 66 ----------------------------------------------
 1 file changed, 66 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -67
index 336be31..723116a 100644
@@ -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

Quoted 4 lines

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

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

A message that is not in the archive (sent off-list or not yet received): CAKb7UvigMUdD93eqa=3bM9VHSGztV3DWgv-8hx8ho7EmHrhtqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#14 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 16 lines · Ilia Mirkin
Quoted 5 lines · Alastair Bridgewater

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.

Quoted 8 lines

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.

Quoted 5 lines

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,

Signature · 7 lines
Damien


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

A message that is not in the archive (sent off-list or not yet received): 20170118114554.GA6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org

#16 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 53 lines · Damien Lespiau
Quoted 16 lines · Ilia Mirkin
Quoted 5 lines · Alastair Bridgewater

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.

Quoted 8 lines

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.

Quoted 5 lines

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:

Quoted 7 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAKb7Uvg0wgmZG+S39XNP-r0Qny6ikDhwvyy9TAspOZQ_dEp1RQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#18 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 2 lines · Ilia Mirkin

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.

Signature · 5 lines
Damien
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20170118163343.GD6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org

#20 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 7 lines · Damien Lespiau
Quoted 2 lines · Ilia Mirkin

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.

Signature · 8 lines
Damien

[1] https://cgit.freedesktop.org/xorg/app/edid-decode/
    data/samsung-UE40D8000YU-hmdi
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#21 lore raw

Re: [Nouveau] [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 9 lines · Damien Lespiau
Quoted 7 lines · Damien Lespiau
Quoted 2 lines · Ilia Mirkin

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.

Quoted 6 lines

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 [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw

Re: [Nouveau] [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 39 lines · Ilia Mirkin
Quoted 9 lines · Damien Lespiau
Quoted 7 lines · Damien Lespiau
Quoted 2 lines · Ilia Mirkin

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.

Quoted 6 lines

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
Quoted 11 lines

...
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CAKb7UviODH0YPH-EMUmO9Ssu5BrBb3GVa82SGawbQbiO5NKXAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#24 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 7 lines · Ilia Mirkin

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.

Signature · 7 lines
Damien

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

A message that is not in the archive (sent off-list or not yet received): 20170118190119.GF6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org

#26 lore raw

Re: [PATCH 5/6] drm: Delete "mandatory" stereographic modes

Quoted 9 lines · Damien Lespiau
Quoted 7 lines · Ilia Mirkin

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.

Quoted 3 lines

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.

Quoted 1 line

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?

Quoted 4 lines

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).

Quoted 4 lines

--
Damien

[1]

http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/tests/testdisplay.c

-- Alastair

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

#27 lore raw

PATCH 6/6 drm/nouveau: Enable stereoscopic 3D output over HDMI

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +13 -0
index 947c200..11b4977 100644
@@ -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;
 
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#28 lore raw

v2 cover Enable HDMI Stereoscopy

In reply to a message not in the archive

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
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#30 lore raw

PATCH v2 1/10 drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan / ilace

* 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.

---
 drivers/gpu/drm/nouveau/nv50_display.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/gpu/drm/nouveau/nv50_display.c +16 -15
index 32097fd..1acbb5a 100644
@@ -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;
 }
 
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#31 lore raw

PATCH v2 2/10 drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames

In reply to a message not in the archive

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).

---
 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(-)
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +3 -1
index ae49dfd..9d46eba 100644
@@ -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 {
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +8 -1
index 1c4256e..77e5f5a 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +8 -1
index 632f02d..66ee883 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +8 -1
index 4e8067d..3c8c26a 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +8 -1
index f1afc16..8ed00db 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#32 lore raw

PATCH v2 3/10 drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nv50_display.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv50_display.c +29 -1
index 1acbb5a..008aea6 100644
@@ -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);
 }
 
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#33 lore raw

PATCH v2 4/10 drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format

In reply to a message not in the archive

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.

---
 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
drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +1 -0
index fa05d16..65ae870 100644
@@ -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
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c new file +66 -0

66 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h +11 -0
index 1e1de6b..37ec2a1 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#34 lore raw

PATCH v2 5/10 drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +31 -6
index 77e5f5a..139344e 100644
@@ -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 */
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#35 lore raw

PATCH v2 6/10 drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +31 -6
index 8ed00db..257f7c7 100644
@@ -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 */
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#36 lore raw

PATCH v2 7/10 drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 40 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +34 -6
index 66ee883..d80e86c 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#37 lore raw

PATCH v2 8/10 drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 36 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +30 -6
index 3c8c26a..99d2731 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#38 lore raw

PATCH v2 9/10 drm/nouveau: Handle frame-packing mode geometry and timing effects

In reply to a message not in the archive

* 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).

---
 drivers/gpu/drm/nouveau/nouveau_connector.c |  3 +++
 drivers/gpu/drm/nouveau/nv50_display.c      | 21 ++++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +3 -0
index 947c200..4e3563e 100644
@@ -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;
 
drivers/gpu/drm/nouveau/nv50_display.c +14 -7
index 008aea6..fa97604 100644
@@ -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;
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170327215807.8461-10-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#40 lore raw

Re: [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects

reproduce:

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

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

#41 lore raw

PATCH v2 10/10 drm/nouveau: Enable stereoscopic 3D output over HDMI

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +7 -0
index 4e3563e..a2ee93a 100644
@@ -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;
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#42 lore raw

Re: [PATCH v2 00/10] Enable HDMI Stereoscopy

In reply to a message not in the archive
Quoted 31 lines · Alastair Bridgewater

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.

Quoted 8 lines

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.

Quoted 43 lines

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
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

#44 lore raw

Re: [PATCH v2 00/10] Enable HDMI Stereoscopy

Quoted 11 lines · Ville Syrjälä
Quoted 3 lines · Alastair Bridgewater

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.

Quoted 7 lines
Quoted 7 lines

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

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

A message that is not in the archive (sent off-list or not yet received): CAEcYz2Qb74b27efw=s+ZSSO4SEQQ2_mVKXz4D3za1GkVh_AHgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#46 lore raw

Re: [PATCH v2 00/10] Enable HDMI Stereoscopy

Quoted 14 lines · Alastair Bridgewater
Quoted 11 lines · Ville Syrjälä
Quoted 3 lines · Alastair Bridgewater

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.

Quoted 5 lines

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.

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

Re: [PATCH v2 00/10] Enable HDMI Stereoscopy

In reply to a message not in the archive
Quoted 14 lines · Alastair Bridgewater
Quoted 11 lines · Ville Syrjälä
Quoted 3 lines · Alastair Bridgewater

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.

Quoted 5 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#48 lore raw

v3 cover drm/nouveau Enable HDMI Stereoscopy

In reply to a message not in the archive

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
Signature · 6 lines
2.10.2

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

A message that is not in the archive (sent off-list or not yet received): 20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#50 lore raw

PATCH v3 1/10 drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus calculation

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.

---
 drivers/gpu/drm/nouveau/nv50_display.c | 44 ++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 21 deletions(-)
drivers/gpu/drm/nouveau/nv50_display.c +23 -21
index c9910c8..c901f32 100644
@@ -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;
 }
 
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#51 lore raw

PATCH v3 2/10 drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames

In reply to a message not in the archive

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).

---
 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(-)
drivers/gpu/drm/nouveau/include/nvif/cl5070.h +3 -1
index ae49dfd..9d46eba 100644
@@ -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 {
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +8 -1
index 1c4256e..77e5f5a 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +8 -1
index 632f02d..66ee883 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +8 -1
index 4e8067d..3c8c26a 100644
@@ -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);
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +8 -1
index f1afc16..8ed00db 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#52 lore raw

PATCH v3 3/10 drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nv50_display.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv50_display.c +29 -1
index c901f32..93149ca 100644
@@ -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);
 }
 
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#53 lore raw

PATCH v3 4/10 drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format

In reply to a message not in the archive

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.

---
 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
drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +1 -0
index fa05d16..65ae870 100644
@@ -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
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi_infoframe.c new file +66 -0

66 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h +11 -0
index 1e1de6b..37ec2a1 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#54 lore raw

PATCH v3 5/10 drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +31 -6
index 77e5f5a..139344e 100644
@@ -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 */
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#55 lore raw

PATCH v3 6/10 drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c   | 37 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +31 -6
index 8ed00db..257f7c7 100644
@@ -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 */
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#56 lore raw

PATCH v3 7/10 drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c   | 40 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +34 -6
index 66ee883..d80e86c 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#57 lore raw

PATCH v3 8/10 drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware

In reply to a message not in the archive

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.

---
 .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c   | 36 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +30 -6
index 3c8c26a..99d2731 100644
@@ -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);
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#58 lore raw

PATCH v3 9/10 drm/nouveau: Handle frame-packing mode geometry and timing effects

In reply to a message not in the archive

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).

---
 drivers/gpu/drm/nouveau/nouveau_connector.c |  3 +++
 drivers/gpu/drm/nouveau/nv50_display.c      | 21 ++++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +3 -0
index f802bcd..9a91e79 100644
@@ -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;
 
drivers/gpu/drm/nouveau/nv50_display.c +14 -7
index 93149ca..c98ed9a 100644
@@ -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
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#59 lore raw

PATCH v3 10/10 drm/nouveau: Enable stereoscopic 3D output over HDMI

In reply to a message not in the archive

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.

---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +7 -0
index 9a91e79..ff188c7 100644
@@ -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;
Signature · 6 lines
2.10.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#60 lore raw

Re: [Nouveau] [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI

Quoted 21 lines · Alastair Bridgewater

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.

---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +0 -0
index 9a91e79..ff188c7 100644

drivers/gpu/drm/nouveau/nouveau_connector.c nouveau_connector_create(struct drm_device *dev, int index) · line 1328

Quoted 5 lines
drivers/gpu/drm/nouveau/nouveau_connector.c +2 -0
@@ -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 ... :)

Quoted 11 lines
drivers/gpu/drm/nouveau/nouveau_connector.c +5 -1
+           && ((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

Quoted 4 lines

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

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

A message that is not in the archive (sent off-list or not yet received): CAKb7UvjimkWMZdi1-NwWDf6BK99d1epo+i1dwrONQYrcf+n57A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#62 lore raw

Re: [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI

Quoted 9 lines · Ilia Mirkin

drivers/gpu/drm/nouveau/nouveau_connector.c nouveau_connector_create(struct drm_device *dev, int index) · line 1328

Quoted 2 lines · Alastair Bridgewater
drivers/gpu/drm/nouveau/nouveau_connector.c +2 -0
+       /* 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

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

#63 lore raw

Re: [Nouveau] [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI

Quoted 9 lines · Alastair Bridgewater

On Tue, Apr 11, 2017 at 1:32 PM, Ilia Mirkin <[email protected] <mailto:[email protected]>> wrote:

On Tue, Apr 11, 2017 at 1:11 PM, Alastair Bridgewater <[email protected] <mailto:[email protected]>> wrote:
> + /* HDMI 3D support */
> + if ((disp->disp.oclass >= NV50_DISP)

Quoted 8 lines

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.

Quoted 9 lines

-- Alastair Bridgewater

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

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