Lines Matching full:crtc

5  * DRM core CRTC related functions
56 * The CRTC modeset helper library provides a default set_config implementation
69 * to the CRTC state. For easier transition this library provides functions to
70 * implement the old semantics required by the CRTC helpers using the new plane
126 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
127 * @crtc: CRTC to check
129 * Checks whether @crtc is with the current mode setting output configuration
134 * True if @crtc is used, false otherwise.
136 bool drm_helper_crtc_in_use(struct drm_crtc *crtc) in drm_helper_crtc_in_use() argument
139 struct drm_device *dev = crtc->dev; in drm_helper_crtc_in_use()
151 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder)) in drm_helper_crtc_in_use()
174 struct drm_crtc *crtc; in __drm_helper_disable_unused_functions() local
182 encoder->crtc = NULL; in __drm_helper_disable_unused_functions()
186 drm_for_each_crtc(crtc, dev) { in __drm_helper_disable_unused_functions()
187 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in __drm_helper_disable_unused_functions()
189 crtc->enabled = drm_helper_crtc_in_use(crtc); in __drm_helper_disable_unused_functions()
190 if (!crtc->enabled) { in __drm_helper_disable_unused_functions()
192 (*crtc_funcs->disable)(crtc); in __drm_helper_disable_unused_functions()
194 (*crtc_funcs->dpms)(crtc, DRM_MODE_DPMS_OFF); in __drm_helper_disable_unused_functions()
195 crtc->primary->fb = NULL; in __drm_helper_disable_unused_functions()
205 * will remove any CRTC links of unused encoders and encoder links of
230 * Check the CRTC we're going to map each output to vs. its current
231 * CRTC. If they don't match, we have to disable the output and the CRTC
246 if (encoder->crtc == NULL) in drm_crtc_prepare_encoders()
253 * @crtc: CRTC to program
259 * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance
271 bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, in drm_crtc_helper_set_mode() argument
276 struct drm_device *dev = crtc->dev; in drm_crtc_helper_set_mode()
278 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_crtc_helper_set_mode()
289 saved_enabled = crtc->enabled; in drm_crtc_helper_set_mode()
290 crtc->enabled = drm_helper_crtc_in_use(crtc); in drm_crtc_helper_set_mode()
291 if (!crtc->enabled) in drm_crtc_helper_set_mode()
296 crtc->enabled = saved_enabled; in drm_crtc_helper_set_mode()
300 saved_mode = crtc->mode; in drm_crtc_helper_set_mode()
301 saved_hwmode = crtc->hwmode; in drm_crtc_helper_set_mode()
302 saved_x = crtc->x; in drm_crtc_helper_set_mode()
303 saved_y = crtc->y; in drm_crtc_helper_set_mode()
305 /* Update crtc values up front so the driver can rely on them for mode in drm_crtc_helper_set_mode()
308 crtc->mode = *mode; in drm_crtc_helper_set_mode()
309 crtc->x = x; in drm_crtc_helper_set_mode()
310 crtc->y = y; in drm_crtc_helper_set_mode()
312 /* Pass our mode to the connectors and the CRTC to give them a chance to in drm_crtc_helper_set_mode()
318 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
336 if (!(ret = crtc_funcs->mode_fixup(crtc, mode, in drm_crtc_helper_set_mode()
338 DRM_DEBUG_KMS("CRTC fixup failed\n"); in drm_crtc_helper_set_mode()
342 DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name); in drm_crtc_helper_set_mode()
344 crtc->hwmode = *adjusted_mode; in drm_crtc_helper_set_mode()
349 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
363 crtc_funcs->prepare(crtc); in drm_crtc_helper_set_mode()
368 ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb); in drm_crtc_helper_set_mode()
374 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
388 crtc_funcs->commit(crtc); in drm_crtc_helper_set_mode()
392 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
407 drm_calc_timestamping_constants(crtc, &crtc->hwmode); in drm_crtc_helper_set_mode()
413 crtc->enabled = saved_enabled; in drm_crtc_helper_set_mode()
414 crtc->mode = saved_mode; in drm_crtc_helper_set_mode()
415 crtc->hwmode = saved_hwmode; in drm_crtc_helper_set_mode()
416 crtc->x = saved_x; in drm_crtc_helper_set_mode()
417 crtc->y = saved_y; in drm_crtc_helper_set_mode()
425 drm_crtc_helper_disable(struct drm_crtc *crtc) in drm_crtc_helper_disable() argument
427 struct drm_device *dev = crtc->dev; in drm_crtc_helper_disable()
431 /* Decouple all encoders and their attached connectors from this crtc */ in drm_crtc_helper_disable()
435 if (encoder->crtc != crtc) in drm_crtc_helper_disable()
484 * &drm_crtc_funcs.set_config callback for drivers using the legacy CRTC
491 * mode_fixup encoder and CRTC helper operations to adjust the requested mode,
499 * will call the CRTC &drm_crtc_helper_funcs.mode_set_base helper operation.
504 * and ->commit() CRTC and encoder helper operations, in that order.
535 BUG_ON(!set->crtc); in drm_crtc_helper_set_config()
536 BUG_ON(!set->crtc->helper_private); in drm_crtc_helper_set_config()
542 crtc_funcs = set->crtc->helper_private; in drm_crtc_helper_set_config()
544 dev = set->crtc->dev; in drm_crtc_helper_set_config()
551 DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n", in drm_crtc_helper_set_config()
552 set->crtc->base.id, set->crtc->name, in drm_crtc_helper_set_config()
556 DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n", in drm_crtc_helper_set_config()
557 set->crtc->base.id, set->crtc->name); in drm_crtc_helper_set_config()
558 drm_crtc_helper_disable(set->crtc); in drm_crtc_helper_set_config()
587 save_encoder_crtcs[count++] = encoder->crtc; in drm_crtc_helper_set_config()
596 save_set.crtc = set->crtc; in drm_crtc_helper_set_config()
597 save_set.mode = &set->crtc->mode; in drm_crtc_helper_set_config()
598 save_set.x = set->crtc->x; in drm_crtc_helper_set_config()
599 save_set.y = set->crtc->y; in drm_crtc_helper_set_config()
600 save_set.fb = set->crtc->primary->fb; in drm_crtc_helper_set_config()
604 if (set->crtc->primary->fb != set->fb) { in drm_crtc_helper_set_config()
606 if (set->crtc->primary->fb == NULL) { in drm_crtc_helper_set_config()
607 DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); in drm_crtc_helper_set_config()
609 } else if (set->fb->format != set->crtc->primary->fb->format) { in drm_crtc_helper_set_config()
615 if (set->x != set->crtc->x || set->y != set->crtc->y) in drm_crtc_helper_set_config()
618 if (!drm_mode_equal(set->mode, &set->crtc->mode)) { in drm_crtc_helper_set_config()
620 drm_mode_debug_printmodeline(&set->crtc->mode); in drm_crtc_helper_set_config()
667 * the appropriate crtc will be set later. in drm_crtc_helper_set_config()
670 connector->encoder->crtc = NULL; in drm_crtc_helper_set_config()
687 if (connector->encoder->crtc == set->crtc) in drm_crtc_helper_set_config()
690 new_crtc = connector->encoder->crtc; in drm_crtc_helper_set_config()
694 new_crtc = set->crtc; in drm_crtc_helper_set_config()
697 /* Make sure the new CRTC will work with the encoder */ in drm_crtc_helper_set_config()
704 if (new_crtc != connector->encoder->crtc) { in drm_crtc_helper_set_config()
705 DRM_DEBUG_KMS("crtc changed, full mode switch\n"); in drm_crtc_helper_set_config()
707 connector->encoder->crtc = new_crtc; in drm_crtc_helper_set_config()
710 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n", in drm_crtc_helper_set_config()
725 if (drm_helper_crtc_in_use(set->crtc)) { in drm_crtc_helper_set_config()
729 set->crtc->primary->fb = set->fb; in drm_crtc_helper_set_config()
730 if (!drm_crtc_helper_set_mode(set->crtc, set->mode, in drm_crtc_helper_set_config()
733 DRM_ERROR("failed to set mode on [CRTC:%d:%s]\n", in drm_crtc_helper_set_config()
734 set->crtc->base.id, set->crtc->name); in drm_crtc_helper_set_config()
735 set->crtc->primary->fb = save_set.fb; in drm_crtc_helper_set_config()
748 set->crtc->x = set->x; in drm_crtc_helper_set_config()
749 set->crtc->y = set->y; in drm_crtc_helper_set_config()
750 set->crtc->primary->fb = set->fb; in drm_crtc_helper_set_config()
751 ret = crtc_funcs->mode_set_base(set->crtc, in drm_crtc_helper_set_config()
754 set->crtc->x = save_set.x; in drm_crtc_helper_set_config()
755 set->crtc->y = save_set.y; in drm_crtc_helper_set_config()
756 set->crtc->primary->fb = save_set.fb; in drm_crtc_helper_set_config()
769 encoder->crtc = save_encoder_crtcs[count++]; in drm_crtc_helper_set_config()
789 !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x, in drm_crtc_helper_set_config()
829 static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc) in drm_helper_choose_crtc_dpms() argument
834 struct drm_device *dev = crtc->dev; in drm_helper_choose_crtc_dpms()
838 if (connector->encoder && connector->encoder->crtc == crtc) in drm_helper_choose_crtc_dpms()
852 * &drm_connector_funcs.dpms callback for drivers using the legacy CRTC
855 * This is the main helper function provided by the CRTC helper framework for
870 struct drm_crtc *crtc = encoder ? encoder->crtc : NULL; in drm_helper_connector_dpms() local
884 /* from off to on, do crtc then encoder */ in drm_helper_connector_dpms()
886 if (crtc) { in drm_helper_connector_dpms()
887 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_helper_connector_dpms()
890 (*crtc_funcs->dpms) (crtc, in drm_helper_connector_dpms()
891 drm_helper_choose_crtc_dpms(crtc)); in drm_helper_connector_dpms()
897 /* from on to off, do encoder then crtc */ in drm_helper_connector_dpms()
901 if (crtc) { in drm_helper_connector_dpms()
902 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_helper_connector_dpms()
905 (*crtc_funcs->dpms) (crtc, in drm_helper_connector_dpms()
906 drm_helper_choose_crtc_dpms(crtc)); in drm_helper_connector_dpms()
942 struct drm_crtc *crtc; in drm_helper_resume_force_mode() local
951 drm_for_each_crtc(crtc, dev) { in drm_helper_resume_force_mode()
953 if (!crtc->enabled) in drm_helper_resume_force_mode()
956 ret = drm_crtc_helper_set_mode(crtc, &crtc->mode, in drm_helper_resume_force_mode()
957 crtc->x, crtc->y, crtc->primary->fb); in drm_helper_resume_force_mode()
961 DRM_ERROR("failed to set mode on crtc %p\n", crtc); in drm_helper_resume_force_mode()
964 if (drm_helper_choose_crtc_dpms(crtc)) { in drm_helper_resume_force_mode()
967 if(encoder->crtc != crtc) in drm_helper_resume_force_mode()
976 crtc_funcs = crtc->helper_private; in drm_helper_resume_force_mode()
978 (*crtc_funcs->dpms) (crtc, in drm_helper_resume_force_mode()
979 drm_helper_choose_crtc_dpms(crtc)); in drm_helper_resume_force_mode()
1004 struct drm_crtc *crtc; in drm_helper_force_disable_all() local
1008 drm_for_each_crtc(crtc, dev) in drm_helper_force_disable_all()
1009 if (crtc->enabled) { in drm_helper_force_disable_all()
1011 .crtc = crtc, in drm_helper_force_disable_all()