From: Lyude Paul <lyude@redhat.com>
To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org
Cc: Ben Skeggs <bskeggs@redhat.com>, Danilo Krummrich <me@dakr.org>,
Karol Herbst <kherbst@redhat.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Kees Cook <keescook@chromium.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v3 08/44] drm/nouveau/disp: add output method to fetch edid
Date: Tue, 19 Sep 2023 17:56:03 -0400 [thread overview]
Message-ID: <20230919220442.202488-9-lyude@redhat.com> (raw)
In-Reply-To: <20230919220442.202488-1-lyude@redhat.com>
From: Ben Skeggs <bskeggs@redhat.com>
- needed to support TMDS EDID on RM
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Danilo Krummrich <me@dakr.org>
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
drivers/gpu/drm/nouveau/include/nvif/if0012.h | 10 +++++++
drivers/gpu/drm/nouveau/include/nvif/outp.h | 1 +
drivers/gpu/drm/nouveau/nouveau_connector.c | 22 ++++++++------
drivers/gpu/drm/nouveau/nvif/outp.c | 30 +++++++++++++++++++
.../gpu/drm/nouveau/nvkm/engine/disp/outp.h | 1 +
.../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 15 ++++++++++
6 files changed, 70 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h
index 923bc30af2a92..725d6e8e3d2d3 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h
@@ -13,6 +13,7 @@ union nvif_outp_args {
};
#define NVIF_OUTP_V0_DETECT 0x00
+#define NVIF_OUTP_V0_EDID_GET 0x01
#define NVIF_OUTP_V0_ACQUIRE 0x11
#define NVIF_OUTP_V0_RELEASE 0x12
@@ -36,6 +37,15 @@ union nvif_outp_detect_args {
} v0;
};
+union nvif_outp_edid_get_args {
+ struct nvif_outp_edid_get_v0 {
+ __u8 version;
+ __u8 pad01;
+ __u16 size;
+ __u8 data[2048];
+ } v0;
+};
+
union nvif_outp_load_detect_args {
struct nvif_outp_load_detect_v0 {
__u8 version;
diff --git a/drivers/gpu/drm/nouveau/include/nvif/outp.h b/drivers/gpu/drm/nouveau/include/nvif/outp.h
index c3e1e4d2f1a11..7c2c34a84fbd8 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/outp.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/outp.h
@@ -25,6 +25,7 @@ enum nvif_outp_detect_status {
};
enum nvif_outp_detect_status nvif_outp_detect(struct nvif_outp *);
+int nvif_outp_edid_get(struct nvif_outp *, u8 **pedid);
int nvif_outp_load_detect(struct nvif_outp *, u32 loadval);
int nvif_outp_acquire_rgb_crt(struct nvif_outp *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index a290a2844547c..c079686fa2408 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -570,7 +570,6 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
struct nouveau_connector *nv_connector = nouveau_connector(connector);
struct nouveau_encoder *nv_encoder = NULL;
struct nouveau_encoder *nv_partner;
- struct i2c_adapter *i2c;
int type;
int ret;
enum drm_connector_status conn_status = connector_status_disconnected;
@@ -593,15 +592,20 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
}
nv_encoder = nouveau_connector_ddc_detect(connector);
- if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) {
- struct edid *new_edid;
+ if (nv_encoder) {
+ struct edid *new_edid = NULL;
- if ((vga_switcheroo_handler_flags() &
- VGA_SWITCHEROO_CAN_SWITCH_DDC) &&
- nv_connector->type == DCB_CONNECTOR_LVDS)
- new_edid = drm_get_edid_switcheroo(connector, i2c);
- else
- new_edid = drm_get_edid(connector, i2c);
+ if (nv_encoder->i2c) {
+ if ((vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC) &&
+ nv_connector->type == DCB_CONNECTOR_LVDS)
+ new_edid = drm_get_edid_switcheroo(connector, nv_encoder->i2c);
+ else
+ new_edid = drm_get_edid(connector, nv_encoder->i2c);
+ } else {
+ ret = nvif_outp_edid_get(&nv_encoder->outp, (u8 **)&new_edid);
+ if (ret < 0)
+ return connector_status_disconnected;
+ }
nouveau_connector_set_edid(nv_connector, new_edid);
if (!nv_connector->edid) {
diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c
index 7f1daab35a0d2..10480142eea5a 100644
--- a/drivers/gpu/drm/nouveau/nvif/outp.c
+++ b/drivers/gpu/drm/nouveau/nvif/outp.c
@@ -210,6 +210,36 @@ nvif_outp_load_detect(struct nvif_outp *outp, u32 loadval)
return ret < 0 ? ret : args.load;
}
+int
+nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid)
+{
+ struct nvif_outp_edid_get_v0 *args;
+ int ret;
+
+ args = kmalloc(sizeof(*args), GFP_KERNEL);
+ if (!args)
+ return -ENOMEM;
+
+ args->version = 0;
+
+ ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_EDID_GET, args, sizeof(*args));
+ NVIF_ERRON(ret, &outp->object, "[EDID_GET] size:%d", args->size);
+ if (ret)
+ goto done;
+
+ *pedid = kmalloc(args->size, GFP_KERNEL);
+ if (!*pedid) {
+ ret = -ENOMEM;
+ goto done;
+ }
+
+ memcpy(*pedid, args->data, args->size);
+ ret = args->size;
+done:
+ kfree(args);
+ return ret;
+}
+
enum nvif_outp_detect_status
nvif_outp_detect(struct nvif_outp *outp)
{
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
index 8c9fe878f3209..1cd70868f2255 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
@@ -87,6 +87,7 @@ struct nvkm_outp_func {
void (*fini)(struct nvkm_outp *);
int (*detect)(struct nvkm_outp *);
+ int (*edid_get)(struct nvkm_outp *, u8 *data, u16 *size);
int (*acquire)(struct nvkm_outp *);
void (*release)(struct nvkm_outp *);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
index 43752e216ce88..0c4ffa3ffb288 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
@@ -275,6 +275,20 @@ nvkm_uoutp_mthd_load_detect(struct nvkm_outp *outp, void *argv, u32 argc)
return ret;
}
+static int
+nvkm_uoutp_mthd_edid_get(struct nvkm_outp *outp, void *argv, u32 argc)
+{
+ union nvif_outp_edid_get_args *args = argv;
+
+ if (argc != sizeof(args->v0) || args->v0.version != 0)
+ return -ENOSYS;
+ if (!outp->func->edid_get)
+ return -EINVAL;
+
+ args->v0.size = ARRAY_SIZE(args->v0.data);
+ return outp->func->edid_get(outp, args->v0.data, &args->v0.size);
+}
+
static int
nvkm_uoutp_mthd_detect(struct nvkm_outp *outp, void *argv, u32 argc)
{
@@ -319,6 +333,7 @@ nvkm_uoutp_mthd_noacquire(struct nvkm_outp *outp, u32 mthd, void *argv, u32 argc
{
switch (mthd) {
case NVIF_OUTP_V0_DETECT : return nvkm_uoutp_mthd_detect (outp, argv, argc);
+ case NVIF_OUTP_V0_EDID_GET : return nvkm_uoutp_mthd_edid_get (outp, argv, argc);
case NVIF_OUTP_V0_ACQUIRE : return nvkm_uoutp_mthd_acquire (outp, argv, argc);
case NVIF_OUTP_V0_LOAD_DETECT: return nvkm_uoutp_mthd_load_detect(outp, argv, argc);
case NVIF_OUTP_V0_DP_AUX_PWR : return nvkm_uoutp_mthd_dp_aux_pwr (outp, argv, argc);
--
2.41.0
next prev parent reply other threads:[~2023-09-19 22:06 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230919220442.202488-1-lyude@redhat.com>
2023-09-19 21:55 ` [PATCH v3 01/44] drm/nouveau/devinit/tu102-: remove attempt at loading PreOS Lyude Paul
2023-09-19 21:55 ` [PATCH v3 02/44] drm/nouveau/imem: support allocations not preserved across suspend Lyude Paul
2023-09-19 21:55 ` [PATCH v3 03/44] drm/nouveau/gr/gf100-: lose contents of global ctxbufs " Lyude Paul
2023-09-19 21:55 ` [PATCH v3 04/44] drm/nouveau/mmu/gp100-: always invalidate TLBs at CACHE_LEVEL_ALL Lyude Paul
2023-09-19 21:56 ` [PATCH v3 05/44] drm/nouveau/kms/nv50-: fix mst payload alloc fail crashing evo Lyude Paul
2023-09-19 21:56 ` [PATCH v3 06/44] drm/nouveau/disp: rearrange output methods Lyude Paul
2023-09-19 21:56 ` [PATCH v3 07/44] drm/nouveau/disp: add output detect method Lyude Paul
2023-09-19 21:56 ` Lyude Paul [this message]
2023-09-19 21:56 ` [PATCH v3 09/44] drm/nouveau/disp: rename internal output acquire/release functions Lyude Paul
2023-09-19 21:56 ` [PATCH v3 10/44] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state Lyude Paul
2023-09-19 21:56 ` [PATCH v3 11/44] drm/nouveau/disp: shuffle to make upcoming diffs prettier Lyude Paul
2023-09-19 21:56 ` [PATCH v3 12/44] drm/nouveau/disp: add acquire_dac() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 13/44] drm/nouveau/disp: add acquire_sor/pior() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 14/44] drm/nouveau/disp: update SOR routing immediately on acquire() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 15/44] drm/nouveau/kms/nv50-: pull some common init out of OR-specific code Lyude Paul
2023-09-19 21:56 ` [PATCH v3 16/44] drm/nouveau/kms/nv50-: remove nv_encoder.audio.connector Lyude Paul
2023-09-19 21:56 ` [PATCH v3 17/44] drm/nouveau/kms/nv50-: keep output state around until modeset complete Lyude Paul
2023-09-19 21:56 ` [PATCH v3 18/44] drm/nouveau/kms/nv50-: move audio enable post-modeset Lyude Paul
2023-09-19 21:56 ` [PATCH v3 19/44] drm/nouveau/disp: add output hdmi config method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 20/44] drm/nouveau/disp: move hdmi disable out of release() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 21/44] drm/nouveau/disp: release outputs post-modeset Lyude Paul
2023-09-19 21:56 ` [PATCH v3 22/44] drm/nouveau/disp: remove SOR routing updates from supervisor Lyude Paul
2023-09-19 21:56 ` [PATCH v3 23/44] drm/nouveau/disp: add output backlight control methods Lyude Paul
2023-09-20 19:29 ` [Nouveau] " Timur Tabi
2023-09-19 21:56 ` [PATCH v3 24/44] drm/nouveau/disp: add output lvds config method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 25/44] drm/nouveau/disp: add hdmi audio hal function Lyude Paul
2023-09-19 21:56 ` [PATCH v3 26/44] drm/nouveau/disp: move dp aux pwr method to HAL Lyude Paul
2023-09-19 21:56 ` [PATCH v3 27/44] drm/nouveau/disp: add dp aux xfer method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 28/44] drm/nouveau/disp: add dp rates method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 29/44] drm/nouveau/kms/nv50-: split DP disable+enable into two modesets Lyude Paul
2023-09-19 21:56 ` [PATCH v3 30/44] drm/nouveau/kms/nv50-: flush mst disables together Lyude Paul
2023-09-19 21:56 ` [PATCH v3 31/44] drm/nouveau/kms/nv50-: fixup sink D3 before tearing down link Lyude Paul
2023-09-19 21:56 ` [PATCH v3 32/44] drm/nouveau/disp: add dp train method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 33/44] drm/nouveau/disp: move link training out of supervisor Lyude Paul
2023-09-19 21:56 ` [PATCH v3 34/44] drm/nouveau/disp: add dp sst config method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 35/44] drm/nouveau/disp: add dp mst id get/put methods Lyude Paul
2023-09-19 21:56 ` [PATCH v3 36/44] drm/nouveau/disp: move outp/conn construction to chipset code Lyude Paul
2023-09-19 21:56 ` [PATCH v3 37/44] drm/nouveau/disp: move outp init/fini paths " Lyude Paul
2023-09-19 21:56 ` [PATCH v3 38/44] drm/nouveau/disp/nv50-: skip DCB_OUTPUT_TV Lyude Paul
2023-09-19 21:56 ` [PATCH v3 39/44] drm/nouveau/kms/nv50-: create heads based on nvkm head mask Lyude Paul
2023-09-19 21:56 ` [PATCH v3 40/44] drm/nouveau/kms/nv50-: create heads after outps/conns Lyude Paul
2023-09-20 21:28 ` [Nouveau] " Timur Tabi
2023-09-19 21:56 ` [PATCH v3 41/44] drm/nouveau/kms/nv50-: name aux channels after their connector Lyude Paul
2023-09-19 21:56 ` [PATCH v3 42/44] drm/nouveau/kms/nv50-: create connectors based on nvkm info Lyude Paul
2023-09-20 21:33 ` [Nouveau] " Timur Tabi
2023-09-19 21:56 ` [PATCH v3 43/44] drm/nouveau/kms/nv50-: create outputs " Lyude Paul
2023-09-19 21:56 ` [PATCH v3 44/44] drm/nouveau/kms/nv50-: disable dcb parsing Lyude Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230919220442.202488-9-lyude@redhat.com \
--to=lyude@redhat.com \
--cc=airlied@gmail.com \
--cc=bskeggs@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=me@dakr.org \
--cc=nouveau@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome