Skip to contentSkip to conversation

drm/amdgpu: start using graphics object ids from DAL.

PATCH In review Dave Airlie 4 participants 12 messages Apr 14, 2016 – Apr 15, 2016

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

DAL has a concept of storing the graphics object ids in a special small struct, and adding type safety to them.

I'm starting to contemplate bringing some pieces of DAL into the mainline modesetting code (like the bios parser for a start), and I think this is the best first step in that direction.

This series converts connectors, encoders and crtcs id to the DAL objects. I haven't done PLLs yet they are a bit messier and I probably need to think about them a bit more.

Also DAL doesn't support any of the DVO/external encoders, I've no idea if they even exist on DCE8 or newer GPUs, so I've done a separate patch to drop them.

Dave.

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

author maintainer
#1 lore raw

PATCH 1/7 drm/amdgpu: drop apply quirks for now.

From: Dave Airlie <[email protected]>

This isn't being used so drop it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +0 -15
index 84b0ce3..3b469ea 100644
@@ -234,16 +234,6 @@ amdgpu_atombios_get_hpd_info_from_gpio(struct amdgpu_device *adev,
 	return hpd;
 }
 
-static bool amdgpu_atombios_apply_quirks(struct amdgpu_device *adev,
-					 uint32_t supported_device,
-					 int *connector_type,
-					 struct amdgpu_i2c_bus_rec *i2c_bus,
-					 uint16_t *line_mux,
-					 struct amdgpu_hpd *hpd)
-{
-	return true;
-}
-
 static const int object_connector_convert[] = {
 	DRM_MODE_CONNECTOR_Unknown,
 	DRM_MODE_CONNECTOR_DVII,
@@ -514,11 +504,6 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device *
 
 			conn_id = le16_to_cpu(path->usConnObjectId);
 
-			if (!amdgpu_atombios_apply_quirks
-			    (adev, le16_to_cpu(path->usDeviceTag), &connector_type,
-			     &ddc_bus, &conn_id, &hpd))
-				continue;
-
 			amdgpu_display_add_connector(adev,
 						      conn_id,
 						      le16_to_cpu(path->usDeviceTag),
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#2 lore raw

PATCH 2/7 drm/amdgpu: introduce grph object id from DAL.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

DAL has a graphics object id we should re-use this in the mainline driver, and wrap around it for now.

This patch introduces the core of the grph functionality ported from DAL.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |   2 +
 .../gpu/drm/amd/include/display_grph_object_id.h   | 318 +++++++++++++++++++++
 2 files changed, 320 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/include/display_grph_object_id.h
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +2 -0
index 8d432e6..4b80978 100644
@@ -40,6 +40,8 @@
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 
+#include "display_grph_object_id.h"
+
 struct amdgpu_bo;
 struct amdgpu_device;
 struct amdgpu_encoder;
drivers/gpu/drm/amd/include/display_grph_object_id.h new file +318 -0

318 lines not on this page · raw message

Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#3 lore raw

PATCH 3/7 drm/amdgpu: introduce graphics object id helpers.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

DAL hides these inside the bios parser, we need them separate to use here, so copy them over. I'll add more to this as I go.

This also needs the ones to translate objects back that aren't in here currently.

---
 drivers/gpu/drm/amd/amdgpu/Makefile                |   3 +-
 .../drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c | 183 +++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |   2 +
 3 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
index c7fcdce..376d08a 100644
@@ -23,7 +23,8 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
 	amdgpu_pm.o atombios_dp.o amdgpu_afmt.o amdgpu_trace_points.o \
 	atombios_encoders.o amdgpu_sa.o atombios_i2c.o \
 	amdgpu_prime.o amdgpu_vm.o amdgpu_ib.o amdgpu_pll.o \
-	amdgpu_ucode.o amdgpu_bo_list.o amdgpu_ctx.o amdgpu_sync.o
+	amdgpu_ucode.o amdgpu_bo_list.o amdgpu_ctx.o amdgpu_sync.o \
+	amdgpu_grph_object_id_helpers.o
 
 # add asic specific block
 amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c new file +183 -0

183 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +2 -0
index 4b80978..adf10c9 100644
@@ -595,4 +595,6 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 			  uint32_t page_flip_flags);
 extern const struct drm_mode_config_funcs amdgpu_mode_funcs;
 
+/* amdgpu_grph_object_id_helpers.c */
+struct graphics_object_id amdgpu_object_id_from_bios_object_id(uint32_t bios_object_id);
 #endif
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#5 lore raw

PATCH 4/7 drm/amdgpu: use graphics objects for connectors.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

This introduces graphics objects for the connectors code, and replaces the atombios enums with the graphics object ones.

These correspond currently so we don't really need a back translation pass for them.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c   | 22 +++------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 37 +++++++++++++-------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h |  3 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c   |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h       |  8 +++---
 drivers/gpu/drm/amd/amdgpu/atombios_dp.c       |  8 +++---
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c | 10 +++----
 8 files changed, 37 insertions(+), 57 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index a7a53ac..0e54f4a 100644
@@ -2204,7 +2204,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_display_page_flip(adev, crtc, base) (adev)->mode_info.funcs->page_flip((adev), (crtc), (base))
 #define amdgpu_display_page_flip_get_scanoutpos(adev, crtc, vbl, pos) (adev)->mode_info.funcs->page_flip_get_scanoutpos((adev), (crtc), (vbl), (pos))
 #define amdgpu_display_add_encoder(adev, e, s, c) (adev)->mode_info.funcs->add_encoder((adev), (e), (s), (c))
-#define amdgpu_display_add_connector(adev, ci, sd, ct, ib, coi, h, r) (adev)->mode_info.funcs->add_connector((adev), (ci), (sd), (ct), (ib), (coi), (h), (r))
+#define amdgpu_display_add_connector(adev, coi, sd, ct, ib, h, r) (adev)->mode_info.funcs->add_connector((adev), (coi), (sd), (ct), (ib), (h), (r))
 #define amdgpu_display_stop_mc_access(adev, s) (adev)->mode_info.funcs->stop_mc_access((adev), (s))
 #define amdgpu_display_resume_mc_access(adev, s) (adev)->mode_info.funcs->resume_mc_access((adev), (s))
 #define amdgpu_emit_copy_buffer(adev, ib, s, d, b) (adev)->mman.buffer_funcs->emit_copy_buffer((ib),  (s), (d), (b))
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +4 -18
index 3b469ea..5f236d9 100644
@@ -273,7 +273,7 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device *
 	ATOM_OBJECT_HEADER *obj_header;
 	int i, j, k, path_size, device_support;
 	int connector_type;
-	u16 conn_id, connector_object_id;
+	struct graphics_object_id connector_object_id;
 	struct amdgpu_i2c_bus_rec ddc_bus;
 	struct amdgpu_router router;
 	struct amdgpu_gpio_rec gpio;
@@ -309,21 +309,10 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device *
 		path_size += le16_to_cpu(path->usSize);
 
 		if (device_support & le16_to_cpu(path->usDeviceTag)) {
-			uint8_t con_obj_id, con_obj_num, con_obj_type;
-
-			con_obj_id =
-			    (le16_to_cpu(path->usConnObjectId) & OBJECT_ID_MASK)
-			    >> OBJECT_ID_SHIFT;
-			con_obj_num =
-			    (le16_to_cpu(path->usConnObjectId) & ENUM_ID_MASK)
-			    >> ENUM_ID_SHIFT;
-			con_obj_type =
-			    (le16_to_cpu(path->usConnObjectId) &
-			     OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
+			connector_object_id = amdgpu_object_id_from_bios_object_id(path->usConnObjectId);
 
 			connector_type =
-				object_connector_convert[con_obj_id];
-			connector_object_id = con_obj_id;
+				object_connector_convert[connector_object_id.id];
 
 			if (connector_type == DRM_MODE_CONNECTOR_Unknown)
 				continue;
@@ -502,13 +491,10 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device *
 			/* needed for aux chan transactions */
 			ddc_bus.hpd = hpd.hpd;
 
-			conn_id = le16_to_cpu(path->usConnObjectId);
-
 			amdgpu_display_add_connector(adev,
-						      conn_id,
+						      connector_object_id,
 						      le16_to_cpu(path->usDeviceTag),
 						      connector_type, &ddc_bus,
-						      connector_object_id,
 						      &hpd,
 						      &router);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +18 -19
index 60a0c9a..765309e 100644
@@ -61,7 +61,7 @@ void amdgpu_connector_hotplug(struct drm_connector *connector)
 			amdgpu_connector->con_priv;
 
 		/* if existing sink type was not DP no need to retrain */
-		if (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT)
+		if (dig_connector->dp_sink_type != CONNECTOR_ID_DISPLAY_PORT)
 			return;
 
 		/* first get sink type as it may be reset after (un)plug */
@@ -69,7 +69,7 @@ void amdgpu_connector_hotplug(struct drm_connector *connector)
 		/* don't do anything if sink is not display port, i.e.,
 		 * passive dp->(dvi|hdmi) adaptor
 		 */
-		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
+		if (dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) {
 			int saved_dpms = connector->dpms;
 			/* Only turn off the display if it's physically disconnected */
 			if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
@@ -128,8 +128,8 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
 		break;
 	case DRM_MODE_CONNECTOR_DisplayPort:
 		dig_connector = amdgpu_connector->con_priv;
-		if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-		    (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) ||
+		if ((dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) ||
+		    (dig_connector->dp_sink_type == CONNECTOR_ID_EDP) ||
 		    drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) {
 			if (connector->display_info.bpc)
 				bpc = connector->display_info.bpc;
@@ -321,8 +321,8 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector)
 		   (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) {
 		struct amdgpu_connector_atom_dig *dig = amdgpu_connector->con_priv;
 
-		if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
-		     dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) &&
+		if ((dig->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT ||
+		     dig->dp_sink_type == CONNECTOR_ID_EDP) &&
 		    amdgpu_connector->ddc_bus->has_aux)
 			amdgpu_connector->edid = drm_get_edid(connector,
 							      &amdgpu_connector->ddc_bus->aux.ddc);
@@ -1168,9 +1168,9 @@ static int amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
 	/* XXX check mode bandwidth */
 
 	if (amdgpu_connector->use_digital && (mode->clock > 165000)) {
-		if ((amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
-		    (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
-		    (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
+		enum connector_id conn_obj_id = display_graphics_object_id_get_connector_id(amdgpu_connector->connector_object_id);
+		if ((conn_obj_id == CONNECTOR_ID_DUAL_LINK_DVII) ||
+		    (conn_obj_id == CONNECTOR_ID_DUAL_LINK_DVID)) {
 			return MODE_OK;
 		} else if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) {
 			/* HDMI 1.3+ supports max clock of 340 Mhz */
@@ -1373,7 +1373,7 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
 				ret = connector_status_connected;
 		}
 		/* eDP is always DP */
-		amdgpu_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
+		amdgpu_dig_connector->dp_sink_type = CONNECTOR_ID_DISPLAY_PORT;
 		if (!amdgpu_dig_connector->edp_on)
 			amdgpu_atombios_encoder_set_edp_panel_power(connector,
 							     ATOM_TRANSMITTER_ACTION_POWER_ON);
@@ -1385,7 +1385,7 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
 	} else if (amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) !=
 		   ENCODER_OBJECT_ID_NONE) {
 		/* DP bridges are always DP */
-		amdgpu_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
+		amdgpu_dig_connector->dp_sink_type = CONNECTOR_ID_DISPLAY_PORT;
 		/* get the DPCD from the bridge */
 		amdgpu_atombios_dp_get_dpcd(amdgpu_connector);
 
@@ -1405,10 +1405,10 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
 			amdgpu_atombios_dp_get_sinktype(amdgpu_connector);
 		if (amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
 			ret = connector_status_connected;
-			if (amdgpu_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT)
+			if (amdgpu_dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT)
 				amdgpu_atombios_dp_get_dpcd(amdgpu_connector);
 		} else {
-			if (amdgpu_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
+			if (amdgpu_dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) {
 				if (!amdgpu_atombios_dp_get_dpcd(amdgpu_connector))
 					ret = connector_status_connected;
 			} else {
@@ -1462,8 +1462,8 @@ static int amdgpu_connector_dp_mode_valid(struct drm_connector *connector,
 		}
 		return MODE_OK;
 	} else {
-		if ((amdgpu_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-		    (amdgpu_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
+		if ((amdgpu_dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) ||
+		    (amdgpu_dig_connector->dp_sink_type == CONNECTOR_ID_EDP)) {
 			return amdgpu_atombios_dp_mode_valid_helper(connector, mode);
 		} else {
 			if (drm_detect_hdmi_monitor(amdgpu_connector_edid(connector))) {
@@ -1506,11 +1506,11 @@ static const struct drm_connector_funcs amdgpu_connector_edp_funcs = {
 
 void
 amdgpu_connector_add(struct amdgpu_device *adev,
-		      uint32_t connector_id,
+		      struct graphics_object_id connector_object_id,
 		      uint32_t supported_device,
 		      int connector_type,
 		      struct amdgpu_i2c_bus_rec *i2c_bus,
-		      uint16_t connector_object_id,
+
 		      struct amdgpu_hpd *hpd,
 		      struct amdgpu_router *router)
 {
@@ -1531,7 +1531,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
 	/* see if we already added it */
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
 		amdgpu_connector = to_amdgpu_connector(connector);
-		if (amdgpu_connector->connector_id == connector_id) {
+		if (display_graphics_object_id_is_equal_unchecked(amdgpu_connector->connector_object_id, connector_object_id)) {
 			amdgpu_connector->devices |= supported_device;
 			return;
 		}
@@ -1569,7 +1569,6 @@ amdgpu_connector_add(struct amdgpu_device *adev,
 
 	connector = &amdgpu_connector->base;
 
-	amdgpu_connector->connector_id = connector_id;
 	amdgpu_connector->devices = supported_device;
 	amdgpu_connector->shared_ddc = shared_ddc;
 	amdgpu_connector->connector_object_id = connector_object_id;
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h +1 -2
index 61fcef1..70b2663 100644
@@ -31,11 +31,10 @@ u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn
 bool amdgpu_connector_is_dp12_capable(struct drm_connector *connector);
 void
 amdgpu_connector_add(struct amdgpu_device *adev,
-		      uint32_t connector_id,
+		      struct graphics_object_id connector_object_id,
 		      uint32_t supported_device,
 		      int connector_type,
 		      struct amdgpu_i2c_bus_rec *i2c_bus,
-		      uint16_t connector_object_id,
 		      struct amdgpu_hpd *hpd,
 		      struct amdgpu_router *router);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c +2 -2
index 94138ab..574e9cb 100644
@@ -222,8 +222,8 @@ bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder,
 	case DRM_MODE_CONNECTOR_HDMIA:
 	case DRM_MODE_CONNECTOR_DisplayPort:
 		dig_connector = amdgpu_connector->con_priv;
-		if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-		    (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP))
+		if ((dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) ||
+		    (dig_connector->dp_sink_type == CONNECTOR_ID_EDP))
 			return false;
 		else {
 			/* HDMI 1.3 supports up to 340 Mhz over single link */
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +3 -5
index adf10c9..33284c8 100644
@@ -294,11 +294,10 @@ struct amdgpu_display_funcs {
 			    uint32_t supported_device,
 			    u16 caps);
 	void (*add_connector)(struct amdgpu_device *adev,
-			      uint32_t connector_id,
+			      struct graphics_object_id connector_object_id,
 			      uint32_t supported_device,
 			      int connector_type,
 			      struct amdgpu_i2c_bus_rec *i2c_bus,
-			      uint16_t connector_object_id,
 			      struct amdgpu_hpd *hpd,
 			      struct amdgpu_router *router);
 	void (*stop_mc_access)(struct amdgpu_device *adev,
@@ -453,10 +452,10 @@ struct amdgpu_encoder {
 struct amdgpu_connector_atom_dig {
 	/* displayport */
 	u8 dpcd[DP_RECEIVER_CAP_SIZE];
-	u8 dp_sink_type;
 	int dp_clock;
 	int dp_lane_count;
 	bool edp_on;
+	enum connector_id dp_sink_type;
 };
 
 struct amdgpu_gpio_rec {
@@ -502,7 +501,7 @@ enum amdgpu_connector_dither {
 
 struct amdgpu_connector {
 	struct drm_connector base;
-	uint32_t connector_id;
+	struct graphics_object_id connector_object_id;
 	uint32_t devices;
 	struct amdgpu_i2c_chan *ddc_bus;
 	/* some systems have an hdmi and vga port with a shared ddc line */
@@ -514,7 +513,6 @@ struct amdgpu_connector {
 	void *con_priv;
 	bool dac_load_detect;
 	bool detected_by_load; /* if the connection status was determined by load */
-	uint16_t connector_object_id;
 	struct amdgpu_hpd hpd;
 	struct amdgpu_router router;
 	struct amdgpu_i2c_chan *router_bus;
drivers/gpu/drm/amd/amdgpu/atombios_dp.c +4 -4
index bf731e9..29d698b 100644
@@ -408,8 +408,8 @@ void amdgpu_atombios_dp_set_link_config(struct drm_connector *connector,
 		return;
 	dig_connector = amdgpu_connector->con_priv;
 
-	if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-	    (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
+	if ((dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) ||
+	    (dig_connector->dp_sink_type == CONNECTOR_ID_EDP)) {
 		ret = amdgpu_atombios_dp_get_dp_link_config(connector, dig_connector->dpcd,
 							    mode->clock,
 							    &dig_connector->dp_lane_count,
@@ -730,8 +730,8 @@ void amdgpu_atombios_dp_link_train(struct drm_encoder *encoder,
 		return;
 	dig_connector = amdgpu_connector->con_priv;
 
-	if ((dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT) &&
-	    (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_eDP))
+	if ((dig_connector->dp_sink_type != CONNECTOR_ID_DISPLAY_PORT) &&
+	    (dig_connector->dp_sink_type != CONNECTOR_ID_EDP))
 		return;
 
 	if (drm_dp_dpcd_readb(&amdgpu_connector->ddc_bus->aux, DP_MAX_LANE_COUNT, &tmp)
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +4 -6
index 1e0bba2..4367941 100644
@@ -503,8 +503,8 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder)
 		break;
 	case DRM_MODE_CONNECTOR_DisplayPort:
 		dig_connector = amdgpu_connector->con_priv;
-		if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-		    (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
+		if ((dig_connector->dp_sink_type == CONNECTOR_ID_DISPLAY_PORT) ||
+		    (dig_connector->dp_sink_type == CONNECTOR_ID_EDP)) {
 			return ATOM_ENCODER_MODE_DP;
 		} else if (amdgpu_audio != 0) {
 			if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
@@ -750,8 +750,7 @@ amdgpu_atombios_encoder_setup_dig_transmitter(struct drm_encoder *encoder, int a
 		hpd_id = amdgpu_connector->hpd.hpd;
 		dp_clock = dig_connector->dp_clock;
 		dp_lane_count = dig_connector->dp_lane_count;
-		connector_object_id =
-			(amdgpu_connector->connector_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
+		connector_object_id = display_graphics_object_id_get_connector_id(amdgpu_connector->connector_object_id);
 	}
 
 	if (encoder->crtc) {
@@ -1156,8 +1155,7 @@ amdgpu_atombios_encoder_setup_external_encoder(struct drm_encoder *encoder,
 
 		dp_clock = dig_connector->dp_clock;
 		dp_lane_count = dig_connector->dp_lane_count;
-		connector_object_id =
-			(amdgpu_connector->connector_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
+		connector_object_id = display_graphics_object_id_get_connector_id(amdgpu_connector->connector_object_id);
 	}
 
 	memset(&args, 0, sizeof(args));
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#6 lore raw

RFC PATCH 5/7 drm/amdgpu: drop DVO encoders support.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

I'm a bit confused whether this is needed so it would be good to confirm if hw shipped with it.

DAL as currently is doesn't have any support for this, it doesn't have any encoder ids for DVO that I can see.

So before porting to DAL graphics objects, I'm removing this code, so we can see if any regressions land here.

---
 drivers/gpu/drm/amd/amdgpu/atombios_crtc.c     |   3 -
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c | 100 -------------------------
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c         |   8 --
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c         |   8 --
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c          |   8 --
 5 files changed, 127 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c +0 -3
index 49aa350..072a729 100644
@@ -344,9 +344,6 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
 		}
 	}
 
-	/* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
-	if (amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
-		adjusted_clock = mode->clock * 2;
 	if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
 		amdgpu_crtc->pll_flags |= AMDGPU_PLL_PREFER_CLOSEST_LOWER;
 	if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +0 -100

151 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +0 -8
index 6de2ce53..90dc73b 100644
@@ -3733,7 +3733,6 @@ static void dce_v10_0_encoder_add(struct amdgpu_device *adev,
 				 DRM_MODE_ENCODER_DAC, NULL);
 		drm_encoder_helper_add(encoder, &dce_v10_0_dac_helper_funcs);
 		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -3754,13 +3753,6 @@ static void dce_v10_0_encoder_add(struct amdgpu_device *adev,
 		}
 		drm_encoder_helper_add(encoder, &dce_v10_0_dig_helper_funcs);
 		break;
-	case ENCODER_OBJECT_ID_SI170B:
-	case ENCODER_OBJECT_ID_CH7303:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOA:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOB:
-	case ENCODER_OBJECT_ID_TITFP513:
-	case ENCODER_OBJECT_ID_VT1623:
-	case ENCODER_OBJECT_ID_HDMI_SI1930:
 	case ENCODER_OBJECT_ID_TRAVIS:
 	case ENCODER_OBJECT_ID_NUTMEG:
 		/* these are handled by the primary encoders */
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +0 -8
index 89aab0a..d3c9fb7 100644
@@ -3674,7 +3674,6 @@ static void dce_v11_0_encoder_add(struct amdgpu_device *adev,
 				 DRM_MODE_ENCODER_DAC, NULL);
 		drm_encoder_helper_add(encoder, &dce_v11_0_dac_helper_funcs);
 		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -3695,13 +3694,6 @@ static void dce_v11_0_encoder_add(struct amdgpu_device *adev,
 		}
 		drm_encoder_helper_add(encoder, &dce_v11_0_dig_helper_funcs);
 		break;
-	case ENCODER_OBJECT_ID_SI170B:
-	case ENCODER_OBJECT_ID_CH7303:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOA:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOB:
-	case ENCODER_OBJECT_ID_TITFP513:
-	case ENCODER_OBJECT_ID_VT1623:
-	case ENCODER_OBJECT_ID_HDMI_SI1930:
 	case ENCODER_OBJECT_ID_TRAVIS:
 	case ENCODER_OBJECT_ID_NUTMEG:
 		/* these are handled by the primary encoders */
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +0 -8
index e56b55d..ddb8eba 100644
@@ -3663,7 +3663,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev,
 				 DRM_MODE_ENCODER_DAC, NULL);
 		drm_encoder_helper_add(encoder, &dce_v8_0_dac_helper_funcs);
 		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
 	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -3684,13 +3683,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev,
 		}
 		drm_encoder_helper_add(encoder, &dce_v8_0_dig_helper_funcs);
 		break;
-	case ENCODER_OBJECT_ID_SI170B:
-	case ENCODER_OBJECT_ID_CH7303:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOA:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOB:
-	case ENCODER_OBJECT_ID_TITFP513:
-	case ENCODER_OBJECT_ID_VT1623:
-	case ENCODER_OBJECT_ID_HDMI_SI1930:
 	case ENCODER_OBJECT_ID_TRAVIS:
 	case ENCODER_OBJECT_ID_NUTMEG:
 		/* these are handled by the primary encoders */
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#8 lore raw

PATCH 6/7 drm/amdgpu: convert encoders to using the graphics object ids.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

This ports the encoder code over to the common graphics objects from DAL.

Note the encoders id don't match 1:1 between atombios and the graphics objects.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c       |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c     |  30 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h     |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c        |  46 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c       |  14 +-
 .../drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c | 129 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h           |   7 +-
 drivers/gpu/drm/amd/amdgpu/atombios_crtc.c         |  26 +--
 drivers/gpu/drm/amd/amdgpu/atombios_crtc.h         |   2 +-
 drivers/gpu/drm/amd/amdgpu/atombios_dp.c           |   8 +-
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c     | 228 ++++++++++++---------
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c             |  57 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c             |  54 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c              |  54 ++---
 .../gpu/drm/amd/include/display_grph_object_id.h   |   1 +
 15 files changed, 409 insertions(+), 254 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +3 -2
index 5f236d9..e8855a3 100644
@@ -341,7 +341,8 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device *
 								 le16_to_cpu(enc_obj->asObjects[k].usRecordOffset));
 							ATOM_ENCODER_CAP_RECORD *cap_record;
 							u16 caps = 0;
-
+							struct graphics_object_id encoder_object_id;
+							encoder_object_id = amdgpu_object_id_from_bios_object_id(encoder_obj);
 							while (record->ucRecordSize > 0 &&
 							       record->ucRecordType > 0 &&
 							       record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
@@ -355,7 +356,7 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device *
 								record = (ATOM_COMMON_RECORD_HEADER *)
 									((char *)record + record->ucRecordSize);
 							}
-							amdgpu_display_add_encoder(adev, encoder_obj,
+							amdgpu_display_add_encoder(adev, encoder_object_id,
 										    le16_to_cpu(path->usDeviceTag),
 										    caps);
 						}
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +16 -14
index 765309e..eb9b9dc 100644
@@ -313,7 +313,7 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector)
 		amdgpu_i2c_router_select_ddc_port(amdgpu_connector);
 
 	if ((amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-	     ENCODER_OBJECT_ID_NONE) &&
+	     ENCODER_ID_UNKNOWN) &&
 	    amdgpu_connector->ddc_bus->has_aux) {
 		amdgpu_connector->edid = drm_get_edid(connector,
 						      &amdgpu_connector->ddc_bus->aux.ddc);
@@ -1228,7 +1228,7 @@ static int amdgpu_connector_dp_get_modes(struct drm_connector *connector)
 		} else {
 			/* need to setup ddc on the bridge */
 			if (amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-			    ENCODER_OBJECT_ID_NONE) {
+			    ENCODER_ID_UNKNOWN) {
 				if (encoder)
 					amdgpu_atombios_encoder_setup_ext_encoder_ddc(encoder);
 			}
@@ -1262,7 +1262,7 @@ static int amdgpu_connector_dp_get_modes(struct drm_connector *connector)
 	} else {
 		/* need to setup ddc on the bridge */
 		if (amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-			ENCODER_OBJECT_ID_NONE) {
+			ENCODER_ID_UNKNOWN) {
 			if (encoder)
 				amdgpu_atombios_encoder_setup_ext_encoder_ddc(encoder);
 		}
@@ -1275,11 +1275,12 @@ static int amdgpu_connector_dp_get_modes(struct drm_connector *connector)
 	return ret;
 }
 
-u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector)
+enum encoder_id amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector)
 {
 	struct drm_encoder *encoder;
 	struct amdgpu_encoder *amdgpu_encoder;
 	int i;
+	enum encoder_id enc_id;
 
 	for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
 		if (connector->encoder_ids[i] == 0)
@@ -1291,17 +1292,17 @@ u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn
 			continue;
 
 		amdgpu_encoder = to_amdgpu_encoder(encoder);
-
-		switch (amdgpu_encoder->encoder_id) {
-		case ENCODER_OBJECT_ID_TRAVIS:
-		case ENCODER_OBJECT_ID_NUTMEG:
-			return amdgpu_encoder->encoder_id;
+		enc_id = display_graphics_object_id_get_encoder_id(amdgpu_encoder->encoder_object_id);
+		switch (enc_id) {
+		case ENCODER_ID_EXTERNAL_TRAVIS:
+		case ENCODER_ID_EXTERNAL_NUTMEG:
+			return enc_id;
 		default:
 			break;
 		}
 	}
 
-	return ENCODER_OBJECT_ID_NONE;
+	return ENCODER_ID_UNKNOWN;
 }
 
 static bool amdgpu_connector_encoder_is_hbr2(struct drm_connector *connector)
@@ -1383,7 +1384,7 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
 			amdgpu_atombios_encoder_set_edp_panel_power(connector,
 							     ATOM_TRANSMITTER_ACTION_POWER_OFF);
 	} else if (amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-		   ENCODER_OBJECT_ID_NONE) {
+		   ENCODER_ID_UNKNOWN) {
 		/* DP bridges are always DP */
 		amdgpu_dig_connector->dp_sink_type = CONNECTOR_ID_DISPLAY_PORT;
 		/* get the DPCD from the bridge */
@@ -1552,9 +1553,10 @@ amdgpu_connector_add(struct amdgpu_device *adev,
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
 		amdgpu_encoder = to_amdgpu_encoder(encoder);
 		if (amdgpu_encoder->devices & supported_device) {
-			switch (amdgpu_encoder->encoder_id) {
-			case ENCODER_OBJECT_ID_TRAVIS:
-			case ENCODER_OBJECT_ID_NUTMEG:
+			enum encoder_id enc_id = display_graphics_object_id_get_encoder_id(amdgpu_encoder->encoder_object_id);
+			switch (enc_id) {
+			case ENCODER_ID_EXTERNAL_TRAVIS:
+			case ENCODER_ID_EXTERNAL_NUTMEG:
 				is_dp_bridge = true;
 				break;
 			default:
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h +1 -1
index 70b2663..f062101 100644
@@ -27,7 +27,7 @@
 struct edid *amdgpu_connector_edid(struct drm_connector *connector);
 void amdgpu_connector_hotplug(struct drm_connector *connector);
 int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector);
-u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector);
+enum encoder_id amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector);
 bool amdgpu_connector_is_dp12_capable(struct drm_connector *connector);
 void
 amdgpu_connector_add(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +16 -30

85 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c +7 -7
index 574e9cb..f51e0ee 100644
@@ -132,16 +132,16 @@ u16 amdgpu_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder)
 
 	if (other_encoder) {
 		struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(other_encoder);
-
-		switch (amdgpu_encoder->encoder_id) {
-		case ENCODER_OBJECT_ID_TRAVIS:
-		case ENCODER_OBJECT_ID_NUTMEG:
-			return amdgpu_encoder->encoder_id;
+		uint8_t enc_id = display_graphics_object_id_get_encoder_id(amdgpu_encoder->encoder_object_id);
+		switch (enc_id) {
+		case ENCODER_ID_EXTERNAL_TRAVIS:
+		case ENCODER_ID_EXTERNAL_NUTMEG:
+			return enc_id;
 		default:
-			return ENCODER_OBJECT_ID_NONE;
+			return ENCODER_ID_UNKNOWN;
 		}
 	}
-	return ENCODER_OBJECT_ID_NONE;
+	return ENCODER_ID_UNKNOWN;
 }
 
 void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c +129 -0

144 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +4 -3
index 33284c8..96e1de8 100644
@@ -290,7 +290,7 @@ struct amdgpu_display_funcs {
 					u32 *vbl, u32 *position);
 	/* display topology setup */
 	void (*add_encoder)(struct amdgpu_device *adev,
-			    uint32_t encoder_enum,
+			    struct graphics_object_id encoder_id,
 			    uint32_t supported_device,
 			    u16 caps);
 	void (*add_connector)(struct amdgpu_device *adev,
@@ -432,8 +432,7 @@ struct amdgpu_encoder_atom_dig {
 
 struct amdgpu_encoder {
 	struct drm_encoder base;
-	uint32_t encoder_enum;
-	uint32_t encoder_id;
+	struct graphics_object_id encoder_object_id;
 	uint32_t devices;
 	uint32_t active_device;
 	uint32_t flags;
@@ -595,4 +594,6 @@ extern const struct drm_mode_config_funcs amdgpu_mode_funcs;
 
 /* amdgpu_grph_object_id_helpers.c */
 struct graphics_object_id amdgpu_object_id_from_bios_object_id(uint32_t bios_object_id);
+uint8_t amdgpu_encoder_object_to_atom(struct graphics_object_id object_id);
+uint8_t amdgpu_encoder_id_to_atom(enum encoder_id id);
 #endif
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c +14 -12
index 072a729..5b8d3c6 100644
@@ -319,11 +319,11 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
 	union adjust_pixel_clock args;
 	u8 frev, crev;
 	int index;
-
+	uint8_t atom_enc_id;
 	amdgpu_crtc->pll_flags = AMDGPU_PLL_USE_FRAC_FB_DIV;
 
 	if ((amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) ||
-	    (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) {
+	    (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_ID_UNKNOWN)) {
 		if (connector) {
 			struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
 			struct amdgpu_connector_atom_dig *dig_connector =
@@ -368,6 +368,7 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
 		}
 	}
 
+	atom_enc_id = amdgpu_encoder_object_to_atom(amdgpu_encoder->encoder_object_id);
 	/* DCE3+ has an AdjustDisplayPll that will adjust the pixel clock
 	 * accordingly based on the encoder/transmitter to work around
 	 * special hw requirements.
@@ -385,7 +386,7 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
 		case 1:
 		case 2:
 			args.v1.usPixelClock = cpu_to_le16(clock / 10);
-			args.v1.ucTransmitterID = amdgpu_encoder->encoder_id;
+			args.v1.ucTransmitterID = atom_enc_id;
 			args.v1.ucEncodeMode = encoder_mode;
 			if (amdgpu_crtc->ss_enabled && amdgpu_crtc->ss.percentage)
 				args.v1.ucConfig |=
@@ -397,7 +398,7 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
 			break;
 		case 3:
 			args.v3.sInput.usPixelClock = cpu_to_le16(clock / 10);
-			args.v3.sInput.ucTransmitterID = amdgpu_encoder->encoder_id;
+			args.v3.sInput.ucTransmitterID = atom_enc_id;
 			args.v3.sInput.ucEncodeMode = encoder_mode;
 			args.v3.sInput.ucDispPllConfig = 0;
 			if (amdgpu_crtc->ss_enabled && amdgpu_crtc->ss.percentage)
@@ -418,9 +419,9 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
 						DISPPLL_CONFIG_DUAL_LINK;
 			}
 			if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) !=
-			    ENCODER_OBJECT_ID_NONE)
+			    ENCODER_ID_UNKNOWN)
 				args.v3.sInput.ucExtTransmitterID =
-					amdgpu_encoder_get_dp_bridge_encoder_id(encoder);
+				  amdgpu_encoder_id_to_atom(amdgpu_encoder_get_dp_bridge_encoder_id(encoder));
 			else
 				args.v3.sInput.ucExtTransmitterID = 0;
 
@@ -523,7 +524,7 @@ void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
 			       u32 crtc_id,
 			       int pll_id,
 			       u32 encoder_mode,
-			       u32 encoder_id,
+			       struct graphics_object_id encoder_object_id,
 			       u32 clock,
 			       u32 ref_div,
 			       u32 fb_div,
@@ -538,6 +539,7 @@ void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
 	u8 frev, crev;
 	int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock);
 	union set_pixel_clock args;
+	uint8_t atom_enc_id = amdgpu_encoder_object_to_atom(encoder_object_id);
 
 	memset(&args, 0, sizeof(args));
 
@@ -583,7 +585,7 @@ void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
 				args.v3.ucMiscInfo = PIXEL_CLOCK_MISC_CRTC_SEL_CRTC1;
 			if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK))
 				args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC;
-			args.v3.ucTransmitterId = encoder_id;
+			args.v3.ucTransmitterId = atom_enc_id;
 			args.v3.ucEncoderMode = encoder_mode;
 			break;
 		case 5:
@@ -613,7 +615,7 @@ void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
 					break;
 				}
 			}
-			args.v5.ucTransmitterID = encoder_id;
+			args.v5.ucTransmitterID = atom_enc_id;
 			args.v5.ucEncoderMode = encoder_mode;
 			args.v5.ucPpll = pll_id;
 			break;
@@ -645,7 +647,7 @@ void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
 					break;
 				}
 			}
-			args.v6.ucTransmitterID = encoder_id;
+			args.v6.ucTransmitterID = atom_enc_id;
 			args.v6.ucEncoderMode = encoder_mode;
 			args.v6.ucPpll = pll_id;
 			break;
@@ -676,7 +678,7 @@ int amdgpu_atombios_crtc_prepare_pll(struct drm_crtc *crtc,
 	amdgpu_crtc->ss_enabled = false;
 
 	if ((amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) ||
-	    (amdgpu_encoder_get_dp_bridge_encoder_id(amdgpu_crtc->encoder) != ENCODER_OBJECT_ID_NONE)) {
+	    (amdgpu_encoder_get_dp_bridge_encoder_id(amdgpu_crtc->encoder) != ENCODER_ID_UNKNOWN)) {
 		struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv;
 		struct drm_connector *connector =
 			amdgpu_get_connector_for_encoder(amdgpu_crtc->encoder);
@@ -776,7 +778,7 @@ void amdgpu_atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
 				 amdgpu_crtc->crtc_id, &amdgpu_crtc->ss);
 
 	amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_id, amdgpu_crtc->pll_id,
-				  encoder_mode, amdgpu_encoder->encoder_id, clock,
+				  encoder_mode, amdgpu_encoder->encoder_object_id, clock,
 				  ref_div, fb_div, frac_fb_div, post_div,
 				  amdgpu_crtc->bpc, amdgpu_crtc->ss_enabled, &amdgpu_crtc->ss);
 
drivers/gpu/drm/amd/amdgpu/atombios_crtc.h +1 -1
index c670833..452245f 100644
@@ -41,7 +41,7 @@ void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
 			       u32 crtc_id,
 			       int pll_id,
 			       u32 encoder_mode,
-			       u32 encoder_id,
+			       struct graphics_object_id encoder_object_id,
 			       u32 clock,
 			       u32 ref_div,
 			       u32 fb_div,
drivers/gpu/drm/amd/amdgpu/atombios_dp.c +4 -4
index 29d698b..5296c99 100644
@@ -266,7 +266,7 @@ static int amdgpu_atombios_dp_get_dp_link_config(struct drm_connector *connector
 	unsigned lane_num, i, max_pix_clock;
 
 	if (amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) ==
-	    ENCODER_OBJECT_ID_NUTMEG) {
+	    ENCODER_ID_EXTERNAL_NUTMEG) {
 		for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
 			max_pix_clock = (lane_num * 270000 * 8) / bpp;
 			if (max_pix_clock >= pix_clock) {
@@ -373,14 +373,14 @@ int amdgpu_atombios_dp_get_panel_mode(struct drm_encoder *encoder,
 
 	dig_connector = amdgpu_connector->con_priv;
 
-	if (dp_bridge != ENCODER_OBJECT_ID_NONE) {
+	if (dp_bridge != ENCODER_ID_UNKNOWN) {
 		/* DP bridge chips */
 		if (drm_dp_dpcd_readb(&amdgpu_connector->ddc_bus->aux,
 				      DP_EDP_CONFIGURATION_CAP, &tmp) == 1) {
 			if (tmp & 1)
 				panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
-			else if ((dp_bridge == ENCODER_OBJECT_ID_NUTMEG) ||
-				 (dp_bridge == ENCODER_OBJECT_ID_TRAVIS))
+			else if ((dp_bridge == ENCODER_ID_EXTERNAL_NUTMEG) ||
+				 (dp_bridge == ENCODER_ID_EXTERNAL_TRAVIS))
 				panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
 			else
 				panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +129 -99

533 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +29 -28

144 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +28 -26

143 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +27 -27

151 lines not on this page · raw message

drivers/gpu/drm/amd/include/display_grph_object_id.h +1 -0
index 2bb8642..9fbf7fb 100644
@@ -315,4 +315,5 @@ static inline uint32_t display_graphics_object_id_to_uint(struct graphics_object
 	return object_id;
 }
 
+#define DISPLAY_NO_OBJECT (struct graphics_object_id){0}
 #endif
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#9 lore raw

PATCH 7/7 drm/amdgpu: convert crtc to using graphics object ids.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

As before, convert the crtc_id to a graphics object id.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c    | 10 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h       |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c         |  2 +-
 drivers/gpu/drm/amd/amdgpu/atombios_crtc.c     | 55 ++++++++++++++------------
 drivers/gpu/drm/amd/amdgpu/atombios_crtc.h     |  2 +-
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |  8 ++--
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c         | 31 ++++++++-------
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c         | 31 ++++++++-------
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c          | 33 ++++++++--------
 11 files changed, 93 insertions(+), 85 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +1 -1
index 8b653f2..11aa704 100644
@@ -828,7 +828,7 @@ static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device,
 				&ddev->mode_config.crtc_list, head) {
 			amdgpu_crtc = to_amdgpu_crtc(crtc);
 			if (crtc->enabled) {
-				info->active_display_mask |= (1 << amdgpu_crtc->crtc_id);
+				info->active_display_mask |= (1 << amdgpu_crtc->crtc_object_id.id);
 				info->display_count++;
 			}
 			if (mode_info != NULL &&
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +5 -5
index 448b211..d80d2dd 100644
@@ -140,7 +140,7 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
 
 
 	DRM_DEBUG_DRIVER("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_SUBMITTED, work: %p,\n",
-					 amdgpuCrtc->crtc_id, amdgpuCrtc, work);
+					 amdgpuCrtc->crtc_object_id.id, amdgpuCrtc, work);
 
 }
 
@@ -196,7 +196,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 
 	work->event = event;
 	work->adev = adev;
-	work->crtc_id = amdgpu_crtc->crtc_id;
+	work->crtc_id = amdgpu_crtc->crtc_object_id.id;
 
 	/* schedule unpin of the old buffer */
 	old_amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
@@ -239,7 +239,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 
 	work->base = base;
 
-	r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_id);
+	r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_object_id.id);
 	if (r) {
 		DRM_ERROR("failed to get vblank before flip\n");
 		goto pflip_cleanup;
@@ -259,7 +259,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 
 
 	DRM_DEBUG_DRIVER("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n",
-					 amdgpu_crtc->crtc_id, amdgpu_crtc, work);
+					 amdgpu_crtc->crtc_object_id.id, amdgpu_crtc, work);
 	/* update crtc fb */
 	crtc->primary->fb = fb;
 	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
@@ -267,7 +267,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 	return 0;
 
 vblank_cleanup:
-	drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
+	drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_object_id.id);
 
 pflip_cleanup:
 	if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
index 1f9d318..8449f45 100644
@@ -181,7 +181,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 			crtc = (struct drm_crtc *)minfo->crtcs[i];
 			if (crtc && crtc->base.id == info->mode_crtc.id) {
 				struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
-				ui32 = amdgpu_crtc->crtc_id;
+				ui32 = display_graphics_object_id_get_controller_id(amdgpu_crtc->crtc_object_id);
 				found = 1;
 				break;
 			}
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1 -1
index 96e1de8..5624c81 100644
@@ -368,7 +368,7 @@ struct amdgpu_atom_ss {
 
 struct amdgpu_crtc {
 	struct drm_crtc base;
-	int crtc_id;
+	struct graphics_object_id crtc_object_id;
 	u16 lut_r[256], lut_g[256], lut_b[256];
 	bool enabled;
 	bool can_tile;
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
index 6d44d4a..8bb3ced 100644
@@ -1162,7 +1162,7 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
 					    &ddev->mode_config.crtc_list, head) {
 				amdgpu_crtc = to_amdgpu_crtc(crtc);
 				if (crtc->enabled) {
-					adev->pm.dpm.new_active_crtcs |= (1 << amdgpu_crtc->crtc_id);
+					adev->pm.dpm.new_active_crtcs |= (1 << amdgpu_crtc->crtc_object_id.id);
 					adev->pm.dpm.new_active_crtc_count++;
 				}
 			}
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c +30 -25

188 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/atombios_crtc.h +1 -1
index 452245f..c10a570 100644
@@ -38,7 +38,7 @@ void amdgpu_atombios_crtc_set_dtd_timing(struct drm_crtc *crtc,
 void amdgpu_atombios_crtc_set_disp_eng_pll(struct amdgpu_device *adev,
 				    u32 dispclk);
 void amdgpu_atombios_crtc_program_pll(struct drm_crtc *crtc,
-			       u32 crtc_id,
+			       struct graphics_object_id crtc_object_id,
 			       int pll_id,
 			       u32 encoder_mode,
 			       struct graphics_object_id encoder_object_id,
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +4 -4
index 28d306a..9f7f3fc 100644
@@ -1307,7 +1307,7 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
 	uint8_t frev, crev;
 	struct amdgpu_encoder_atom_dig *dig;
 	enum encoder_id enc_id = display_graphics_object_id_get_encoder_id(amdgpu_encoder->encoder_object_id);
-
+	enum controller_id controller_id = display_graphics_object_id_get_controller_id(amdgpu_crtc->crtc_object_id);
 	memset(&args, 0, sizeof(args));
 
 	if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev))
@@ -1318,7 +1318,7 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
 		switch (crev) {
 		case 1:
 		default:
-			args.v1.ucCRTC = amdgpu_crtc->crtc_id;
+			args.v1.ucCRTC = controller_id;
 			switch (enc_id) {
 			case ENCODER_ID_INTERNAL_TMDS1:
 			case ENCODER_ID_INTERNAL_KLDSCP_TMDS1:
@@ -1357,7 +1357,7 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
 			}
 			break;
 		case 2:
-			args.v2.ucCRTC = amdgpu_crtc->crtc_id;
+			args.v2.ucCRTC = controller_id;
 			if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_ID_UNKNOWN) {
 				struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder);
 
@@ -1424,7 +1424,7 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
 			}
 			break;
 		case 3:
-			args.v3.ucCRTC = amdgpu_crtc->crtc_id;
+			args.v3.ucCRTC = controller_id;
 			if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_ID_UNKNOWN) {
 				struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder);
 
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +16 -15
index 993de0f..e2b22bf 100644
@@ -802,7 +802,7 @@ static u32 dce_v10_0_line_buffer_adjust(struct amdgpu_device *adev,
 				       struct drm_display_mode *mode)
 {
 	u32 tmp, buffer_alloc, i, mem_cfg;
-	u32 pipe_offset = amdgpu_crtc->crtc_id;
+	u32 pipe_offset = amdgpu_crtc->crtc_object_id.id;
 	/*
 	 * Line Buffer Setup
 	 * There are 6 line buffers, one for each display controllers.
@@ -1760,7 +1760,7 @@ static void dce_v10_0_audio_set_dto(struct drm_encoder *encoder, u32 clock)
 	 */
 	tmp = RREG32(mmDCCG_AUDIO_DTO_SOURCE);
 	tmp = REG_SET_FIELD(tmp, DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL,
-			    amdgpu_crtc->crtc_id);
+			    amdgpu_crtc->crtc_object_id.id);
 	WREG32(mmDCCG_AUDIO_DTO_SOURCE, tmp);
 	WREG32(mmDCCG_AUDIO_DTO0_PHASE, dto_phase);
 	WREG32(mmDCCG_AUDIO_DTO0_MODULE, dto_modulo);
@@ -2028,12 +2028,13 @@ static void dce_v10_0_vga_enable(struct drm_crtc *crtc, bool enable)
 	struct drm_device *dev = crtc->dev;
 	struct amdgpu_device *adev = dev->dev_private;
 	u32 vga_control;
+	enum controller_id controller_id = display_graphics_object_id_get_controller_id(amdgpu_crtc->crtc_object_id);
 
-	vga_control = RREG32(vga_control_regs[amdgpu_crtc->crtc_id]) & ~1;
+	vga_control = RREG32(vga_control_regs[controller_id]) & ~1;
 	if (enable)
-		WREG32(vga_control_regs[amdgpu_crtc->crtc_id], vga_control | 1);
+		WREG32(vga_control_regs[controller_id], vga_control | 1);
 	else
-		WREG32(vga_control_regs[amdgpu_crtc->crtc_id], vga_control);
+		WREG32(vga_control_regs[controller_id], vga_control);
 }
 
 static void dce_v10_0_grph_enable(struct drm_crtc *crtc, bool enable)
@@ -2312,7 +2313,7 @@ static void dce_v10_0_crtc_load_lut(struct drm_crtc *crtc)
 	int i;
 	u32 tmp;
 
-	DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id);
+	DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_object_id.id);
 
 	tmp = RREG32(mmINPUT_CSC_CONTROL + amdgpu_crtc->crtc_offset);
 	tmp = REG_SET_FIELD(tmp, INPUT_CSC_CONTROL, INPUT_CSC_GRPH_MODE, 0);
@@ -2590,7 +2591,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
 
 	obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
 	if (!obj) {
-		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id);
+		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_object_id.id);
 		return -ENOENT;
 	}
 
@@ -2708,16 +2709,16 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
 		amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
 		dce_v10_0_vga_enable(crtc, false);
 		/* Make sure VBLANK and PFLIP interrupts are still enabled */
-		type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
+		type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_object_id.id);
 		amdgpu_irq_update(adev, &adev->crtc_irq, type);
 		amdgpu_irq_update(adev, &adev->pageflip_irq, type);
-		drm_vblank_on(dev, amdgpu_crtc->crtc_id);
+		drm_vblank_on(dev, amdgpu_crtc->crtc_object_id.id);
 		dce_v10_0_crtc_load_lut(crtc);
 		break;
 	case DRM_MODE_DPMS_STANDBY:
 	case DRM_MODE_DPMS_SUSPEND:
 	case DRM_MODE_DPMS_OFF:
-		drm_vblank_off(dev, amdgpu_crtc->crtc_id);
+		drm_vblank_off(dev, amdgpu_crtc->crtc_object_id.id);
 		if (amdgpu_crtc->enabled) {
 			dce_v10_0_vga_enable(crtc, true);
 			amdgpu_atombios_crtc_blank(crtc, ATOM_ENABLE);
@@ -2777,7 +2778,7 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
 	for (i = 0; i < adev->mode_info.num_crtc; i++) {
 		if (adev->mode_info.crtcs[i] &&
 		    adev->mode_info.crtcs[i]->enabled &&
-		    i != amdgpu_crtc->crtc_id &&
+		    i != amdgpu_crtc->crtc_object_id.id &&
 		    amdgpu_crtc->pll_id == adev->mode_info.crtcs[i]->pll_id) {
 			/* one other crtc is using this pll don't turn
 			 * off the pll
@@ -2791,7 +2792,7 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
 	case ATOM_PPLL1:
 	case ATOM_PPLL2:
 		/* disable the ppll */
-		amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_id, amdgpu_crtc->pll_id,
+		amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_object_id, amdgpu_crtc->pll_id,
 					  0, DISPLAY_NO_OBJECT, ATOM_DISABLE, 0, 0, 0, 0, 0, false, &ss);
 		break;
 	default:
@@ -2899,7 +2900,7 @@ static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
 	drm_crtc_init(adev->ddev, &amdgpu_crtc->base, &dce_v10_0_crtc_funcs);
 
 	drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
-	amdgpu_crtc->crtc_id = index;
+	amdgpu_crtc->crtc_object_id = display_graphics_object_id_init(index, ENUM_ID_UNKNOWN, OBJECT_TYPE_CONTROLLER);
 	adev->mode_info.crtcs[index] = amdgpu_crtc;
 
 	amdgpu_crtc->max_cursor_width = 128;
@@ -2913,7 +2914,7 @@ static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
 		amdgpu_crtc->lut_b[i] = i << 2;
 	}
 
-	switch (amdgpu_crtc->crtc_id) {
+	switch (index) {
 	case 0:
 	default:
 		amdgpu_crtc->crtc_offset = CRTC0_REGISTER_OFFSET;
@@ -3375,7 +3376,7 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
 
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_object_id.id);
 	schedule_work(&works->unpin_work);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +16 -15
index b7edba9..a231679 100644
@@ -737,7 +737,7 @@ static u32 dce_v11_0_line_buffer_adjust(struct amdgpu_device *adev,
 				       struct drm_display_mode *mode)
 {
 	u32 tmp, buffer_alloc, i, mem_cfg;
-	u32 pipe_offset = amdgpu_crtc->crtc_id;
+	u32 pipe_offset = amdgpu_crtc->crtc_object_id.id;
 	/*
 	 * Line Buffer Setup
 	 * There are 6 line buffers, one for each display controllers.
@@ -1695,7 +1695,7 @@ static void dce_v11_0_audio_set_dto(struct drm_encoder *encoder, u32 clock)
 	 */
 	tmp = RREG32(mmDCCG_AUDIO_DTO_SOURCE);
 	tmp = REG_SET_FIELD(tmp, DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL,
-			    amdgpu_crtc->crtc_id);
+			    amdgpu_crtc->crtc_object_id.id);
 	WREG32(mmDCCG_AUDIO_DTO_SOURCE, tmp);
 	WREG32(mmDCCG_AUDIO_DTO0_PHASE, dto_phase);
 	WREG32(mmDCCG_AUDIO_DTO0_MODULE, dto_modulo);
@@ -1963,12 +1963,13 @@ static void dce_v11_0_vga_enable(struct drm_crtc *crtc, bool enable)
 	struct drm_device *dev = crtc->dev;
 	struct amdgpu_device *adev = dev->dev_private;
 	u32 vga_control;
+	enum controller_id controller_id = display_graphics_object_id_get_controller_id(amdgpu_crtc->crtc_object_id);
 
-	vga_control = RREG32(vga_control_regs[amdgpu_crtc->crtc_id]) & ~1;
+	vga_control = RREG32(vga_control_regs[controller_id]) & ~1;
 	if (enable)
-		WREG32(vga_control_regs[amdgpu_crtc->crtc_id], vga_control | 1);
+		WREG32(vga_control_regs[controller_id], vga_control | 1);
 	else
-		WREG32(vga_control_regs[amdgpu_crtc->crtc_id], vga_control);
+		WREG32(vga_control_regs[controller_id], vga_control);
 }
 
 static void dce_v11_0_grph_enable(struct drm_crtc *crtc, bool enable)
@@ -2247,7 +2248,7 @@ static void dce_v11_0_crtc_load_lut(struct drm_crtc *crtc)
 	int i;
 	u32 tmp;
 
-	DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id);
+	DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_object_id.id);
 
 	tmp = RREG32(mmINPUT_CSC_CONTROL + amdgpu_crtc->crtc_offset);
 	tmp = REG_SET_FIELD(tmp, INPUT_CSC_CONTROL, INPUT_CSC_GRPH_MODE, 0);
@@ -2527,7 +2528,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
 
 	obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
 	if (!obj) {
-		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id);
+		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_object_id.id);
 		return -ENOENT;
 	}
 
@@ -2645,16 +2646,16 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
 		amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
 		dce_v11_0_vga_enable(crtc, false);
 		/* Make sure VBLANK and PFLIP interrupts are still enabled */
-		type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
+		type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_object_id.id);
 		amdgpu_irq_update(adev, &adev->crtc_irq, type);
 		amdgpu_irq_update(adev, &adev->pageflip_irq, type);
-		drm_vblank_on(dev, amdgpu_crtc->crtc_id);
+		drm_vblank_on(dev, amdgpu_crtc->crtc_object_id.id);
 		dce_v11_0_crtc_load_lut(crtc);
 		break;
 	case DRM_MODE_DPMS_STANDBY:
 	case DRM_MODE_DPMS_SUSPEND:
 	case DRM_MODE_DPMS_OFF:
-		drm_vblank_off(dev, amdgpu_crtc->crtc_id);
+		drm_vblank_off(dev, amdgpu_crtc->crtc_object_id.id);
 		if (amdgpu_crtc->enabled) {
 			dce_v11_0_vga_enable(crtc, true);
 			amdgpu_atombios_crtc_blank(crtc, ATOM_ENABLE);
@@ -2714,7 +2715,7 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
 	for (i = 0; i < adev->mode_info.num_crtc; i++) {
 		if (adev->mode_info.crtcs[i] &&
 		    adev->mode_info.crtcs[i]->enabled &&
-		    i != amdgpu_crtc->crtc_id &&
+		    i != amdgpu_crtc->crtc_object_id.id &&
 		    amdgpu_crtc->pll_id == adev->mode_info.crtcs[i]->pll_id) {
 			/* one other crtc is using this pll don't turn
 			 * off the pll
@@ -2728,7 +2729,7 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
 	case ATOM_PPLL1:
 	case ATOM_PPLL2:
 		/* disable the ppll */
-		amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_id, amdgpu_crtc->pll_id,
+		amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_object_id, amdgpu_crtc->pll_id,
 					  0, DISPLAY_NO_OBJECT, ATOM_DISABLE, 0, 0, 0, 0, 0, false, &ss);
 		break;
 	default:
@@ -2836,7 +2837,7 @@ static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
 	drm_crtc_init(adev->ddev, &amdgpu_crtc->base, &dce_v11_0_crtc_funcs);
 
 	drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
-	amdgpu_crtc->crtc_id = index;
+	amdgpu_crtc->crtc_object_id = display_graphics_object_id_init(index, ENUM_ID_UNKNOWN, OBJECT_TYPE_CONTROLLER);
 	adev->mode_info.crtcs[index] = amdgpu_crtc;
 
 	amdgpu_crtc->max_cursor_width = 128;
@@ -2850,7 +2851,7 @@ static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
 		amdgpu_crtc->lut_b[i] = i << 2;
 	}
 
-	switch (amdgpu_crtc->crtc_id) {
+	switch (index) {
 	case 0:
 	default:
 		amdgpu_crtc->crtc_offset = CRTC0_REGISTER_OFFSET;
@@ -3317,7 +3318,7 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
 
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_object_id.id);
 	schedule_work(&works->unpin_work);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +17 -16
index f46991b..6a53cde 100644
@@ -747,7 +747,7 @@ static u32 dce_v8_0_line_buffer_adjust(struct amdgpu_device *adev,
 				       struct drm_display_mode *mode)
 {
 	u32 tmp, buffer_alloc, i;
-	u32 pipe_offset = amdgpu_crtc->crtc_id * 0x8;
+	u32 pipe_offset = amdgpu_crtc->crtc_object_id.id * 0x8;
 	/*
 	 * Line Buffer Setup
 	 * There are 6 line buffers, one for each display controllers.
@@ -1716,7 +1716,7 @@ static void dce_v8_0_audio_set_dto(struct drm_encoder *encoder, u32 clock)
 	 * number (coefficient of two integer numbers.  DCCG_AUDIO_DTOx_PHASE
 	 * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator
 	 */
-	WREG32(mmDCCG_AUDIO_DTO_SOURCE, (amdgpu_crtc->crtc_id << DCCG_AUDIO_DTO_SOURCE__DCCG_AUDIO_DTO0_SOURCE_SEL__SHIFT));
+	WREG32(mmDCCG_AUDIO_DTO_SOURCE, (amdgpu_crtc->crtc_object_id.id << DCCG_AUDIO_DTO_SOURCE__DCCG_AUDIO_DTO0_SOURCE_SEL__SHIFT));
 	WREG32(mmDCCG_AUDIO_DTO0_PHASE, dto_phase);
 	WREG32(mmDCCG_AUDIO_DTO0_MODULE, dto_modulo);
 }
@@ -1965,12 +1965,13 @@ static void dce_v8_0_vga_enable(struct drm_crtc *crtc, bool enable)
 	struct drm_device *dev = crtc->dev;
 	struct amdgpu_device *adev = dev->dev_private;
 	u32 vga_control;
+	enum controller_id controller_id = display_graphics_object_id_get_controller_id(amdgpu_crtc->crtc_object_id);
 
-	vga_control = RREG32(vga_control_regs[amdgpu_crtc->crtc_id]) & ~1;
+	vga_control = RREG32(vga_control_regs[controller_id]) & ~1;
 	if (enable)
-		WREG32(vga_control_regs[amdgpu_crtc->crtc_id], vga_control | 1);
+		WREG32(vga_control_regs[controller_id], vga_control | 1);
 	else
-		WREG32(vga_control_regs[amdgpu_crtc->crtc_id], vga_control);
+		WREG32(vga_control_regs[controller_id], vga_control);
 }
 
 static void dce_v8_0_grph_enable(struct drm_crtc *crtc, bool enable)
@@ -2229,7 +2230,7 @@ static void dce_v8_0_crtc_load_lut(struct drm_crtc *crtc)
 	struct amdgpu_device *adev = dev->dev_private;
 	int i;
 
-	DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id);
+	DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_object_id.id);
 
 	WREG32(mmINPUT_CSC_CONTROL + amdgpu_crtc->crtc_offset,
 	       ((INPUT_CSC_BYPASS << INPUT_CSC_CONTROL__INPUT_CSC_GRPH_MODE__SHIFT) |
@@ -2502,7 +2503,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
 
 	obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
 	if (!obj) {
-		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id);
+		DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_object_id.id);
 		return -ENOENT;
 	}
 
@@ -2620,16 +2621,16 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
 		amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
 		dce_v8_0_vga_enable(crtc, false);
 		/* Make sure VBLANK and PFLIP interrupts are still enabled */
-		type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
+		type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_object_id.id);
 		amdgpu_irq_update(adev, &adev->crtc_irq, type);
 		amdgpu_irq_update(adev, &adev->pageflip_irq, type);
-		drm_vblank_on(dev, amdgpu_crtc->crtc_id);
+		drm_vblank_on(dev, amdgpu_crtc->crtc_object_id.id);
 		dce_v8_0_crtc_load_lut(crtc);
 		break;
 	case DRM_MODE_DPMS_STANDBY:
 	case DRM_MODE_DPMS_SUSPEND:
 	case DRM_MODE_DPMS_OFF:
-		drm_vblank_off(dev, amdgpu_crtc->crtc_id);
+		drm_vblank_off(dev, amdgpu_crtc->crtc_object_id.id);
 		if (amdgpu_crtc->enabled) {
 			dce_v8_0_vga_enable(crtc, true);
 			amdgpu_atombios_crtc_blank(crtc, ATOM_ENABLE);
@@ -2689,7 +2690,7 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
 	for (i = 0; i < adev->mode_info.num_crtc; i++) {
 		if (adev->mode_info.crtcs[i] &&
 		    adev->mode_info.crtcs[i]->enabled &&
-		    i != amdgpu_crtc->crtc_id &&
+		    i != amdgpu_crtc->crtc_object_id.id &&
 		    amdgpu_crtc->pll_id == adev->mode_info.crtcs[i]->pll_id) {
 			/* one other crtc is using this pll don't turn
 			 * off the pll
@@ -2702,7 +2703,7 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
 	case ATOM_PPLL1:
 	case ATOM_PPLL2:
 		/* disable the ppll */
-		amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_id, amdgpu_crtc->pll_id,
+		amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_object_id, amdgpu_crtc->pll_id,
 						 0, DISPLAY_NO_OBJECT, ATOM_DISABLE, 0, 0, 0, 0, 0, false, &ss);
 		break;
 	case ATOM_PPLL0:
@@ -2710,7 +2711,7 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
 		if ((adev->asic_type == CHIP_KAVERI) ||
 		    (adev->asic_type == CHIP_BONAIRE) ||
 		    (adev->asic_type == CHIP_HAWAII))
-			amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_id, amdgpu_crtc->pll_id,
+			amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_object_id, amdgpu_crtc->pll_id,
 							 0, DISPLAY_NO_OBJECT, ATOM_DISABLE, 0, 0, 0, 0, 0, false, &ss);
 		break;
 	default:
@@ -2818,7 +2819,7 @@ static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
 	drm_crtc_init(adev->ddev, &amdgpu_crtc->base, &dce_v8_0_crtc_funcs);
 
 	drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256);
-	amdgpu_crtc->crtc_id = index;
+	amdgpu_crtc->crtc_object_id = display_graphics_object_id_init(index, ENUM_ID_UNKNOWN, OBJECT_TYPE_CONTROLLER);
 	adev->mode_info.crtcs[index] = amdgpu_crtc;
 
 	amdgpu_crtc->max_cursor_width = CIK_CURSOR_WIDTH;
@@ -2832,7 +2833,7 @@ static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
 		amdgpu_crtc->lut_b[i] = i << 2;
 	}
 
-	amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id];
+	amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_object_id.id];
 
 	amdgpu_crtc->pll_id = ATOM_PPLL_INVALID;
 	amdgpu_crtc->adjusted_clock = 0;
@@ -3384,7 +3385,7 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
 
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_object_id.id);
 	schedule_work(&works->unpin_work);
 
 	return 0;
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw
In reply to Dave Airlie

Am 14.04.2016 um 04:56 schrieb Dave Airlie:

Quoted 7 lines

DAL has a concept of storing the graphics object ids in a special small struct, and adding type safety to them.

I'm starting to contemplate bringing some pieces of DAL into the mainline modesetting code (like the bios parser for a start), and I think this is the best first step in that direction.

Quoted 7 lines

This series converts connectors, encoders and crtcs id to the DAL objects. I haven't done PLLs yet they are a bit messier and I probably need to think about them a bit more.

Also DAL doesn't support any of the DVO/external encoders, I've no idea if they even exist on DCE8 or newer GPUs, so I've done a separate patch to drop them.

I'm not so deep into the display engine stuff or DAL, but this looks like a good start to me to better integrate some of the DAL code into the existing code base.

So the patches are Acked-by: Christian König <[email protected]>.

I will ask around about the DVO stuff. Let me know if you need anything else while Alex is still asleep.

Regards,
Christian.

Quoted 6 lines

Dave.

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

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

#7 lore raw

Re: [PATCH 5/7] [RFC] drm/amdgpu: drop DVO encoders support.

In reply to Dave Airlie

DVO was mainly used for crossfire pre-DCE 8, and possibly on some DCE 8 (Tonga) SKUs as well. On newer ASICs crossfire uses XDMA so there's no longer a need for DVO.

It's probably safe to drop it for amdgpu. Radeon driver might still want to keep it if there's support for it.

Harry

Quoted 265 lines · Dave Airlie

From: Dave Airlie <[email protected]>

I'm a bit confused whether this is needed so it would be good to confirm if hw shipped with it.

DAL as currently is doesn't have any support for this, it doesn't have any encoder ids for DVO that I can see.

So before porting to DAL graphics objects, I'm removing this code, so we can see if any regressions land here.

---
  drivers/gpu/drm/amd/amdgpu/atombios_crtc.c     |   3 -
  drivers/gpu/drm/amd/amdgpu/atombios_encoders.c | 100 -------------------------
  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c         |   8 --
  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c         |   8 --
  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c          |   8 --
  5 files changed, 127 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c +0 -3
index 49aa350..072a729 100644
@@ -344,9 +344,6 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc *crtc,
  		}
  	}
 
-	/* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
-	if (amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
-		adjusted_clock = mode->clock * 2;
  	if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
  		amdgpu_crtc->pll_flags |= AMDGPU_PLL_PREFER_CLOSEST_LOWER;
  	if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +0 -100
index 4367941..7ef93c6 100644
@@ -272,7 +272,6 @@ bool amdgpu_atombios_encoder_is_digital(struct drm_encoder *encoder)
  {
  	struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
  	switch (amdgpu_encoder->encoder_id) {
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -369,79 +368,8 @@ static u8 amdgpu_atombios_encoder_get_bpc(struct drm_encoder *encoder)
  	}
  }
 
-union dvo_encoder_control {
-	ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION ext_tmds;
-	DVO_ENCODER_CONTROL_PS_ALLOCATION dvo;
-	DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 dvo_v3;
-	DVO_ENCODER_CONTROL_PS_ALLOCATION_V1_4 dvo_v4;
-};
-
-static void
-amdgpu_atombios_encoder_setup_dvo(struct drm_encoder *encoder, int action)
-{
-	struct drm_device *dev = encoder->dev;
-	struct amdgpu_device *adev = dev->dev_private;
-	struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
-	union dvo_encoder_control args;
-	int index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl);
-	uint8_t frev, crev;
-
-	memset(&args, 0, sizeof(args));
-
-	if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev))
-		return;
-
-	switch (frev) {
-	case 1:
-		switch (crev) {
-		case 1:
-			/* R4xx, R5xx */
-			args.ext_tmds.sXTmdsEncoder.ucEnable = action;
-
-			if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock))
-				args.ext_tmds.sXTmdsEncoder.ucMisc |= PANEL_ENCODER_MISC_DUAL;
-
-			args.ext_tmds.sXTmdsEncoder.ucMisc |= ATOM_PANEL_MISC_888RGB;
-			break;
-		case 2:
-			/* RS600/690/740 */
-			args.dvo.sDVOEncoder.ucAction = action;
-			args.dvo.sDVOEncoder.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
-			/* DFP1, CRT1, TV1 depending on the type of port */
-			args.dvo.sDVOEncoder.ucDeviceType = ATOM_DEVICE_DFP1_INDEX;
-
-			if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock))
-				args.dvo.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute |= PANEL_ENCODER_MISC_DUAL;
-			break;
-		case 3:
-			/* R6xx */
-			args.dvo_v3.ucAction = action;
-			args.dvo_v3.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
-			args.dvo_v3.ucDVOConfig = 0; /* XXX */
-			break;
-		case 4:
-			/* DCE8 */
-			args.dvo_v4.ucAction = action;
-			args.dvo_v4.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
-			args.dvo_v4.ucDVOConfig = 0; /* XXX */
-			args.dvo_v4.ucBitPerColor = amdgpu_atombios_encoder_get_bpc(encoder);
-			break;
-		default:
-			DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
-			break;
-		}
-		break;
-	default:
-		DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
-		break;
-	}
-
-	amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args);
-}
-
  int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder)
  {
-	struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
  	struct drm_connector *connector;
  	struct amdgpu_connector *amdgpu_connector;
  	struct amdgpu_connector_atom_dig *dig_connector;
@@ -450,11 +378,6 @@ int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder)
  	if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)
  		return ATOM_ENCODER_MODE_DP;
 
-	/* DVO is always DVO */
-	if ((amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DVO1) ||
-	    (amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1))
-		return ATOM_ENCODER_MODE_DVO;
-
  	connector = amdgpu_get_connector_for_encoder(encoder);
  	/* if we don't have an active device yet, just use one of
  	 * the connectors tied to the encoder.
@@ -768,9 +691,6 @@ amdgpu_atombios_encoder_setup_dig_transmitter(struct drm_encoder *encoder, int a
  	memset(&args, 0, sizeof(args));
 
  	switch (amdgpu_encoder->encoder_id) {
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
-		index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl);
-		break;
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -1332,18 +1252,6 @@ amdgpu_atombios_encoder_dpms(struct drm_encoder *encoder, int mode)
  			break;
  		}
  		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
-		switch (mode) {
-		case DRM_MODE_DPMS_ON:
-			amdgpu_atombios_encoder_setup_dvo(encoder, ATOM_ENABLE);
-			break;
-		case DRM_MODE_DPMS_STANDBY:
-		case DRM_MODE_DPMS_SUSPEND:
-		case DRM_MODE_DPMS_OFF:
-			amdgpu_atombios_encoder_setup_dvo(encoder, ATOM_DISABLE);
-			break;
-		}
-		break;
  	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
  		switch (mode) {
  		case DRM_MODE_DPMS_ON:
@@ -1402,9 +1310,7 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
  				else
  					args.v1.ucDevice = ATOM_DEVICE_DFP3_INDEX;
  				break;
-			case ENCODER_OBJECT_ID_INTERNAL_DVO1:
  			case ENCODER_OBJECT_ID_INTERNAL_DDI:
-			case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
  				args.v1.ucDevice = ATOM_DEVICE_DFP2_INDEX;
  				break;
  			case ENCODER_OBJECT_ID_INTERNAL_DAC1:
@@ -1474,9 +1380,6 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
  					break;
  				}
  				break;
-			case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
-				args.v2.ucEncoderID = ASIC_INT_DVO_ENCODER_ID;
-				break;
  			case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
  				if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
  					args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
@@ -1543,9 +1446,6 @@ amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder)
  					break;
  				}
  				break;
-			case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
-				args.v3.ucEncoderID = ASIC_INT_DVO_ENCODER_ID;
-				break;
  			case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
  				if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
  					args.v3.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +0 -8
index 6de2ce53..90dc73b 100644
@@ -3733,7 +3733,6 @@ static void dce_v10_0_encoder_add(struct amdgpu_device *adev,
  				 DRM_MODE_ENCODER_DAC, NULL);
  		drm_encoder_helper_add(encoder, &dce_v10_0_dac_helper_funcs);
  		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -3754,13 +3753,6 @@ static void dce_v10_0_encoder_add(struct amdgpu_device *adev,
  		}
  		drm_encoder_helper_add(encoder, &dce_v10_0_dig_helper_funcs);
  		break;
-	case ENCODER_OBJECT_ID_SI170B:
-	case ENCODER_OBJECT_ID_CH7303:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOA:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOB:
-	case ENCODER_OBJECT_ID_TITFP513:
-	case ENCODER_OBJECT_ID_VT1623:
-	case ENCODER_OBJECT_ID_HDMI_SI1930:
  	case ENCODER_OBJECT_ID_TRAVIS:
  	case ENCODER_OBJECT_ID_NUTMEG:
  		/* these are handled by the primary encoders */
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +0 -8
index 89aab0a..d3c9fb7 100644
@@ -3674,7 +3674,6 @@ static void dce_v11_0_encoder_add(struct amdgpu_device *adev,
  				 DRM_MODE_ENCODER_DAC, NULL);
  		drm_encoder_helper_add(encoder, &dce_v11_0_dac_helper_funcs);
  		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -3695,13 +3694,6 @@ static void dce_v11_0_encoder_add(struct amdgpu_device *adev,
  		}
  		drm_encoder_helper_add(encoder, &dce_v11_0_dig_helper_funcs);
  		break;
-	case ENCODER_OBJECT_ID_SI170B:
-	case ENCODER_OBJECT_ID_CH7303:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOA:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOB:
-	case ENCODER_OBJECT_ID_TITFP513:
-	case ENCODER_OBJECT_ID_VT1623:
-	case ENCODER_OBJECT_ID_HDMI_SI1930:
  	case ENCODER_OBJECT_ID_TRAVIS:
  	case ENCODER_OBJECT_ID_NUTMEG:
  		/* these are handled by the primary encoders */
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +0 -1
index e56b55d..ddb8eba 100644
@@ -3663,7 +3663,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev,
  				 DRM_MODE_ENCODER_DAC, NULL);
  		drm_encoder_helper_add(encoder, &dce_v8_0_dac_helper_funcs);
  		break;
-	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
  	case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -3684,13 +3683,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev,
  		}
  		drm_encoder_helper_add(encoder, &dce_v8_0_dig_helper_funcs);
  		break;

drivers/gpu/drm/amd/amdgpu/dce_v8_0.c static void dce_v8_0_encoder_add(struct amdgpu_device *adev, · line 3688

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +0 -7
-	case ENCODER_OBJECT_ID_SI170B:
-	case ENCODER_OBJECT_ID_CH7303:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOA:
-	case ENCODER_OBJECT_ID_EXTERNAL_SDVOB:
-	case ENCODER_OBJECT_ID_TITFP513:
-	case ENCODER_OBJECT_ID_VT1623:
-	case ENCODER_OBJECT_ID_HDMI_SI1930:
  	case ENCODER_OBJECT_ID_TRAVIS:
  	case ENCODER_OBJECT_ID_NUTMEG:
  		/* these are handled by the primary encoders */

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

Reviewed-by
#11 lore raw
In reply to Christian König

Makes sense to me.

Harry

Quoted 32 lines · Christian König

Am 14.04.2016 um 04:56 schrieb Dave Airlie:

Quoted 7 lines

DAL has a concept of storing the graphics object ids in a special small struct, and adding type safety to them.

I'm starting to contemplate bringing some pieces of DAL into the mainline modesetting code (like the bios parser for a start), and I think this is the best first step in that direction.

Quoted 7 lines

This series converts connectors, encoders and crtcs id to the DAL objects. I haven't done PLLs yet they are a bit messier and I probably need to think about them a bit more.

Also DAL doesn't support any of the DVO/external encoders, I've no idea if they even exist on DCE8 or newer GPUs, so I've done a separate patch to drop them.

I'm not so deep into the display engine stuff or DAL, but this looks like a good start to me to better integrate some of the DAL code into the existing code base.

So the patches are Acked-by: Christian König <[email protected]>.

I will ask around about the DVO stuff. Let me know if you need anything else while Alex is still asleep.

Regards,
Christian.

Quoted 6 lines

Dave.

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

Quoted 4 lines

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

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

#4 lore raw

Re: [PATCH 3/7] drm/amdgpu: introduce graphics object id helpers.

In reply to Dave Airlie

Hi Dave,

Quoted 36 lines · Dave Airlie
drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c new file +36 -0
+static enum connector_id connector_id_from_bios_object_id(uint32_t bios_object_id)
+{
+       uint32_t bios_connector_id = gpu_id_from_bios_object_id(bios_object_id);
+
+       enum connector_id id;
+
+       switch (bios_connector_id) {
+       case CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I:
+               id = CONNECTOR_ID_SINGLE_LINK_DVII;
+               break;
+       case CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I:
+               id = CONNECTOR_ID_DUAL_LINK_DVII;
+               break;
+       case CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D:
+               id = CONNECTOR_ID_SINGLE_LINK_DVID;
+               break;
+       case CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D:
+               id = CONNECTOR_ID_DUAL_LINK_DVID;
+               break;
+       case CONNECTOR_OBJECT_ID_VGA:
+               id = CONNECTOR_ID_VGA;
+               break;
+       case CONNECTOR_OBJECT_ID_HDMI_TYPE_A:
+               id = CONNECTOR_ID_HDMI_TYPE_A;
+               break;
+       case CONNECTOR_OBJECT_ID_LVDS:
+               id = CONNECTOR_ID_LVDS;
+               break;
+       case CONNECTOR_OBJECT_ID_PCIE_CONNECTOR:
+               id = CONNECTOR_ID_PCIE;
+               break;
+       case CONNECTOR_OBJECT_ID_HARDCODE_DVI:
+               id = CONNECTOR_ID_HARDCODE_DVI;
+               break;
+       case CONNECTOR_OBJECT_ID_DISPLAYPORT:
+               id = CONNECTOR_ID_DISPLAY_PORT;

drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c line 82

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c new file +10 -0
+               break;
+       case CONNECTOR_OBJECT_ID_eDP:
+               id = CONNECTOR_ID_EDP;
+               break;
+       case CONNECTOR_OBJECT_ID_MXM:
+               id = CONNECTOR_ID_MXM;
+               break;
+       default:
+               id = CONNECTOR_ID_UNKNOWN;
+               break;

One could move all the new mappings (meaning - here and follow up patches) to static const table(s), saving a wee bit of space ;-)

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