Skip to contentSkip to conversation

drm/bridge: add support for DSC in mhdp8546 driver

RFC PATCH New Damian Kos 1 participant 1 message Nov 8, 2018

Subsystems (3)
lore
Share & tools
lore

Damian Kos

author
#0 lore raw

RFC PATCH 1/1 drm/bridge: add support for DSC in mhdp8546 driver

From: Przemyslaw Gaj <[email protected]>

This patch enables DSC (Digital Stream Compression) on Cadence DisplayPort controller.

I think that a little bit of an explanation is needed here from our side before we go into the patch contents.
One might ask, why not just put everything together for mhdp8546 IP and send it when it's actually complete?
Well, the original mhdp8546 driver was ready in January and supported only SST mode at that time. MST, DSC, FEC and HDCP were distant future things back then. Unfortunately, when we were preparing to submit it, it turned out that there's already a driver for cdns dp (though, quite different IP). That held us till July when we've sent the first patch and started the review process. DSC, FEC, HDCP were still, pretty much, nonexistent and the MST was slowly moving towards the testing stage. In the last mhdp8546 patch version (v6) we've included the MST and PHY support, but received comment that is not a nice thing to do, especially when no one was asking for it. Thus, this (and FEC) patch is sent as a separate one.

Please let us know if they can be (should be?) appended to mhdp8546 patch series v7 :)

Anyway, back to the DSC patch. The DSC here relies on the code that is present in Intel's patch https://patchwork.kernel.org/cover/10596631/ which is not yet in the mainline. So... we did a not very pretty copy&paste hack and included some of its code in our code (these parts are easy to identify as they're explicitly marked, so please ignore them) just to have it running and the DSC is working fine (all patches we've send are made from a working code). We know that this is a no-no and because of that this patch will be rejected. We only ask for comments on non-borrowed code. Any suggestions on how to deal with relying on not-yet-in-mainline code are also welcome.

---
 drivers/gpu/drm/bridge/Makefile        |    2 +-
 drivers/gpu/drm/bridge/cdns-mhdp-dsc.c | 1468 ++++++++++++++++++++++++
 drivers/gpu/drm/bridge/cdns-mhdp-dsc.h |  304 +++++
 drivers/gpu/drm/bridge/cdns-mhdp-mst.c |    2 +-
 drivers/gpu/drm/bridge/cdns-mhdp.c     |  105 +-
 drivers/gpu/drm/bridge/cdns-mhdp.h     |    9 +-
 include/drm/bridge/cdns-mhdp-common.h  |  520 +++++++++
 7 files changed, 2381 insertions(+), 29 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-dsc.c
 create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-dsc.h
drivers/gpu/drm/bridge/Makefile +1 -1
index b80f3d6ed2a6..ca3622fd715f 100644
@@ -19,4 +19,4 @@ obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
 obj-$(CONFIG_DRM_CDNS_MHDP) += mhdp8546.o
 obj-y += synopsys/
 
-mhdp8546-objs := cdns-mhdp-common.o cdns-mhdp.o cdns-mhdp-mst.o
+mhdp8546-objs := cdns-mhdp-common.o cdns-mhdp.o cdns-mhdp-mst.o cdns-mhdp-dsc.o
drivers/gpu/drm/bridge/cdns-mhdp-dsc.c new file +1468 -0

1,468 lines not on this page · raw message

drivers/gpu/drm/bridge/cdns-mhdp-dsc.h new file +304 -0

304 lines not on this page · raw message

drivers/gpu/drm/bridge/cdns-mhdp-mst.c +1 -1
index 37a0c773ee54..86b26326e73a 100644
@@ -286,7 +286,7 @@ void cdns_mhdp_mst_enable(struct drm_bridge *bridge)
 	disp_info = &mhdp_bridge->connector->base.display_info;
 
 	pxlfmt = cdns_mhdp_get_pxlfmt(disp_info->color_formats);
-	bpp = cdns_mhdp_get_bpp(disp_info->bpc, pxlfmt);
+	bpp = cdns_mhdp_get_bpp(mhdp, disp_info->bpc, pxlfmt);
 
 	mhdp_connector = mhdp_bridge->connector;
 	if (mhdp_bridge->stream_id > -1) {
drivers/gpu/drm/bridge/cdns-mhdp.c +79 -26

155 lines not on this page · raw message

drivers/gpu/drm/bridge/cdns-mhdp.h +8 -1
index 857e2becb67d..9efa6970c521 100644
@@ -133,6 +133,12 @@
 #define CDNS_DP_FRAMER_YCBCR422			BIT(2)
 #define CDNS_DP_FRAMER_YCBCR420			BIT(3)
 #define CDNS_DP_FRAMER_Y_ONLY			BIT(4)
+#define CDNS_DP_FRAMER_PXL_REPR_ENC_FMT		GENMASK(12, 8)
+#define CDNS_DP_FRAMER_PXL_REPR_M		GENMASK(22, 16)
+#define CDNS_DP_FRAMER_PXL_REPR_DIFF		GENMASK(30, 24)
+#define CDNS_DP_FRAMER_PXL_REPR_ENC_FMT_SHIFT	8
+#define CDNS_DP_FRAMER_PXL_REPR_M_SHIFT		16
+#define CDNS_DP_FRAMER_PXL_REPR_DIFF_SHIFT	24
 
 #define CDNS_DP_FRAMER_SP(s)			(CDNS_DPTX_STREAM(s) + 0x10)
 #define CDNS_DP_FRAMER_VSYNC_POL_LOW		BIT(0)
@@ -202,7 +208,8 @@ int cdns_mhdp_mst_init(struct cdns_mhdp_device *mhdp);
 void cdns_mhdp_mst_deinit(struct cdns_mhdp_device *mhdp);
 bool cdns_mhdp_mst_probe(struct cdns_mhdp_device *mhdp);
 enum pixel_format cdns_mhdp_get_pxlfmt(u32 color_formats);
-u32 cdns_mhdp_get_bpp(u32 bpc, u32 color_formats);
+u32 cdns_mhdp_get_bpp(struct cdns_mhdp_device *mhdp, u32 bpc,
+		      enum pixel_format pxlfmt);
 void cdns_mhdp_configure_video(struct drm_bridge *bridge);
 void cdns_mhdp_mst_enable(struct drm_bridge *bridge);
 void cdns_mhdp_mst_disable(struct drm_bridge *bridge);
include/drm/bridge/cdns-mhdp-common.h +520 -0

552 lines not on this page · raw message

Signature · 1 line
2.17.1