| .. | .. |
|---|
| 20 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
|---|
| 21 | 21 | * |
|---|
| 22 | 22 | */ |
|---|
| 23 | | -#include <drm/drmP.h> |
|---|
| 23 | + |
|---|
| 24 | +#include <linux/pci.h> |
|---|
| 25 | + |
|---|
| 26 | +#include <drm/drm_fourcc.h> |
|---|
| 27 | +#include <drm/drm_vblank.h> |
|---|
| 28 | + |
|---|
| 24 | 29 | #include "amdgpu.h" |
|---|
| 25 | 30 | #include "amdgpu_pm.h" |
|---|
| 26 | 31 | #include "amdgpu_i2c.h" |
|---|
| .. | .. |
|---|
| 30 | 35 | #include "atombios_encoders.h" |
|---|
| 31 | 36 | #include "amdgpu_pll.h" |
|---|
| 32 | 37 | #include "amdgpu_connectors.h" |
|---|
| 38 | +#include "amdgpu_display.h" |
|---|
| 33 | 39 | |
|---|
| 34 | 40 | #include "bif/bif_3_0_d.h" |
|---|
| 35 | 41 | #include "bif/bif_3_0_sh_mask.h" |
|---|
| .. | .. |
|---|
| 185 | 191 | int crtc_id, u64 crtc_base, bool async) |
|---|
| 186 | 192 | { |
|---|
| 187 | 193 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; |
|---|
| 194 | + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; |
|---|
| 188 | 195 | |
|---|
| 189 | 196 | /* flip at hsync for async, default is vsync */ |
|---|
| 190 | 197 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ? |
|---|
| 191 | 198 | GRPH_FLIP_CONTROL__GRPH_SURFACE_UPDATE_H_RETRACE_EN_MASK : 0); |
|---|
| 199 | + /* update pitch */ |
|---|
| 200 | + WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset, |
|---|
| 201 | + fb->pitches[0] / fb->format->cpp[0]); |
|---|
| 192 | 202 | /* update the scanout addresses */ |
|---|
| 193 | 203 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
|---|
| 194 | 204 | upper_32_bits(crtc_base)); |
|---|
| .. | .. |
|---|
| 269 | 279 | */ |
|---|
| 270 | 280 | static void dce_v6_0_hpd_init(struct amdgpu_device *adev) |
|---|
| 271 | 281 | { |
|---|
| 272 | | - struct drm_device *dev = adev->ddev; |
|---|
| 282 | + struct drm_device *dev = adev_to_drm(adev); |
|---|
| 273 | 283 | struct drm_connector *connector; |
|---|
| 284 | + struct drm_connector_list_iter iter; |
|---|
| 274 | 285 | u32 tmp; |
|---|
| 275 | 286 | |
|---|
| 276 | | - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
|---|
| 287 | + drm_connector_list_iter_begin(dev, &iter); |
|---|
| 288 | + drm_for_each_connector_iter(connector, &iter) { |
|---|
| 277 | 289 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 278 | 290 | |
|---|
| 279 | 291 | if (amdgpu_connector->hpd.hpd >= adev->mode_info.num_hpd) |
|---|
| .. | .. |
|---|
| 299 | 311 | dce_v6_0_hpd_set_polarity(adev, amdgpu_connector->hpd.hpd); |
|---|
| 300 | 312 | amdgpu_irq_get(adev, &adev->hpd_irq, amdgpu_connector->hpd.hpd); |
|---|
| 301 | 313 | } |
|---|
| 302 | | - |
|---|
| 314 | + drm_connector_list_iter_end(&iter); |
|---|
| 303 | 315 | } |
|---|
| 304 | 316 | |
|---|
| 305 | 317 | /** |
|---|
| .. | .. |
|---|
| 312 | 324 | */ |
|---|
| 313 | 325 | static void dce_v6_0_hpd_fini(struct amdgpu_device *adev) |
|---|
| 314 | 326 | { |
|---|
| 315 | | - struct drm_device *dev = adev->ddev; |
|---|
| 327 | + struct drm_device *dev = adev_to_drm(adev); |
|---|
| 316 | 328 | struct drm_connector *connector; |
|---|
| 329 | + struct drm_connector_list_iter iter; |
|---|
| 317 | 330 | u32 tmp; |
|---|
| 318 | 331 | |
|---|
| 319 | | - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
|---|
| 332 | + drm_connector_list_iter_begin(dev, &iter); |
|---|
| 333 | + drm_for_each_connector_iter(connector, &iter) { |
|---|
| 320 | 334 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 321 | 335 | |
|---|
| 322 | 336 | if (amdgpu_connector->hpd.hpd >= adev->mode_info.num_hpd) |
|---|
| .. | .. |
|---|
| 328 | 342 | |
|---|
| 329 | 343 | amdgpu_irq_put(adev, &adev->hpd_irq, amdgpu_connector->hpd.hpd); |
|---|
| 330 | 344 | } |
|---|
| 345 | + drm_connector_list_iter_end(&iter); |
|---|
| 331 | 346 | } |
|---|
| 332 | 347 | |
|---|
| 333 | 348 | static u32 dce_v6_0_hpd_get_gpio_reg(struct amdgpu_device *adev) |
|---|
| .. | .. |
|---|
| 386 | 401 | { |
|---|
| 387 | 402 | |
|---|
| 388 | 403 | struct drm_device *dev = encoder->dev; |
|---|
| 389 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 404 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 390 | 405 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 391 | 406 | struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); |
|---|
| 392 | 407 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(encoder->crtc); |
|---|
| .. | .. |
|---|
| 1099 | 1114 | |
|---|
| 1100 | 1115 | static void dce_v6_0_audio_select_pin(struct drm_encoder *encoder) |
|---|
| 1101 | 1116 | { |
|---|
| 1102 | | - struct amdgpu_device *adev = encoder->dev->dev_private; |
|---|
| 1117 | + struct amdgpu_device *adev = drm_to_adev(encoder->dev); |
|---|
| 1103 | 1118 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1104 | 1119 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1105 | 1120 | |
|---|
| .. | .. |
|---|
| 1114 | 1129 | static void dce_v6_0_audio_write_latency_fields(struct drm_encoder *encoder, |
|---|
| 1115 | 1130 | struct drm_display_mode *mode) |
|---|
| 1116 | 1131 | { |
|---|
| 1117 | | - struct amdgpu_device *adev = encoder->dev->dev_private; |
|---|
| 1132 | + struct drm_device *dev = encoder->dev; |
|---|
| 1133 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1118 | 1134 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1119 | 1135 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1120 | 1136 | struct drm_connector *connector; |
|---|
| 1137 | + struct drm_connector_list_iter iter; |
|---|
| 1121 | 1138 | struct amdgpu_connector *amdgpu_connector = NULL; |
|---|
| 1122 | 1139 | int interlace = 0; |
|---|
| 1123 | 1140 | u32 tmp; |
|---|
| 1124 | 1141 | |
|---|
| 1125 | | - list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
|---|
| 1142 | + drm_connector_list_iter_begin(dev, &iter); |
|---|
| 1143 | + drm_for_each_connector_iter(connector, &iter) { |
|---|
| 1126 | 1144 | if (connector->encoder == encoder) { |
|---|
| 1127 | 1145 | amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 1128 | 1146 | break; |
|---|
| 1129 | 1147 | } |
|---|
| 1130 | 1148 | } |
|---|
| 1149 | + drm_connector_list_iter_end(&iter); |
|---|
| 1131 | 1150 | |
|---|
| 1132 | 1151 | if (!amdgpu_connector) { |
|---|
| 1133 | 1152 | DRM_ERROR("Couldn't find encoder's connector\n"); |
|---|
| .. | .. |
|---|
| 1154 | 1173 | |
|---|
| 1155 | 1174 | static void dce_v6_0_audio_write_speaker_allocation(struct drm_encoder *encoder) |
|---|
| 1156 | 1175 | { |
|---|
| 1157 | | - struct amdgpu_device *adev = encoder->dev->dev_private; |
|---|
| 1176 | + struct drm_device *dev = encoder->dev; |
|---|
| 1177 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1158 | 1178 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1159 | 1179 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1160 | 1180 | struct drm_connector *connector; |
|---|
| 1181 | + struct drm_connector_list_iter iter; |
|---|
| 1161 | 1182 | struct amdgpu_connector *amdgpu_connector = NULL; |
|---|
| 1162 | 1183 | u8 *sadb = NULL; |
|---|
| 1163 | 1184 | int sad_count; |
|---|
| 1164 | 1185 | u32 tmp; |
|---|
| 1165 | 1186 | |
|---|
| 1166 | | - list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
|---|
| 1187 | + drm_connector_list_iter_begin(dev, &iter); |
|---|
| 1188 | + drm_for_each_connector_iter(connector, &iter) { |
|---|
| 1167 | 1189 | if (connector->encoder == encoder) { |
|---|
| 1168 | 1190 | amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 1169 | 1191 | break; |
|---|
| 1170 | 1192 | } |
|---|
| 1171 | 1193 | } |
|---|
| 1194 | + drm_connector_list_iter_end(&iter); |
|---|
| 1172 | 1195 | |
|---|
| 1173 | 1196 | if (!amdgpu_connector) { |
|---|
| 1174 | 1197 | DRM_ERROR("Couldn't find encoder's connector\n"); |
|---|
| .. | .. |
|---|
| 1211 | 1234 | |
|---|
| 1212 | 1235 | static void dce_v6_0_audio_write_sad_regs(struct drm_encoder *encoder) |
|---|
| 1213 | 1236 | { |
|---|
| 1214 | | - struct amdgpu_device *adev = encoder->dev->dev_private; |
|---|
| 1237 | + struct drm_device *dev = encoder->dev; |
|---|
| 1238 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1215 | 1239 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1216 | 1240 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1217 | 1241 | struct drm_connector *connector; |
|---|
| 1242 | + struct drm_connector_list_iter iter; |
|---|
| 1218 | 1243 | struct amdgpu_connector *amdgpu_connector = NULL; |
|---|
| 1219 | 1244 | struct cea_sad *sads; |
|---|
| 1220 | 1245 | int i, sad_count; |
|---|
| .. | .. |
|---|
| 1234 | 1259 | { ixAZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR13, HDMI_AUDIO_CODING_TYPE_WMA_PRO }, |
|---|
| 1235 | 1260 | }; |
|---|
| 1236 | 1261 | |
|---|
| 1237 | | - list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
|---|
| 1262 | + drm_connector_list_iter_begin(dev, &iter); |
|---|
| 1263 | + drm_for_each_connector_iter(connector, &iter) { |
|---|
| 1238 | 1264 | if (connector->encoder == encoder) { |
|---|
| 1239 | 1265 | amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 1240 | 1266 | break; |
|---|
| 1241 | 1267 | } |
|---|
| 1242 | 1268 | } |
|---|
| 1269 | + drm_connector_list_iter_end(&iter); |
|---|
| 1243 | 1270 | |
|---|
| 1244 | 1271 | if (!amdgpu_connector) { |
|---|
| 1245 | 1272 | DRM_ERROR("Couldn't find encoder's connector\n"); |
|---|
| .. | .. |
|---|
| 1247 | 1274 | } |
|---|
| 1248 | 1275 | |
|---|
| 1249 | 1276 | sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads); |
|---|
| 1250 | | - if (sad_count <= 0) { |
|---|
| 1277 | + if (sad_count < 0) |
|---|
| 1251 | 1278 | DRM_ERROR("Couldn't read SADs: %d\n", sad_count); |
|---|
| 1279 | + if (sad_count <= 0) |
|---|
| 1252 | 1280 | return; |
|---|
| 1253 | | - } |
|---|
| 1254 | 1281 | |
|---|
| 1255 | 1282 | for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) { |
|---|
| 1256 | 1283 | u32 tmp = 0; |
|---|
| .. | .. |
|---|
| 1365 | 1392 | static void dce_v6_0_audio_set_vbi_packet(struct drm_encoder *encoder) |
|---|
| 1366 | 1393 | { |
|---|
| 1367 | 1394 | struct drm_device *dev = encoder->dev; |
|---|
| 1368 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1395 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1369 | 1396 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1370 | 1397 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1371 | 1398 | u32 tmp; |
|---|
| .. | .. |
|---|
| 1381 | 1408 | uint32_t clock, int bpc) |
|---|
| 1382 | 1409 | { |
|---|
| 1383 | 1410 | struct drm_device *dev = encoder->dev; |
|---|
| 1384 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1411 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1385 | 1412 | struct amdgpu_afmt_acr acr = amdgpu_afmt_acr(clock); |
|---|
| 1386 | 1413 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1387 | 1414 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| .. | .. |
|---|
| 1419 | 1446 | struct drm_display_mode *mode) |
|---|
| 1420 | 1447 | { |
|---|
| 1421 | 1448 | struct drm_device *dev = encoder->dev; |
|---|
| 1422 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1449 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1423 | 1450 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1424 | 1451 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1452 | + struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); |
|---|
| 1425 | 1453 | struct hdmi_avi_infoframe frame; |
|---|
| 1426 | 1454 | u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE]; |
|---|
| 1427 | 1455 | uint8_t *payload = buffer + 3; |
|---|
| .. | .. |
|---|
| 1429 | 1457 | ssize_t err; |
|---|
| 1430 | 1458 | u32 tmp; |
|---|
| 1431 | 1459 | |
|---|
| 1432 | | - err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false); |
|---|
| 1460 | + err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode); |
|---|
| 1433 | 1461 | if (err < 0) { |
|---|
| 1434 | 1462 | DRM_ERROR("failed to setup AVI infoframe: %zd\n", err); |
|---|
| 1435 | 1463 | return; |
|---|
| .. | .. |
|---|
| 1460 | 1488 | static void dce_v6_0_audio_set_dto(struct drm_encoder *encoder, u32 clock) |
|---|
| 1461 | 1489 | { |
|---|
| 1462 | 1490 | struct drm_device *dev = encoder->dev; |
|---|
| 1463 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1491 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1464 | 1492 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(encoder->crtc); |
|---|
| 1465 | 1493 | int em = amdgpu_atombios_encoder_get_encoder_mode(encoder); |
|---|
| 1466 | 1494 | u32 tmp; |
|---|
| .. | .. |
|---|
| 1494 | 1522 | static void dce_v6_0_audio_set_packet(struct drm_encoder *encoder) |
|---|
| 1495 | 1523 | { |
|---|
| 1496 | 1524 | struct drm_device *dev = encoder->dev; |
|---|
| 1497 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1525 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1498 | 1526 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1499 | 1527 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1500 | 1528 | u32 tmp; |
|---|
| .. | .. |
|---|
| 1538 | 1566 | static void dce_v6_0_audio_set_mute(struct drm_encoder *encoder, bool mute) |
|---|
| 1539 | 1567 | { |
|---|
| 1540 | 1568 | struct drm_device *dev = encoder->dev; |
|---|
| 1541 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1569 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1542 | 1570 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1543 | 1571 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1544 | 1572 | u32 tmp; |
|---|
| .. | .. |
|---|
| 1551 | 1579 | static void dce_v6_0_audio_hdmi_enable(struct drm_encoder *encoder, bool enable) |
|---|
| 1552 | 1580 | { |
|---|
| 1553 | 1581 | struct drm_device *dev = encoder->dev; |
|---|
| 1554 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1582 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1555 | 1583 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1556 | 1584 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1557 | 1585 | u32 tmp; |
|---|
| .. | .. |
|---|
| 1588 | 1616 | static void dce_v6_0_audio_dp_enable(struct drm_encoder *encoder, bool enable) |
|---|
| 1589 | 1617 | { |
|---|
| 1590 | 1618 | struct drm_device *dev = encoder->dev; |
|---|
| 1591 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1619 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1592 | 1620 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1593 | 1621 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1594 | 1622 | u32 tmp; |
|---|
| .. | .. |
|---|
| 1617 | 1645 | struct drm_display_mode *mode) |
|---|
| 1618 | 1646 | { |
|---|
| 1619 | 1647 | struct drm_device *dev = encoder->dev; |
|---|
| 1620 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1648 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1621 | 1649 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1622 | 1650 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1623 | 1651 | struct drm_connector *connector; |
|---|
| 1652 | + struct drm_connector_list_iter iter; |
|---|
| 1624 | 1653 | struct amdgpu_connector *amdgpu_connector = NULL; |
|---|
| 1625 | 1654 | int em = amdgpu_atombios_encoder_get_encoder_mode(encoder); |
|---|
| 1626 | 1655 | int bpc = 8; |
|---|
| .. | .. |
|---|
| 1628 | 1657 | if (!dig || !dig->afmt) |
|---|
| 1629 | 1658 | return; |
|---|
| 1630 | 1659 | |
|---|
| 1631 | | - list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
|---|
| 1660 | + drm_connector_list_iter_begin(dev, &iter); |
|---|
| 1661 | + drm_for_each_connector_iter(connector, &iter) { |
|---|
| 1632 | 1662 | if (connector->encoder == encoder) { |
|---|
| 1633 | 1663 | amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 1634 | 1664 | break; |
|---|
| 1635 | 1665 | } |
|---|
| 1636 | 1666 | } |
|---|
| 1667 | + drm_connector_list_iter_end(&iter); |
|---|
| 1637 | 1668 | |
|---|
| 1638 | 1669 | if (!amdgpu_connector) { |
|---|
| 1639 | 1670 | DRM_ERROR("Couldn't find encoder's connector\n"); |
|---|
| .. | .. |
|---|
| 1683 | 1714 | static void dce_v6_0_afmt_enable(struct drm_encoder *encoder, bool enable) |
|---|
| 1684 | 1715 | { |
|---|
| 1685 | 1716 | struct drm_device *dev = encoder->dev; |
|---|
| 1686 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1717 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1687 | 1718 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 1688 | 1719 | struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; |
|---|
| 1689 | 1720 | |
|---|
| .. | .. |
|---|
| 1757 | 1788 | { |
|---|
| 1758 | 1789 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 1759 | 1790 | struct drm_device *dev = crtc->dev; |
|---|
| 1760 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1791 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1761 | 1792 | u32 vga_control; |
|---|
| 1762 | 1793 | |
|---|
| 1763 | 1794 | vga_control = RREG32(vga_control_regs[amdgpu_crtc->crtc_id]) & ~1; |
|---|
| .. | .. |
|---|
| 1768 | 1799 | { |
|---|
| 1769 | 1800 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 1770 | 1801 | struct drm_device *dev = crtc->dev; |
|---|
| 1771 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1802 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1772 | 1803 | |
|---|
| 1773 | 1804 | WREG32(mmGRPH_ENABLE + amdgpu_crtc->crtc_offset, enable ? 1 : 0); |
|---|
| 1774 | 1805 | } |
|---|
| .. | .. |
|---|
| 1779 | 1810 | { |
|---|
| 1780 | 1811 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 1781 | 1812 | struct drm_device *dev = crtc->dev; |
|---|
| 1782 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 1813 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1783 | 1814 | struct drm_framebuffer *target_fb; |
|---|
| 1784 | 1815 | struct drm_gem_object *obj; |
|---|
| 1785 | 1816 | struct amdgpu_bo *abo; |
|---|
| .. | .. |
|---|
| 1887 | 1918 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ |
|---|
| 1888 | 1919 | bypass_lut = true; |
|---|
| 1889 | 1920 | break; |
|---|
| 1921 | + case DRM_FORMAT_XBGR8888: |
|---|
| 1922 | + case DRM_FORMAT_ABGR8888: |
|---|
| 1923 | + fb_format = (GRPH_DEPTH(GRPH_DEPTH_32BPP) | |
|---|
| 1924 | + GRPH_FORMAT(GRPH_FORMAT_ARGB8888)); |
|---|
| 1925 | + fb_swap = (GRPH_RED_CROSSBAR(GRPH_RED_SEL_B) | |
|---|
| 1926 | + GRPH_BLUE_CROSSBAR(GRPH_BLUE_SEL_R)); |
|---|
| 1927 | +#ifdef __BIG_ENDIAN |
|---|
| 1928 | + fb_swap |= GRPH_ENDIAN_SWAP(GRPH_ENDIAN_8IN32); |
|---|
| 1929 | +#endif |
|---|
| 1930 | + break; |
|---|
| 1890 | 1931 | default: |
|---|
| 1891 | 1932 | DRM_ERROR("Unsupported screen format %s\n", |
|---|
| 1892 | 1933 | drm_get_format_name(target_fb->format->format, &format_name)); |
|---|
| .. | .. |
|---|
| 1992 | 2033 | struct drm_display_mode *mode) |
|---|
| 1993 | 2034 | { |
|---|
| 1994 | 2035 | struct drm_device *dev = crtc->dev; |
|---|
| 1995 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 2036 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 1996 | 2037 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 1997 | 2038 | |
|---|
| 1998 | 2039 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) |
|---|
| .. | .. |
|---|
| 2007 | 2048 | |
|---|
| 2008 | 2049 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2009 | 2050 | struct drm_device *dev = crtc->dev; |
|---|
| 2010 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 2051 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 2011 | 2052 | u16 *r, *g, *b; |
|---|
| 2012 | 2053 | int i; |
|---|
| 2013 | 2054 | |
|---|
| .. | .. |
|---|
| 2107 | 2148 | { |
|---|
| 2108 | 2149 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2109 | 2150 | struct drm_device *dev = crtc->dev; |
|---|
| 2110 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 2151 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 2111 | 2152 | u32 pll_in_use; |
|---|
| 2112 | 2153 | int pll; |
|---|
| 2113 | 2154 | |
|---|
| .. | .. |
|---|
| 2136 | 2177 | |
|---|
| 2137 | 2178 | static void dce_v6_0_lock_cursor(struct drm_crtc *crtc, bool lock) |
|---|
| 2138 | 2179 | { |
|---|
| 2139 | | - struct amdgpu_device *adev = crtc->dev->dev_private; |
|---|
| 2180 | + struct amdgpu_device *adev = drm_to_adev(crtc->dev); |
|---|
| 2140 | 2181 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2141 | 2182 | uint32_t cur_lock; |
|---|
| 2142 | 2183 | |
|---|
| .. | .. |
|---|
| 2151 | 2192 | static void dce_v6_0_hide_cursor(struct drm_crtc *crtc) |
|---|
| 2152 | 2193 | { |
|---|
| 2153 | 2194 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2154 | | - struct amdgpu_device *adev = crtc->dev->dev_private; |
|---|
| 2195 | + struct amdgpu_device *adev = drm_to_adev(crtc->dev); |
|---|
| 2155 | 2196 | |
|---|
| 2156 | | - WREG32_IDX(mmCUR_CONTROL + amdgpu_crtc->crtc_offset, |
|---|
| 2157 | | - (CURSOR_24_8_PRE_MULT << CUR_CONTROL__CURSOR_MODE__SHIFT) | |
|---|
| 2158 | | - (CURSOR_URGENT_1_2 << CUR_CONTROL__CURSOR_URGENT_CONTROL__SHIFT)); |
|---|
| 2197 | + WREG32(mmCUR_CONTROL + amdgpu_crtc->crtc_offset, |
|---|
| 2198 | + (CURSOR_24_8_PRE_MULT << CUR_CONTROL__CURSOR_MODE__SHIFT) | |
|---|
| 2199 | + (CURSOR_URGENT_1_2 << CUR_CONTROL__CURSOR_URGENT_CONTROL__SHIFT)); |
|---|
| 2159 | 2200 | |
|---|
| 2160 | 2201 | |
|---|
| 2161 | 2202 | } |
|---|
| .. | .. |
|---|
| 2163 | 2204 | static void dce_v6_0_show_cursor(struct drm_crtc *crtc) |
|---|
| 2164 | 2205 | { |
|---|
| 2165 | 2206 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2166 | | - struct amdgpu_device *adev = crtc->dev->dev_private; |
|---|
| 2207 | + struct amdgpu_device *adev = drm_to_adev(crtc->dev); |
|---|
| 2167 | 2208 | |
|---|
| 2168 | 2209 | WREG32(mmCUR_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
|---|
| 2169 | 2210 | upper_32_bits(amdgpu_crtc->cursor_addr)); |
|---|
| 2170 | 2211 | WREG32(mmCUR_SURFACE_ADDRESS + amdgpu_crtc->crtc_offset, |
|---|
| 2171 | 2212 | lower_32_bits(amdgpu_crtc->cursor_addr)); |
|---|
| 2172 | 2213 | |
|---|
| 2173 | | - WREG32_IDX(mmCUR_CONTROL + amdgpu_crtc->crtc_offset, |
|---|
| 2174 | | - CUR_CONTROL__CURSOR_EN_MASK | |
|---|
| 2175 | | - (CURSOR_24_8_PRE_MULT << CUR_CONTROL__CURSOR_MODE__SHIFT) | |
|---|
| 2176 | | - (CURSOR_URGENT_1_2 << CUR_CONTROL__CURSOR_URGENT_CONTROL__SHIFT)); |
|---|
| 2214 | + WREG32(mmCUR_CONTROL + amdgpu_crtc->crtc_offset, |
|---|
| 2215 | + CUR_CONTROL__CURSOR_EN_MASK | |
|---|
| 2216 | + (CURSOR_24_8_PRE_MULT << CUR_CONTROL__CURSOR_MODE__SHIFT) | |
|---|
| 2217 | + (CURSOR_URGENT_1_2 << CUR_CONTROL__CURSOR_URGENT_CONTROL__SHIFT)); |
|---|
| 2177 | 2218 | |
|---|
| 2178 | 2219 | } |
|---|
| 2179 | 2220 | |
|---|
| .. | .. |
|---|
| 2181 | 2222 | int x, int y) |
|---|
| 2182 | 2223 | { |
|---|
| 2183 | 2224 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2184 | | - struct amdgpu_device *adev = crtc->dev->dev_private; |
|---|
| 2225 | + struct amdgpu_device *adev = drm_to_adev(crtc->dev); |
|---|
| 2185 | 2226 | int xorigin = 0, yorigin = 0; |
|---|
| 2186 | 2227 | |
|---|
| 2187 | 2228 | int w = amdgpu_crtc->cursor_width; |
|---|
| .. | .. |
|---|
| 2258 | 2299 | aobj = gem_to_amdgpu_bo(obj); |
|---|
| 2259 | 2300 | ret = amdgpu_bo_reserve(aobj, false); |
|---|
| 2260 | 2301 | if (ret != 0) { |
|---|
| 2261 | | - drm_gem_object_put_unlocked(obj); |
|---|
| 2302 | + drm_gem_object_put(obj); |
|---|
| 2262 | 2303 | return ret; |
|---|
| 2263 | 2304 | } |
|---|
| 2264 | 2305 | |
|---|
| .. | .. |
|---|
| 2266 | 2307 | amdgpu_bo_unreserve(aobj); |
|---|
| 2267 | 2308 | if (ret) { |
|---|
| 2268 | 2309 | DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret); |
|---|
| 2269 | | - drm_gem_object_put_unlocked(obj); |
|---|
| 2310 | + drm_gem_object_put(obj); |
|---|
| 2270 | 2311 | return ret; |
|---|
| 2271 | 2312 | } |
|---|
| 2272 | 2313 | amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); |
|---|
| .. | .. |
|---|
| 2301 | 2342 | amdgpu_bo_unpin(aobj); |
|---|
| 2302 | 2343 | amdgpu_bo_unreserve(aobj); |
|---|
| 2303 | 2344 | } |
|---|
| 2304 | | - drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo); |
|---|
| 2345 | + drm_gem_object_put(amdgpu_crtc->cursor_bo); |
|---|
| 2305 | 2346 | } |
|---|
| 2306 | 2347 | |
|---|
| 2307 | 2348 | amdgpu_crtc->cursor_bo = obj; |
|---|
| .. | .. |
|---|
| 2347 | 2388 | .set_config = amdgpu_display_crtc_set_config, |
|---|
| 2348 | 2389 | .destroy = dce_v6_0_crtc_destroy, |
|---|
| 2349 | 2390 | .page_flip_target = amdgpu_display_crtc_page_flip_target, |
|---|
| 2391 | + .get_vblank_counter = amdgpu_get_vblank_counter_kms, |
|---|
| 2392 | + .enable_vblank = amdgpu_enable_vblank_kms, |
|---|
| 2393 | + .disable_vblank = amdgpu_disable_vblank_kms, |
|---|
| 2394 | + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, |
|---|
| 2350 | 2395 | }; |
|---|
| 2351 | 2396 | |
|---|
| 2352 | 2397 | static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode) |
|---|
| 2353 | 2398 | { |
|---|
| 2354 | 2399 | struct drm_device *dev = crtc->dev; |
|---|
| 2355 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 2400 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 2356 | 2401 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2357 | 2402 | unsigned type; |
|---|
| 2358 | 2403 | |
|---|
| .. | .. |
|---|
| 2402 | 2447 | |
|---|
| 2403 | 2448 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
|---|
| 2404 | 2449 | struct drm_device *dev = crtc->dev; |
|---|
| 2405 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 2450 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 2406 | 2451 | struct amdgpu_atom_ss ss; |
|---|
| 2407 | 2452 | int i; |
|---|
| 2408 | 2453 | |
|---|
| .. | .. |
|---|
| 2534 | 2579 | .prepare = dce_v6_0_crtc_prepare, |
|---|
| 2535 | 2580 | .commit = dce_v6_0_crtc_commit, |
|---|
| 2536 | 2581 | .disable = dce_v6_0_crtc_disable, |
|---|
| 2582 | + .get_scanout_position = amdgpu_crtc_get_scanout_position, |
|---|
| 2537 | 2583 | }; |
|---|
| 2538 | 2584 | |
|---|
| 2539 | 2585 | static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) |
|---|
| .. | .. |
|---|
| 2545 | 2591 | if (amdgpu_crtc == NULL) |
|---|
| 2546 | 2592 | return -ENOMEM; |
|---|
| 2547 | 2593 | |
|---|
| 2548 | | - drm_crtc_init(adev->ddev, &amdgpu_crtc->base, &dce_v6_0_crtc_funcs); |
|---|
| 2594 | + drm_crtc_init(adev_to_drm(adev), &amdgpu_crtc->base, &dce_v6_0_crtc_funcs); |
|---|
| 2549 | 2595 | |
|---|
| 2550 | 2596 | drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256); |
|---|
| 2551 | 2597 | amdgpu_crtc->crtc_id = index; |
|---|
| .. | .. |
|---|
| 2553 | 2599 | |
|---|
| 2554 | 2600 | amdgpu_crtc->max_cursor_width = CURSOR_WIDTH; |
|---|
| 2555 | 2601 | amdgpu_crtc->max_cursor_height = CURSOR_HEIGHT; |
|---|
| 2556 | | - adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; |
|---|
| 2557 | | - adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; |
|---|
| 2602 | + adev_to_drm(adev)->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; |
|---|
| 2603 | + adev_to_drm(adev)->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; |
|---|
| 2558 | 2604 | |
|---|
| 2559 | 2605 | amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; |
|---|
| 2560 | 2606 | |
|---|
| .. | .. |
|---|
| 2605 | 2651 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
|---|
| 2606 | 2652 | |
|---|
| 2607 | 2653 | for (i = 0; i < adev->mode_info.num_crtc; i++) { |
|---|
| 2608 | | - r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, i + 1, &adev->crtc_irq); |
|---|
| 2654 | + r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, i + 1, &adev->crtc_irq); |
|---|
| 2609 | 2655 | if (r) |
|---|
| 2610 | 2656 | return r; |
|---|
| 2611 | 2657 | } |
|---|
| 2612 | 2658 | |
|---|
| 2613 | 2659 | for (i = 8; i < 20; i += 2) { |
|---|
| 2614 | | - r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, i, &adev->pageflip_irq); |
|---|
| 2660 | + r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, i, &adev->pageflip_irq); |
|---|
| 2615 | 2661 | if (r) |
|---|
| 2616 | 2662 | return r; |
|---|
| 2617 | 2663 | } |
|---|
| 2618 | 2664 | |
|---|
| 2619 | 2665 | /* HPD hotplug */ |
|---|
| 2620 | | - r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 42, &adev->hpd_irq); |
|---|
| 2666 | + r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 42, &adev->hpd_irq); |
|---|
| 2621 | 2667 | if (r) |
|---|
| 2622 | 2668 | return r; |
|---|
| 2623 | 2669 | |
|---|
| 2624 | 2670 | adev->mode_info.mode_config_initialized = true; |
|---|
| 2625 | 2671 | |
|---|
| 2626 | | - adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; |
|---|
| 2627 | | - adev->ddev->mode_config.async_page_flip = true; |
|---|
| 2628 | | - adev->ddev->mode_config.max_width = 16384; |
|---|
| 2629 | | - adev->ddev->mode_config.max_height = 16384; |
|---|
| 2630 | | - adev->ddev->mode_config.preferred_depth = 24; |
|---|
| 2631 | | - adev->ddev->mode_config.prefer_shadow = 1; |
|---|
| 2632 | | - adev->ddev->mode_config.fb_base = adev->gmc.aper_base; |
|---|
| 2672 | + adev_to_drm(adev)->mode_config.funcs = &amdgpu_mode_funcs; |
|---|
| 2673 | + adev_to_drm(adev)->mode_config.async_page_flip = true; |
|---|
| 2674 | + adev_to_drm(adev)->mode_config.max_width = 16384; |
|---|
| 2675 | + adev_to_drm(adev)->mode_config.max_height = 16384; |
|---|
| 2676 | + adev_to_drm(adev)->mode_config.preferred_depth = 24; |
|---|
| 2677 | + adev_to_drm(adev)->mode_config.prefer_shadow = 1; |
|---|
| 2678 | + adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base; |
|---|
| 2633 | 2679 | |
|---|
| 2634 | 2680 | r = amdgpu_display_modeset_create_props(adev); |
|---|
| 2635 | 2681 | if (r) |
|---|
| 2636 | 2682 | return r; |
|---|
| 2637 | 2683 | |
|---|
| 2638 | | - adev->ddev->mode_config.max_width = 16384; |
|---|
| 2639 | | - adev->ddev->mode_config.max_height = 16384; |
|---|
| 2684 | + adev_to_drm(adev)->mode_config.max_width = 16384; |
|---|
| 2685 | + adev_to_drm(adev)->mode_config.max_height = 16384; |
|---|
| 2640 | 2686 | |
|---|
| 2641 | 2687 | /* allocate crtcs */ |
|---|
| 2642 | 2688 | for (i = 0; i < adev->mode_info.num_crtc; i++) { |
|---|
| .. | .. |
|---|
| 2647 | 2693 | |
|---|
| 2648 | 2694 | ret = amdgpu_atombios_get_connector_info_from_object_table(adev); |
|---|
| 2649 | 2695 | if (ret) |
|---|
| 2650 | | - amdgpu_display_print_display_setup(adev->ddev); |
|---|
| 2696 | + amdgpu_display_print_display_setup(adev_to_drm(adev)); |
|---|
| 2651 | 2697 | else |
|---|
| 2652 | 2698 | return -EINVAL; |
|---|
| 2653 | 2699 | |
|---|
| .. | .. |
|---|
| 2660 | 2706 | if (r) |
|---|
| 2661 | 2707 | return r; |
|---|
| 2662 | 2708 | |
|---|
| 2663 | | - drm_kms_helper_poll_init(adev->ddev); |
|---|
| 2709 | + drm_kms_helper_poll_init(adev_to_drm(adev)); |
|---|
| 2664 | 2710 | |
|---|
| 2665 | 2711 | return r; |
|---|
| 2666 | 2712 | } |
|---|
| .. | .. |
|---|
| 2671 | 2717 | |
|---|
| 2672 | 2718 | kfree(adev->mode_info.bios_hardcoded_edid); |
|---|
| 2673 | 2719 | |
|---|
| 2674 | | - drm_kms_helper_poll_fini(adev->ddev); |
|---|
| 2720 | + drm_kms_helper_poll_fini(adev_to_drm(adev)); |
|---|
| 2675 | 2721 | |
|---|
| 2676 | 2722 | dce_v6_0_audio_fini(adev); |
|---|
| 2677 | 2723 | dce_v6_0_afmt_fini(adev); |
|---|
| 2678 | 2724 | |
|---|
| 2679 | | - drm_mode_config_cleanup(adev->ddev); |
|---|
| 2725 | + drm_mode_config_cleanup(adev_to_drm(adev)); |
|---|
| 2680 | 2726 | adev->mode_info.mode_config_initialized = false; |
|---|
| 2681 | 2727 | |
|---|
| 2682 | 2728 | return 0; |
|---|
| .. | .. |
|---|
| 2921 | 2967 | DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); |
|---|
| 2922 | 2968 | |
|---|
| 2923 | 2969 | if (amdgpu_irq_enabled(adev, source, irq_type)) { |
|---|
| 2924 | | - drm_handle_vblank(adev->ddev, crtc); |
|---|
| 2970 | + drm_handle_vblank(adev_to_drm(adev), crtc); |
|---|
| 2925 | 2971 | } |
|---|
| 2926 | 2972 | DRM_DEBUG("IH: D%d vblank\n", crtc + 1); |
|---|
| 2927 | 2973 | break; |
|---|
| .. | .. |
|---|
| 2968 | 3014 | struct amdgpu_irq_src *source, |
|---|
| 2969 | 3015 | struct amdgpu_iv_entry *entry) |
|---|
| 2970 | 3016 | { |
|---|
| 2971 | | - unsigned long flags; |
|---|
| 3017 | + unsigned long flags; |
|---|
| 2972 | 3018 | unsigned crtc_id; |
|---|
| 2973 | 3019 | struct amdgpu_crtc *amdgpu_crtc; |
|---|
| 2974 | 3020 | struct amdgpu_flip_work *works; |
|---|
| .. | .. |
|---|
| 2990 | 3036 | if (amdgpu_crtc == NULL) |
|---|
| 2991 | 3037 | return 0; |
|---|
| 2992 | 3038 | |
|---|
| 2993 | | - spin_lock_irqsave(&adev->ddev->event_lock, flags); |
|---|
| 3039 | + spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); |
|---|
| 2994 | 3040 | works = amdgpu_crtc->pflip_works; |
|---|
| 2995 | 3041 | if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED){ |
|---|
| 2996 | 3042 | DRM_DEBUG_DRIVER("amdgpu_crtc->pflip_status = %d != " |
|---|
| 2997 | 3043 | "AMDGPU_FLIP_SUBMITTED(%d)\n", |
|---|
| 2998 | 3044 | amdgpu_crtc->pflip_status, |
|---|
| 2999 | 3045 | AMDGPU_FLIP_SUBMITTED); |
|---|
| 3000 | | - spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
|---|
| 3046 | + spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); |
|---|
| 3001 | 3047 | return 0; |
|---|
| 3002 | 3048 | } |
|---|
| 3003 | 3049 | |
|---|
| .. | .. |
|---|
| 3009 | 3055 | if (works->event) |
|---|
| 3010 | 3056 | drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event); |
|---|
| 3011 | 3057 | |
|---|
| 3012 | | - spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
|---|
| 3058 | + spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); |
|---|
| 3013 | 3059 | |
|---|
| 3014 | 3060 | drm_crtc_vblank_put(&amdgpu_crtc->base); |
|---|
| 3015 | 3061 | schedule_work(&works->unpin_work); |
|---|
| .. | .. |
|---|
| 3100 | 3146 | static void dce_v6_0_encoder_prepare(struct drm_encoder *encoder) |
|---|
| 3101 | 3147 | { |
|---|
| 3102 | 3148 | |
|---|
| 3103 | | - struct amdgpu_device *adev = encoder->dev->dev_private; |
|---|
| 3149 | + struct amdgpu_device *adev = drm_to_adev(encoder->dev); |
|---|
| 3104 | 3150 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 3105 | 3151 | struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); |
|---|
| 3106 | 3152 | |
|---|
| .. | .. |
|---|
| 3141 | 3187 | { |
|---|
| 3142 | 3188 | |
|---|
| 3143 | 3189 | struct drm_device *dev = encoder->dev; |
|---|
| 3144 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 3190 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 3145 | 3191 | |
|---|
| 3146 | 3192 | /* need to call this here as we need the crtc set up */ |
|---|
| 3147 | 3193 | amdgpu_atombios_encoder_dpms(encoder, DRM_MODE_DPMS_ON); |
|---|
| .. | .. |
|---|
| 3251 | 3297 | uint32_t supported_device, |
|---|
| 3252 | 3298 | u16 caps) |
|---|
| 3253 | 3299 | { |
|---|
| 3254 | | - struct drm_device *dev = adev->ddev; |
|---|
| 3300 | + struct drm_device *dev = adev_to_drm(adev); |
|---|
| 3255 | 3301 | struct drm_encoder *encoder; |
|---|
| 3256 | 3302 | struct amdgpu_encoder *amdgpu_encoder; |
|---|
| 3257 | 3303 | |
|---|
| .. | .. |
|---|
| 3365 | 3411 | |
|---|
| 3366 | 3412 | static void dce_v6_0_set_display_funcs(struct amdgpu_device *adev) |
|---|
| 3367 | 3413 | { |
|---|
| 3368 | | - if (adev->mode_info.funcs == NULL) |
|---|
| 3369 | | - adev->mode_info.funcs = &dce_v6_0_display_funcs; |
|---|
| 3414 | + adev->mode_info.funcs = &dce_v6_0_display_funcs; |
|---|
| 3370 | 3415 | } |
|---|
| 3371 | 3416 | |
|---|
| 3372 | 3417 | static const struct amdgpu_irq_src_funcs dce_v6_0_crtc_irq_funcs = { |
|---|