From: Dave Airlie <airlied@xxxxxxxxxx> 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. Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx> --- 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(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index a7a53ac..0e54f4a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -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)) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c index 3b469ea..5f236d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c @@ -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); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 60a0c9a..765309e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -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; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h index 61fcef1..70b2663 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h @@ -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); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c index 94138ab..574e9cb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c @@ -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 */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index adf10c9..33284c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h @@ -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; diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c index bf731e9..29d698b 100644 --- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c +++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c @@ -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) diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c index 1e0bba2..4367941 100644 --- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c @@ -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)); -- 2.5.5 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel