Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'topic/drm-misc-2015-07-28' of git://anongit.freedesktop.org/drm-intel into drm-next

More drm-misc, mostly fine-tuning of atomic helpers. They're mostly
driver-wide interface changes of the helpers and I need them for i915
work, so I plan to pull this tag into drm-intel-next too.

* tag 'topic/drm-misc-2015-07-28' of git://anongit.freedesktop.org/drm-intel:
drm/atomic: Update legacy DPMS state during modesets, v3.
drm: Make the connector dpms callback return a value, v2.
drm/atomic: pass old crtc state to atomic_begin/flush.
drm/atomic: add connectors_changed to separate it from mode_changed, v2
drm: Fix DP_TEST_COUNT_MASK

+169 -99
+4 -2
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
··· 239 239 return atmel_hlcdc_plane_prepare_disc_area(s); 240 240 } 241 241 242 - static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c) 242 + static void atmel_hlcdc_crtc_atomic_begin(struct drm_crtc *c, 243 + struct drm_crtc_state *old_s) 243 244 { 244 245 struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); 245 246 ··· 254 253 } 255 254 } 256 255 257 - static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc) 256 + static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc, 257 + struct drm_crtc_state *old_s) 258 258 { 259 259 /* TODO: write common plane control register if available */ 260 260 }
+70 -31
drivers/gpu/drm/drm_atomic_helper.c
··· 124 124 if (IS_ERR(crtc_state)) 125 125 return PTR_ERR(crtc_state); 126 126 127 - crtc_state->mode_changed = true; 127 + crtc_state->connectors_changed = true; 128 128 129 129 list_for_each_entry(connector, &config->connector_list, head) { 130 130 if (connector->state->best_encoder != encoder) ··· 174 174 idx = drm_crtc_index(connector->state->crtc); 175 175 176 176 crtc_state = state->crtc_states[idx]; 177 - crtc_state->mode_changed = true; 177 + crtc_state->connectors_changed = true; 178 178 } 179 179 180 180 if (connector_state->crtc) { 181 181 idx = drm_crtc_index(connector_state->crtc); 182 182 183 183 crtc_state = state->crtc_states[idx]; 184 - crtc_state->mode_changed = true; 184 + crtc_state->connectors_changed = true; 185 185 } 186 186 } 187 187 ··· 233 233 idx = drm_crtc_index(connector_state->crtc); 234 234 235 235 crtc_state = state->crtc_states[idx]; 236 - crtc_state->mode_changed = true; 236 + crtc_state->connectors_changed = true; 237 237 238 238 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n", 239 239 connector->base.id, ··· 256 256 bool ret; 257 257 258 258 for_each_crtc_in_state(state, crtc, crtc_state, i) { 259 - if (!crtc_state->mode_changed) 259 + if (!crtc_state->mode_changed && 260 + !crtc_state->connectors_changed) 260 261 continue; 261 262 262 263 drm_mode_copy(&crtc_state->adjusted_mode, &crtc_state->mode); ··· 313 312 for_each_crtc_in_state(state, crtc, crtc_state, i) { 314 313 const struct drm_crtc_helper_funcs *funcs; 315 314 316 - if (!crtc_state->mode_changed) 315 + if (!crtc_state->mode_changed && 316 + !crtc_state->connectors_changed) 317 317 continue; 318 318 319 319 funcs = crtc->helper_private; ··· 340 338 * 341 339 * Check the state object to see if the requested state is physically possible. 342 340 * This does all the crtc and connector related computations for an atomic 343 - * update. It computes and updates crtc_state->mode_changed, adds any additional 344 - * connectors needed for full modesets and calls down into ->mode_fixup 345 - * functions of the driver backend. 341 + * update and adds any additional connectors needed for full modesets and calls 342 + * down into ->mode_fixup functions of the driver backend. 343 + * 344 + * crtc_state->mode_changed is set when the input mode is changed. 345 + * crtc_state->connectors_changed is set when a connector is added or 346 + * removed from the crtc. 347 + * crtc_state->active_changed is set when crtc_state->active changes, 348 + * which is used for dpms. 346 349 * 347 350 * IMPORTANT: 348 351 * ··· 380 373 if (crtc->state->enable != crtc_state->enable) { 381 374 DRM_DEBUG_ATOMIC("[CRTC:%d] enable changed\n", 382 375 crtc->base.id); 376 + 377 + /* 378 + * For clarity this assignment is done here, but 379 + * enable == 0 is only true when there are no 380 + * connectors and a NULL mode. 381 + * 382 + * The other way around is true as well. enable != 0 383 + * iff connectors are attached and a mode is set. 384 + */ 383 385 crtc_state->mode_changed = true; 386 + crtc_state->connectors_changed = true; 384 387 } 385 388 } 386 389 ··· 464 447 * Check the state object to see if the requested state is physically possible. 465 448 * This does all the plane update related checks using by calling into the 466 449 * ->atomic_check hooks provided by the driver. 450 + * 451 + * It also sets crtc_state->planes_changed to indicate that a crtc has 452 + * updated planes. 467 453 * 468 454 * RETURNS 469 455 * Zero for success or -errno ··· 660 640 struct drm_crtc_state *old_crtc_state; 661 641 int i; 662 642 663 - /* clear out existing links */ 643 + /* clear out existing links and update dpms */ 664 644 for_each_connector_in_state(old_state, connector, old_conn_state, i) { 665 - if (!connector->encoder) 666 - continue; 645 + if (connector->encoder) { 646 + WARN_ON(!connector->encoder->crtc); 667 647 668 - WARN_ON(!connector->encoder->crtc); 648 + connector->encoder->crtc = NULL; 649 + connector->encoder = NULL; 650 + } 669 651 670 - connector->encoder->crtc = NULL; 671 - connector->encoder = NULL; 652 + crtc = connector->state->crtc; 653 + if ((!crtc && old_conn_state->crtc) || 654 + (crtc && drm_atomic_crtc_needs_modeset(crtc->state))) { 655 + struct drm_property *dpms_prop = 656 + dev->mode_config.dpms_property; 657 + int mode = DRM_MODE_DPMS_OFF; 658 + 659 + if (crtc && crtc->state->active) 660 + mode = DRM_MODE_DPMS_ON; 661 + 662 + connector->dpms = mode; 663 + drm_object_property_set_value(&connector->base, 664 + dpms_prop, mode); 665 + } 672 666 } 673 667 674 668 /* set new links */ ··· 1178 1144 if (!funcs || !funcs->atomic_begin) 1179 1145 continue; 1180 1146 1181 - funcs->atomic_begin(crtc); 1147 + funcs->atomic_begin(crtc, old_crtc_state); 1182 1148 } 1183 1149 1184 1150 for_each_plane_in_state(old_state, plane, old_plane_state, i) { ··· 1208 1174 if (!funcs || !funcs->atomic_flush) 1209 1175 continue; 1210 1176 1211 - funcs->atomic_flush(crtc); 1177 + funcs->atomic_flush(crtc, old_crtc_state); 1212 1178 } 1213 1179 } 1214 1180 EXPORT_SYMBOL(drm_atomic_helper_commit_planes); ··· 1244 1210 1245 1211 crtc_funcs = crtc->helper_private; 1246 1212 if (crtc_funcs && crtc_funcs->atomic_begin) 1247 - crtc_funcs->atomic_begin(crtc); 1213 + crtc_funcs->atomic_begin(crtc, old_crtc_state); 1248 1214 1249 1215 drm_for_each_plane_mask(plane, crtc->dev, plane_mask) { 1250 1216 struct drm_plane_state *old_plane_state = ··· 1267 1233 } 1268 1234 1269 1235 if (crtc_funcs && crtc_funcs->atomic_flush) 1270 - crtc_funcs->atomic_flush(crtc); 1236 + crtc_funcs->atomic_flush(crtc, old_crtc_state); 1271 1237 } 1272 1238 EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); 1273 1239 ··· 1988 1954 * implementing the legacy DPMS connector interface. It computes the new desired 1989 1955 * ->active state for the corresponding CRTC (if the connector is enabled) and 1990 1956 * updates it. 1957 + * 1958 + * Returns: 1959 + * Returns 0 on success, negative errno numbers on failure. 1991 1960 */ 1992 - void drm_atomic_helper_connector_dpms(struct drm_connector *connector, 1993 - int mode) 1961 + int drm_atomic_helper_connector_dpms(struct drm_connector *connector, 1962 + int mode) 1994 1963 { 1995 1964 struct drm_mode_config *config = &connector->dev->mode_config; 1996 1965 struct drm_atomic_state *state; ··· 2002 1965 struct drm_connector *tmp_connector; 2003 1966 int ret; 2004 1967 bool active = false; 1968 + int old_mode = connector->dpms; 2005 1969 2006 1970 if (mode != DRM_MODE_DPMS_ON) 2007 1971 mode = DRM_MODE_DPMS_OFF; ··· 2011 1973 crtc = connector->state->crtc; 2012 1974 2013 1975 if (!crtc) 2014 - return; 1976 + return 0; 2015 1977 2016 - /* FIXME: ->dpms has no return value so can't forward the -ENOMEM. */ 2017 1978 state = drm_atomic_state_alloc(connector->dev); 2018 1979 if (!state) 2019 - return; 1980 + return -ENOMEM; 2020 1981 2021 1982 state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); 2022 1983 retry: 2023 1984 crtc_state = drm_atomic_get_crtc_state(state, crtc); 2024 - if (IS_ERR(crtc_state)) 2025 - return; 1985 + if (IS_ERR(crtc_state)) { 1986 + ret = PTR_ERR(crtc_state); 1987 + goto fail; 1988 + } 2026 1989 2027 1990 WARN_ON(!drm_modeset_is_locked(&config->connection_mutex)); 2028 1991 ··· 2042 2003 if (ret != 0) 2043 2004 goto fail; 2044 2005 2045 - /* Driver takes ownership of state on successful async commit. */ 2046 - return; 2006 + /* Driver takes ownership of state on successful commit. */ 2007 + return 0; 2047 2008 fail: 2048 2009 if (ret == -EDEADLK) 2049 2010 goto backoff; 2050 2011 2012 + connector->dpms = old_mode; 2051 2013 drm_atomic_state_free(state); 2052 2014 2053 - WARN(1, "Driver bug: Changing ->active failed with ret=%i\n", ret); 2054 - 2055 - return; 2015 + return ret; 2056 2016 backoff: 2057 2017 drm_atomic_state_clear(state); 2058 2018 drm_atomic_legacy_backoff(state); ··· 2112 2074 state->mode_changed = false; 2113 2075 state->active_changed = false; 2114 2076 state->planes_changed = false; 2077 + state->connectors_changed = false; 2115 2078 state->event = NULL; 2116 2079 } 2117 2080 EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state);
+2 -2
drivers/gpu/drm/drm_crtc.c
··· 4753 4753 4754 4754 /* Do DPMS ourselves */ 4755 4755 if (property == connector->dev->mode_config.dpms_property) { 4756 - if (connector->funcs->dpms) 4757 - (*connector->funcs->dpms)(connector, (int)value); 4758 4756 ret = 0; 4757 + if (connector->funcs->dpms) 4758 + ret = (*connector->funcs->dpms)(connector, (int)value); 4759 4759 } else if (connector->funcs->set_property) 4760 4760 ret = connector->funcs->set_property(connector, property, value); 4761 4761
+6 -3
drivers/gpu/drm/drm_crtc_helper.c
··· 762 762 * implementing the DPMS connector attribute. It computes the new desired DPMS 763 763 * state for all encoders and crtcs in the output mesh and calls the ->dpms() 764 764 * callback provided by the driver appropriately. 765 + * 766 + * Returns: 767 + * Always returns 0. 765 768 */ 766 - void drm_helper_connector_dpms(struct drm_connector *connector, int mode) 769 + int drm_helper_connector_dpms(struct drm_connector *connector, int mode) 767 770 { 768 771 struct drm_encoder *encoder = connector->encoder; 769 772 struct drm_crtc *crtc = encoder ? encoder->crtc : NULL; 770 773 int old_dpms, encoder_dpms = DRM_MODE_DPMS_OFF; 771 774 772 775 if (mode == connector->dpms) 773 - return; 776 + return 0; 774 777 775 778 old_dpms = connector->dpms; 776 779 connector->dpms = mode; ··· 805 802 } 806 803 } 807 804 808 - return; 805 + return 0; 809 806 } 810 807 EXPORT_SYMBOL(drm_helper_connector_dpms); 811 808
+2 -2
drivers/gpu/drm/drm_plane_helper.c
··· 437 437 438 438 for (i = 0; i < 2; i++) { 439 439 if (crtc_funcs[i] && crtc_funcs[i]->atomic_begin) 440 - crtc_funcs[i]->atomic_begin(crtc[i]); 440 + crtc_funcs[i]->atomic_begin(crtc[i], crtc[i]->state); 441 441 } 442 442 443 443 /* ··· 452 452 453 453 for (i = 0; i < 2; i++) { 454 454 if (crtc_funcs[i] && crtc_funcs[i]->atomic_flush) 455 - crtc_funcs[i]->atomic_flush(crtc[i]); 455 + crtc_funcs[i]->atomic_flush(crtc[i], crtc[i]->state); 456 456 } 457 457 458 458 /*
+4 -2
drivers/gpu/drm/exynos/exynos_drm_crtc.c
··· 80 80 exynos_crtc->ops->commit(exynos_crtc); 81 81 } 82 82 83 - static void exynos_crtc_atomic_begin(struct drm_crtc *crtc) 83 + static void exynos_crtc_atomic_begin(struct drm_crtc *crtc, 84 + struct drm_crtc_state *old_crtc_state) 84 85 { 85 86 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); 86 87 ··· 91 90 } 92 91 } 93 92 94 - static void exynos_crtc_atomic_flush(struct drm_crtc *crtc) 93 + static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, 94 + struct drm_crtc_state *old_crtc_state) 95 95 { 96 96 } 97 97
+5 -3
drivers/gpu/drm/i915/intel_crt.c
··· 237 237 } 238 238 239 239 /* Special dpms function to support cloning between dvo/sdvo/crt. */ 240 - static void intel_crt_dpms(struct drm_connector *connector, int mode) 240 + static int intel_crt_dpms(struct drm_connector *connector, int mode) 241 241 { 242 242 struct drm_device *dev = connector->dev; 243 243 struct intel_encoder *encoder = intel_attached_encoder(connector); ··· 249 249 mode = DRM_MODE_DPMS_OFF; 250 250 251 251 if (mode == connector->dpms) 252 - return; 252 + return 0; 253 253 254 254 old_dpms = connector->dpms; 255 255 connector->dpms = mode; ··· 258 258 crtc = encoder->base.crtc; 259 259 if (!crtc) { 260 260 encoder->connectors_active = false; 261 - return; 261 + return 0; 262 262 } 263 263 264 264 /* We need the pipe to run for anything but OFF. */ ··· 281 281 } 282 282 283 283 intel_modeset_check_state(connector->dev); 284 + 285 + return 0; 284 286 } 285 287 286 288 static enum drm_mode_status
+12 -15
drivers/gpu/drm/i915/intel_display.c
··· 102 102 const struct intel_crtc_state *pipe_config); 103 103 static void chv_prepare_pll(struct intel_crtc *crtc, 104 104 const struct intel_crtc_state *pipe_config); 105 - static void intel_begin_crtc_commit(struct drm_crtc *crtc); 106 - static void intel_finish_crtc_commit(struct drm_crtc *crtc); 105 + static void intel_begin_crtc_commit(struct drm_crtc *, struct drm_crtc_state *); 106 + static void intel_finish_crtc_commit(struct drm_crtc *, struct drm_crtc_state *); 107 107 static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_crtc, 108 108 struct intel_crtc_state *crtc_state); 109 109 static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state, ··· 413 413 static bool 414 414 needs_modeset(struct drm_crtc_state *state) 415 415 { 416 - return state->mode_changed || state->active_changed; 416 + return drm_atomic_crtc_needs_modeset(state); 417 417 } 418 418 419 419 /** ··· 6429 6429 6430 6430 /* Even simpler default implementation, if there's really no special case to 6431 6431 * consider. */ 6432 - void intel_connector_dpms(struct drm_connector *connector, int mode) 6432 + int intel_connector_dpms(struct drm_connector *connector, int mode) 6433 6433 { 6434 6434 /* All the simple cases only support two dpms states. */ 6435 6435 if (mode != DRM_MODE_DPMS_ON) 6436 6436 mode = DRM_MODE_DPMS_OFF; 6437 6437 6438 6438 if (mode == connector->dpms) 6439 - return; 6439 + return 0; 6440 6440 6441 6441 connector->dpms = mode; 6442 6442 ··· 6445 6445 intel_encoder_dpms(to_intel_encoder(connector->encoder), mode); 6446 6446 6447 6447 intel_modeset_check_state(connector->dev); 6448 + 6449 + return 0; 6448 6450 } 6449 6451 6450 6452 /* Simple connector->get_hw_state implementation for encoders that support only ··· 12349 12347 continue; 12350 12348 12351 12349 if (crtc->state->active) { 12352 - struct drm_property *dpms_property = 12353 - dev->mode_config.dpms_property; 12354 - 12355 - connector->dpms = DRM_MODE_DPMS_ON; 12356 - drm_object_property_set_value(&connector->base, dpms_property, DRM_MODE_DPMS_ON); 12357 - 12358 12350 intel_encoder = to_intel_encoder(connector->encoder); 12359 12351 intel_encoder->connectors_active = true; 12360 - } else 12361 - connector->dpms = DRM_MODE_DPMS_OFF; 12352 + } 12362 12353 } 12363 12354 } 12364 12355 ··· 13623 13628 dev_priv->display.update_primary_plane(crtc, NULL, 0, 0); 13624 13629 } 13625 13630 13626 - static void intel_begin_crtc_commit(struct drm_crtc *crtc) 13631 + static void intel_begin_crtc_commit(struct drm_crtc *crtc, 13632 + struct drm_crtc_state *old_crtc_state) 13627 13633 { 13628 13634 struct drm_device *dev = crtc->dev; 13629 13635 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); ··· 13640 13644 skl_detach_scalers(intel_crtc); 13641 13645 } 13642 13646 13643 - static void intel_finish_crtc_commit(struct drm_crtc *crtc) 13647 + static void intel_finish_crtc_commit(struct drm_crtc *crtc, 13648 + struct drm_crtc_state *old_crtc_state) 13644 13649 { 13645 13650 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 13646 13651
+1 -1
drivers/gpu/drm/i915/intel_drv.h
··· 997 997 void intel_encoder_destroy(struct drm_encoder *encoder); 998 998 int intel_connector_init(struct intel_connector *); 999 999 struct intel_connector *intel_connector_alloc(void); 1000 - void intel_connector_dpms(struct drm_connector *, int mode); 1000 + int intel_connector_dpms(struct drm_connector *, int mode); 1001 1001 bool intel_connector_get_hw_state(struct intel_connector *connector); 1002 1002 void intel_modeset_check_state(struct drm_device *dev); 1003 1003 bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
+5 -3
drivers/gpu/drm/i915/intel_dvo.c
··· 197 197 } 198 198 199 199 /* Special dpms function to support cloning between dvo/sdvo/crt. */ 200 - static void intel_dvo_dpms(struct drm_connector *connector, int mode) 200 + static int intel_dvo_dpms(struct drm_connector *connector, int mode) 201 201 { 202 202 struct intel_dvo *intel_dvo = intel_attached_dvo(connector); 203 203 struct drm_crtc *crtc; ··· 208 208 mode = DRM_MODE_DPMS_OFF; 209 209 210 210 if (mode == connector->dpms) 211 - return; 211 + return 0; 212 212 213 213 connector->dpms = mode; 214 214 ··· 216 216 crtc = intel_dvo->base.base.crtc; 217 217 if (!crtc) { 218 218 intel_dvo->base.connectors_active = false; 219 - return; 219 + return 0; 220 220 } 221 221 222 222 /* We call connector dpms manually below in case pipe dpms doesn't ··· 238 238 } 239 239 240 240 intel_modeset_check_state(connector->dev); 241 + 242 + return 0; 241 243 } 242 244 243 245 static enum drm_mode_status
+5 -3
drivers/gpu/drm/i915/intel_sdvo.c
··· 1509 1509 } 1510 1510 1511 1511 /* Special dpms function to support cloning between dvo/sdvo/crt. */ 1512 - static void intel_sdvo_dpms(struct drm_connector *connector, int mode) 1512 + static int intel_sdvo_dpms(struct drm_connector *connector, int mode) 1513 1513 { 1514 1514 struct drm_crtc *crtc; 1515 1515 struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector); ··· 1519 1519 mode = DRM_MODE_DPMS_OFF; 1520 1520 1521 1521 if (mode == connector->dpms) 1522 - return; 1522 + return 0; 1523 1523 1524 1524 connector->dpms = mode; 1525 1525 ··· 1527 1527 crtc = intel_sdvo->base.base.crtc; 1528 1528 if (!crtc) { 1529 1529 intel_sdvo->base.connectors_active = false; 1530 - return; 1530 + return 0; 1531 1531 } 1532 1532 1533 1533 /* We set active outputs manually below in case pipe dpms doesn't change ··· 1551 1551 } 1552 1552 1553 1553 intel_modeset_check_state(connector->dev); 1554 + 1555 + return 0; 1554 1556 } 1555 1557 1556 1558 static enum drm_mode_status
+4 -2
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
··· 334 334 return 0; 335 335 } 336 336 337 - static void mdp4_crtc_atomic_begin(struct drm_crtc *crtc) 337 + static void mdp4_crtc_atomic_begin(struct drm_crtc *crtc, 338 + struct drm_crtc_state *old_crtc_state) 338 339 { 339 340 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); 340 341 DBG("%s: begin", mdp4_crtc->name); 341 342 } 342 343 343 - static void mdp4_crtc_atomic_flush(struct drm_crtc *crtc) 344 + static void mdp4_crtc_atomic_flush(struct drm_crtc *crtc, 345 + struct drm_crtc_state *old_crtc_state) 344 346 { 345 347 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); 346 348 struct drm_device *dev = crtc->dev;
+4 -2
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
··· 388 388 return 0; 389 389 } 390 390 391 - static void mdp5_crtc_atomic_begin(struct drm_crtc *crtc) 391 + static void mdp5_crtc_atomic_begin(struct drm_crtc *crtc, 392 + struct drm_crtc_state *old_crtc_state) 392 393 { 393 394 struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); 394 395 DBG("%s: begin", mdp5_crtc->name); 395 396 } 396 397 397 - static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc) 398 + static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc, 399 + struct drm_crtc_state *old_crtc_state) 398 400 { 399 401 struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); 400 402 struct drm_device *dev = crtc->dev;
+2 -2
drivers/gpu/drm/nouveau/nouveau_connector.c
··· 919 919 .force = nouveau_connector_force 920 920 }; 921 921 922 - static void 922 + static int 923 923 nouveau_connector_dp_dpms(struct drm_connector *connector, int mode) 924 924 { 925 925 struct nouveau_encoder *nv_encoder = NULL; ··· 938 938 } 939 939 } 940 940 941 - drm_helper_connector_dpms(connector, mode); 941 + return drm_helper_connector_dpms(connector, mode); 942 942 } 943 943 944 944 static const struct drm_connector_funcs
+2 -1
drivers/gpu/drm/radeon/radeon_dp_mst.c
··· 246 246 kfree(radeon_connector); 247 247 } 248 248 249 - static void radeon_connector_dpms(struct drm_connector *connector, int mode) 249 + static int radeon_connector_dpms(struct drm_connector *connector, int mode) 250 250 { 251 251 DRM_DEBUG_KMS("\n"); 252 + return 0; 252 253 } 253 254 254 255 static const struct drm_connector_funcs radeon_dp_mst_connector_funcs = {
+4 -2
drivers/gpu/drm/rcar-du/rcar_du_crtc.c
··· 496 496 return true; 497 497 } 498 498 499 - static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc) 499 + static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc, 500 + struct drm_crtc_state *old_crtc_state) 500 501 { 501 502 struct drm_pending_vblank_event *event = crtc->state->event; 502 503 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); ··· 513 512 } 514 513 } 515 514 516 - static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) 515 + static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc, 516 + struct drm_crtc_state *old_crtc_state) 517 517 { 518 518 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); 519 519
+4 -2
drivers/gpu/drm/sti/sti_drm_crtc.c
··· 164 164 sti_drm_crtc_mode_set(crtc, &crtc->state->adjusted_mode); 165 165 } 166 166 167 - static void sti_drm_atomic_begin(struct drm_crtc *crtc) 167 + static void sti_drm_atomic_begin(struct drm_crtc *crtc, 168 + struct drm_crtc_state *old_crtc_state) 168 169 { 169 170 struct sti_mixer *mixer = to_sti_mixer(crtc); 170 171 ··· 179 178 } 180 179 } 181 180 182 - static void sti_drm_atomic_flush(struct drm_crtc *crtc) 181 + static void sti_drm_atomic_flush(struct drm_crtc *crtc, 182 + struct drm_crtc_state *old_crtc_state) 183 183 { 184 184 } 185 185
+4 -2
drivers/gpu/drm/tegra/dc.c
··· 1277 1277 return 0; 1278 1278 } 1279 1279 1280 - static void tegra_crtc_atomic_begin(struct drm_crtc *crtc) 1280 + static void tegra_crtc_atomic_begin(struct drm_crtc *crtc, 1281 + struct drm_crtc_state *old_crtc_state) 1281 1282 { 1282 1283 struct tegra_dc *dc = to_tegra_dc(crtc); 1283 1284 ··· 1292 1291 } 1293 1292 } 1294 1293 1295 - static void tegra_crtc_atomic_flush(struct drm_crtc *crtc) 1294 + static void tegra_crtc_atomic_flush(struct drm_crtc *crtc, 1295 + struct drm_crtc_state *old_crtc_state) 1296 1296 { 1297 1297 struct tegra_dc_state *state = to_dc_state(crtc->state); 1298 1298 struct tegra_dc *dc = to_tegra_dc(crtc);
+2 -1
drivers/gpu/drm/tegra/dsi.c
··· 726 726 tegra_dsi_soft_reset(dsi->slave); 727 727 } 728 728 729 - static void tegra_dsi_connector_dpms(struct drm_connector *connector, int mode) 729 + static int tegra_dsi_connector_dpms(struct drm_connector *connector, int mode) 730 730 { 731 + return 0; 731 732 } 732 733 733 734 static void tegra_dsi_connector_reset(struct drm_connector *connector)
+3 -2
drivers/gpu/drm/tegra/hdmi.c
··· 772 772 return drm_detect_hdmi_monitor(edid); 773 773 } 774 774 775 - static void tegra_hdmi_connector_dpms(struct drm_connector *connector, 776 - int mode) 775 + static int tegra_hdmi_connector_dpms(struct drm_connector *connector, 776 + int mode) 777 777 { 778 + return 0; 778 779 } 779 780 780 781 static const struct drm_connector_funcs tegra_hdmi_connector_funcs = {
+3 -2
drivers/gpu/drm/tegra/rgb.c
··· 88 88 tegra_dc_writel(dc, table[i].value, table[i].offset); 89 89 } 90 90 91 - static void tegra_rgb_connector_dpms(struct drm_connector *connector, 92 - int mode) 91 + static int tegra_rgb_connector_dpms(struct drm_connector *connector, 92 + int mode) 93 93 { 94 + return 0; 94 95 } 95 96 96 97 static const struct drm_connector_funcs tegra_rgb_connector_funcs = {
+2 -1
drivers/gpu/drm/tegra/sor.c
··· 866 866 sor->debugfs_files = NULL; 867 867 } 868 868 869 - static void tegra_sor_connector_dpms(struct drm_connector *connector, int mode) 869 + static int tegra_sor_connector_dpms(struct drm_connector *connector, int mode) 870 870 { 871 + return 0; 871 872 } 872 873 873 874 static enum drm_connector_status
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 1808 1808 } 1809 1809 } 1810 1810 1811 - void vmw_du_connector_dpms(struct drm_connector *connector, int mode) 1811 + int vmw_du_connector_dpms(struct drm_connector *connector, int mode) 1812 1812 { 1813 + return 0; 1813 1814 } 1814 1815 1815 1816 void vmw_du_connector_save(struct drm_connector *connector)
+1 -1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
··· 133 133 int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, 134 134 uint32_t handle, uint32_t width, uint32_t height); 135 135 int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); 136 - void vmw_du_connector_dpms(struct drm_connector *connector, int mode); 136 + int vmw_du_connector_dpms(struct drm_connector *connector, int mode); 137 137 void vmw_du_connector_save(struct drm_connector *connector); 138 138 void vmw_du_connector_restore(struct drm_connector *connector); 139 139 enum drm_connector_status
+2 -1
include/drm/drm_atomic.h
··· 166 166 static inline bool 167 167 drm_atomic_crtc_needs_modeset(struct drm_crtc_state *state) 168 168 { 169 - return state->mode_changed || state->active_changed; 169 + return state->mode_changed || state->active_changed || 170 + state->connectors_changed; 170 171 } 171 172 172 173
+2 -2
include/drm/drm_atomic_helper.h
··· 87 87 struct drm_framebuffer *fb, 88 88 struct drm_pending_vblank_event *event, 89 89 uint32_t flags); 90 - void drm_atomic_helper_connector_dpms(struct drm_connector *connector, 91 - int mode); 90 + int drm_atomic_helper_connector_dpms(struct drm_connector *connector, 91 + int mode); 92 92 93 93 /* default implementations for state handling */ 94 94 void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
+6 -4
include/drm/drm_crtc.h
··· 255 255 * @crtc: backpointer to the CRTC 256 256 * @enable: whether the CRTC should be enabled, gates all other state 257 257 * @active: whether the CRTC is actively displaying (used for DPMS) 258 - * @mode_changed: for use by helpers and drivers when computing state updates 259 - * @active_changed: for use by helpers and drivers when computing state updates 258 + * @planes_changed: planes on this crtc are updated 259 + * @mode_changed: crtc_state->mode or crtc_state->enable has been changed 260 + * @active_changed: crtc_state->active has been toggled. 261 + * @connectors_changed: connectors to this crtc have been updated 260 262 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes 261 263 * @last_vblank_count: for helpers and drivers to capture the vblank of the 262 264 * update to ensure framebuffer cleanup isn't done too early 263 - * @planes_changed: for use by helpers and drivers when computing state updates 264 265 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings 265 266 * @mode: current mode timings 266 267 * @event: optional pointer to a DRM event to signal upon completion of the ··· 284 283 bool planes_changed : 1; 285 284 bool mode_changed : 1; 286 285 bool active_changed : 1; 286 + bool connectors_changed : 1; 287 287 288 288 /* attached planes bitmask: 289 289 * WARNING: transitional helpers do not maintain plane_mask so ··· 527 525 * etc. 528 526 */ 529 527 struct drm_connector_funcs { 530 - void (*dpms)(struct drm_connector *connector, int mode); 528 + int (*dpms)(struct drm_connector *connector, int mode); 531 529 void (*save)(struct drm_connector *connector); 532 530 void (*restore)(struct drm_connector *connector); 533 531 void (*reset)(struct drm_connector *connector);
+5 -3
include/drm/drm_crtc_helper.h
··· 108 108 /* atomic helpers */ 109 109 int (*atomic_check)(struct drm_crtc *crtc, 110 110 struct drm_crtc_state *state); 111 - void (*atomic_begin)(struct drm_crtc *crtc); 112 - void (*atomic_flush)(struct drm_crtc *crtc); 111 + void (*atomic_begin)(struct drm_crtc *crtc, 112 + struct drm_crtc_state *old_crtc_state); 113 + void (*atomic_flush)(struct drm_crtc *crtc, 114 + struct drm_crtc_state *old_crtc_state); 113 115 }; 114 116 115 117 /** ··· 189 187 extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); 190 188 extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); 191 189 192 - extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 190 + extern int drm_helper_connector_dpms(struct drm_connector *connector, int mode); 193 191 194 192 extern void drm_helper_move_panel_connectors_to_head(struct drm_device *); 195 193
+1 -1
include/drm/drm_dp_helper.h
··· 420 420 421 421 #define DP_TEST_SINK_MISC 0x246 422 422 # define DP_TEST_CRC_SUPPORTED (1 << 5) 423 - # define DP_TEST_COUNT_MASK 0x7 423 + # define DP_TEST_COUNT_MASK 0xf 424 424 425 425 #define DP_TEST_RESPONSE 0x260 426 426 # define DP_TEST_ACK (1 << 0)