• Home
  • Raw
  • Download

Lines Matching full:crtc

5  * DRM core CRTC related functions
50 * The CRTC modeset helper library provides a default set_config implementation
63 * to the CRTC state. For easier transition this library provides functions to
64 * implement the old semantics required by the CRTC helpers using the new plane
118 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
119 * @crtc: CRTC to check
121 * Checks whether @crtc is with the current mode setting output configuration
126 * True if @crtc is used, false otherwise.
128 bool drm_helper_crtc_in_use(struct drm_crtc *crtc) in drm_helper_crtc_in_use() argument
131 struct drm_device *dev = crtc->dev; in drm_helper_crtc_in_use()
141 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder)) in drm_helper_crtc_in_use()
168 struct drm_crtc *crtc; in __drm_helper_disable_unused_functions() local
176 encoder->crtc = NULL; in __drm_helper_disable_unused_functions()
180 drm_for_each_crtc(crtc, dev) { in __drm_helper_disable_unused_functions()
181 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in __drm_helper_disable_unused_functions()
182 crtc->enabled = drm_helper_crtc_in_use(crtc); in __drm_helper_disable_unused_functions()
183 if (!crtc->enabled) { in __drm_helper_disable_unused_functions()
185 (*crtc_funcs->disable)(crtc); in __drm_helper_disable_unused_functions()
187 (*crtc_funcs->dpms)(crtc, DRM_MODE_DPMS_OFF); in __drm_helper_disable_unused_functions()
188 crtc->primary->fb = NULL; in __drm_helper_disable_unused_functions()
198 * will remove any CRTC links of unused encoders and encoder links of
224 * Check the CRTC we're going to map each output to vs. its current
225 * CRTC. If they don't match, we have to disable the output and the CRTC
240 if (encoder->crtc == NULL) in drm_crtc_prepare_encoders()
242 /* Disable encoders whose CRTC is about to change */ in drm_crtc_prepare_encoders()
244 encoder->crtc != (*encoder_funcs->get_crtc)(encoder)) in drm_crtc_prepare_encoders()
251 * @crtc: CRTC to program
257 * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance
269 bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, in drm_crtc_helper_set_mode() argument
274 struct drm_device *dev = crtc->dev; in drm_crtc_helper_set_mode()
276 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_crtc_helper_set_mode()
285 saved_enabled = crtc->enabled; in drm_crtc_helper_set_mode()
286 crtc->enabled = drm_helper_crtc_in_use(crtc); in drm_crtc_helper_set_mode()
287 if (!crtc->enabled) in drm_crtc_helper_set_mode()
292 crtc->enabled = saved_enabled; in drm_crtc_helper_set_mode()
296 saved_mode = crtc->mode; in drm_crtc_helper_set_mode()
297 saved_hwmode = crtc->hwmode; in drm_crtc_helper_set_mode()
298 saved_x = crtc->x; in drm_crtc_helper_set_mode()
299 saved_y = crtc->y; in drm_crtc_helper_set_mode()
301 /* Update crtc values up front so the driver can rely on them for mode in drm_crtc_helper_set_mode()
304 crtc->mode = *mode; in drm_crtc_helper_set_mode()
305 crtc->x = x; in drm_crtc_helper_set_mode()
306 crtc->y = y; in drm_crtc_helper_set_mode()
308 /* Pass our mode to the connectors and the CRTC to give them a chance to in drm_crtc_helper_set_mode()
314 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
339 if (!(ret = crtc_funcs->mode_fixup(crtc, mode, in drm_crtc_helper_set_mode()
341 DRM_DEBUG_KMS("CRTC fixup failed\n"); in drm_crtc_helper_set_mode()
345 DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name); in drm_crtc_helper_set_mode()
347 crtc->hwmode = *adjusted_mode; in drm_crtc_helper_set_mode()
352 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
370 crtc_funcs->prepare(crtc); in drm_crtc_helper_set_mode()
375 ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb); in drm_crtc_helper_set_mode()
381 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
398 crtc_funcs->commit(crtc); in drm_crtc_helper_set_mode()
402 if (encoder->crtc != crtc) in drm_crtc_helper_set_mode()
421 drm_calc_timestamping_constants(crtc, &crtc->hwmode); in drm_crtc_helper_set_mode()
427 crtc->enabled = saved_enabled; in drm_crtc_helper_set_mode()
428 crtc->mode = saved_mode; in drm_crtc_helper_set_mode()
429 crtc->hwmode = saved_hwmode; in drm_crtc_helper_set_mode()
430 crtc->x = saved_x; in drm_crtc_helper_set_mode()
431 crtc->y = saved_y; in drm_crtc_helper_set_mode()
439 drm_crtc_helper_disable(struct drm_crtc *crtc) in drm_crtc_helper_disable() argument
441 struct drm_device *dev = crtc->dev; in drm_crtc_helper_disable()
445 /* Decouple all encoders and their attached connectors from this crtc */ in drm_crtc_helper_disable()
449 if (encoder->crtc != crtc) in drm_crtc_helper_disable()
482 * &drm_crtc_funcs.set_config callback for drivers using the legacy CRTC
489 * mode_fixup encoder and CRTC helper operations to adjust the requested mode,
497 * will call the CRTC &drm_crtc_helper_funcs.mode_set_base helper operation.
502 * and ->commit() CRTC and encoder helper operations, in that order.
533 BUG_ON(!set->crtc); in drm_crtc_helper_set_config()
534 BUG_ON(!set->crtc->helper_private); in drm_crtc_helper_set_config()
540 crtc_funcs = set->crtc->helper_private; in drm_crtc_helper_set_config()
546 DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n", in drm_crtc_helper_set_config()
547 set->crtc->base.id, set->crtc->name, in drm_crtc_helper_set_config()
551 DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n", in drm_crtc_helper_set_config()
552 set->crtc->base.id, set->crtc->name); in drm_crtc_helper_set_config()
553 drm_crtc_helper_disable(set->crtc); in drm_crtc_helper_set_config()
557 dev = set->crtc->dev; in drm_crtc_helper_set_config()
584 save_encoder_crtcs[count++] = encoder->crtc; in drm_crtc_helper_set_config()
593 save_set.crtc = set->crtc; in drm_crtc_helper_set_config()
594 save_set.mode = &set->crtc->mode; in drm_crtc_helper_set_config()
595 save_set.x = set->crtc->x; in drm_crtc_helper_set_config()
596 save_set.y = set->crtc->y; in drm_crtc_helper_set_config()
597 save_set.fb = set->crtc->primary->fb; in drm_crtc_helper_set_config()
601 if (set->crtc->primary->fb != set->fb) { in drm_crtc_helper_set_config()
603 if (set->crtc->primary->fb == NULL) { in drm_crtc_helper_set_config()
604 DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); in drm_crtc_helper_set_config()
606 } else if (set->fb->format != set->crtc->primary->fb->format) { in drm_crtc_helper_set_config()
612 if (set->x != set->crtc->x || set->y != set->crtc->y) in drm_crtc_helper_set_config()
615 if (!drm_mode_equal(set->mode, &set->crtc->mode)) { in drm_crtc_helper_set_config()
617 drm_mode_debug_printmodeline(&set->crtc->mode); in drm_crtc_helper_set_config()
660 * the appropriate crtc will be set later. in drm_crtc_helper_set_config()
663 connector->encoder->crtc = NULL; in drm_crtc_helper_set_config()
680 if (connector->encoder->crtc == set->crtc) in drm_crtc_helper_set_config()
683 new_crtc = connector->encoder->crtc; in drm_crtc_helper_set_config()
687 new_crtc = set->crtc; in drm_crtc_helper_set_config()
690 /* Make sure the new CRTC will work with the encoder */ in drm_crtc_helper_set_config()
697 if (new_crtc != connector->encoder->crtc) { in drm_crtc_helper_set_config()
698 DRM_DEBUG_KMS("crtc changed, full mode switch\n"); in drm_crtc_helper_set_config()
700 connector->encoder->crtc = new_crtc; in drm_crtc_helper_set_config()
703 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n", in drm_crtc_helper_set_config()
718 if (drm_helper_crtc_in_use(set->crtc)) { in drm_crtc_helper_set_config()
722 set->crtc->primary->fb = set->fb; in drm_crtc_helper_set_config()
723 if (!drm_crtc_helper_set_mode(set->crtc, set->mode, in drm_crtc_helper_set_config()
726 DRM_ERROR("failed to set mode on [CRTC:%d:%s]\n", in drm_crtc_helper_set_config()
727 set->crtc->base.id, set->crtc->name); in drm_crtc_helper_set_config()
728 set->crtc->primary->fb = save_set.fb; in drm_crtc_helper_set_config()
741 set->crtc->x = set->x; in drm_crtc_helper_set_config()
742 set->crtc->y = set->y; in drm_crtc_helper_set_config()
743 set->crtc->primary->fb = set->fb; in drm_crtc_helper_set_config()
744 ret = crtc_funcs->mode_set_base(set->crtc, in drm_crtc_helper_set_config()
747 set->crtc->x = save_set.x; in drm_crtc_helper_set_config()
748 set->crtc->y = save_set.y; in drm_crtc_helper_set_config()
749 set->crtc->primary->fb = save_set.fb; in drm_crtc_helper_set_config()
762 encoder->crtc = save_encoder_crtcs[count++]; in drm_crtc_helper_set_config()
782 !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x, in drm_crtc_helper_set_config()
833 static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc) in drm_helper_choose_crtc_dpms() argument
838 struct drm_device *dev = crtc->dev; in drm_helper_choose_crtc_dpms()
842 if (connector->encoder && connector->encoder->crtc == crtc) in drm_helper_choose_crtc_dpms()
856 * &drm_connector_funcs.dpms callback for drivers using the legacy CRTC
859 * This is the main helper function provided by the CRTC helper framework for
874 struct drm_crtc *crtc = encoder ? encoder->crtc : NULL; in drm_helper_connector_dpms() local
886 /* from off to on, do crtc then encoder */ in drm_helper_connector_dpms()
888 if (crtc) { in drm_helper_connector_dpms()
889 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_helper_connector_dpms()
891 (*crtc_funcs->dpms) (crtc, in drm_helper_connector_dpms()
892 drm_helper_choose_crtc_dpms(crtc)); in drm_helper_connector_dpms()
898 /* from on to off, do encoder then crtc */ in drm_helper_connector_dpms()
902 if (crtc) { in drm_helper_connector_dpms()
903 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
949 drm_for_each_crtc(crtc, dev) { in drm_helper_resume_force_mode()
951 if (!crtc->enabled) in drm_helper_resume_force_mode()
954 ret = drm_crtc_helper_set_mode(crtc, &crtc->mode, in drm_helper_resume_force_mode()
955 crtc->x, crtc->y, crtc->primary->fb); in drm_helper_resume_force_mode()
959 DRM_ERROR("failed to set mode on crtc %p\n", crtc); in drm_helper_resume_force_mode()
962 if (drm_helper_choose_crtc_dpms(crtc)) { in drm_helper_resume_force_mode()
965 if(encoder->crtc != crtc) in drm_helper_resume_force_mode()
974 crtc_funcs = crtc->helper_private; in drm_helper_resume_force_mode()
976 (*crtc_funcs->dpms) (crtc, in drm_helper_resume_force_mode()
977 drm_helper_choose_crtc_dpms(crtc)); in drm_helper_resume_force_mode()
989 * @crtc: DRM CRTC
992 * @x: x offset of the CRTC scanout area on the underlying framebuffer
993 * @y: y offset of the CRTC scanout area on the underlying framebuffer
997 * required by the CRTC helpers. Besides the atomic plane helper functions for
999 * to set up the CRTC.
1004 int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, in drm_helper_crtc_mode_set() argument
1009 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_helper_crtc_mode_set()
1012 if (crtc->funcs->atomic_duplicate_state) in drm_helper_crtc_mode_set()
1013 crtc_state = crtc->funcs->atomic_duplicate_state(crtc); in drm_helper_crtc_mode_set()
1015 if (!crtc->state) in drm_helper_crtc_mode_set()
1016 drm_atomic_helper_crtc_reset(crtc); in drm_helper_crtc_mode_set()
1018 crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc); in drm_helper_crtc_mode_set()
1032 ret = crtc_funcs->atomic_check(crtc, crtc_state); in drm_helper_crtc_mode_set()
1037 swap(crtc->state, crtc_state); in drm_helper_crtc_mode_set()
1039 crtc_funcs->mode_set_nofb(crtc); in drm_helper_crtc_mode_set()
1041 ret = drm_helper_crtc_mode_set_base(crtc, x, y, old_fb); in drm_helper_crtc_mode_set()
1045 if (crtc->funcs->atomic_destroy_state) in drm_helper_crtc_mode_set()
1046 crtc->funcs->atomic_destroy_state(crtc, crtc_state); in drm_helper_crtc_mode_set()
1048 drm_atomic_helper_crtc_destroy_state(crtc, crtc_state); in drm_helper_crtc_mode_set()
1057 * @crtc: DRM CRTC
1058 * @x: x offset of the CRTC scanout area on the underlying framebuffer
1059 * @y: y offset of the CRTC scanout area on the underlying framebuffer
1063 * required by the CRTC helpers. The driver must provide the atomic plane helper
1069 int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, in drm_helper_crtc_mode_set_base() argument
1073 struct drm_plane *plane = crtc->primary; in drm_helper_crtc_mode_set_base()
1087 plane_state->crtc = crtc; in drm_helper_crtc_mode_set_base()
1088 drm_atomic_set_fb_for_plane(plane_state, crtc->primary->fb); in drm_helper_crtc_mode_set_base()
1091 plane_state->crtc_h = crtc->mode.vdisplay; in drm_helper_crtc_mode_set_base()
1092 plane_state->crtc_w = crtc->mode.hdisplay; in drm_helper_crtc_mode_set_base()
1095 plane_state->src_h = crtc->mode.vdisplay << 16; in drm_helper_crtc_mode_set_base()
1096 plane_state->src_w = crtc->mode.hdisplay << 16; in drm_helper_crtc_mode_set_base()