Lines Matching refs:crtc

232  * @crtc: CRTC to check
237 * Walk @crtc's DRM device's mode_config and see if it's in use.
240 * True if @crtc is part of the mode_config, false otherwise.
242 bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
245 struct drm_device *dev = crtc->dev;
248 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder))
277 struct drm_crtc *crtc;
290 encoder->crtc = NULL;
294 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
295 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
296 crtc->enabled = drm_helper_crtc_in_use(crtc);
297 if (!crtc->enabled) {
299 (*crtc_funcs->disable)(crtc);
301 (*crtc_funcs->dpms)(crtc, DRM_MODE_DPMS_OFF);
302 crtc->fb = NULL;
309 * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
311 * @crtc: crtc to test
313 * Return false if @encoder can't be driven by @crtc, true otherwise.
316 struct drm_crtc *crtc)
322 if (crtc == NULL)
323 DRM_ERROR("checking null crtc?\n");
325 dev = crtc->dev;
328 if (tmp == crtc)
352 if (encoder->crtc == NULL)
356 encoder->crtc != (*encoder_funcs->get_crtc)(encoder))
363 * @crtc: CRTC to program
372 * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance
384 bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
389 struct drm_device *dev = crtc->dev;
391 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
397 crtc->enabled = drm_helper_crtc_in_use(crtc);
398 if (!crtc->enabled)
405 saved_hwmode = crtc->hwmode;
406 saved_mode = crtc->mode;
407 saved_x = crtc->x;
408 saved_y = crtc->y;
410 /* Update crtc values up front so the driver can rely on them for mode
413 crtc->mode = *mode;
414 crtc->x = x;
415 crtc->y = y;
423 if (encoder->crtc != crtc)
433 if (!(ret = crtc_funcs->mode_fixup(crtc, mode, adjusted_mode))) {
437 DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
442 if (encoder->crtc != crtc)
451 crtc_funcs->prepare(crtc);
456 ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb);
462 if (encoder->crtc != crtc)
473 crtc_funcs->commit(crtc);
477 if (encoder->crtc != crtc)
486 crtc->hwmode = *adjusted_mode;
492 drm_calc_timestamping_constants(crtc);
498 crtc->hwmode = saved_hwmode;
499 crtc->mode = saved_mode;
500 crtc->x = saved_x;
501 crtc->y = saved_y;
508 drm_crtc_helper_disable(struct drm_crtc *crtc)
510 struct drm_device *dev = crtc->dev;
514 /* Decouple all encoders and their attached connectors from this crtc */
516 if (encoder->crtc != crtc)
541 * kernel mode setting with the crtc helper functions and the assorted
550 struct drm_crtc *save_crtcs, *new_crtc, *crtc;
565 BUG_ON(!set->crtc);
566 BUG_ON(!set->crtc->helper_private);
572 crtc_funcs = set->crtc->helper_private;
579 set->crtc->base.id, set->fb->base.id,
582 DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id);
583 return drm_crtc_helper_disable(set->crtc);
586 dev = set->crtc->dev;
588 /* Allocate space for the backup of all (non-pointer) crtc, encoder and
615 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
616 save_crtcs[count++] = *crtc;
629 save_set.crtc = set->crtc;
630 save_set.mode = &set->crtc->mode;
631 save_set.x = set->crtc->x;
632 save_set.y = set->crtc->y;
633 save_set.fb = set->crtc->fb;
637 if (set->crtc->fb != set->fb) {
639 if (set->crtc->fb == NULL) {
640 DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
645 set->crtc->fb->pixel_format) {
651 if (set->x != set->crtc->x || set->y != set->crtc->y)
654 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
656 drm_mode_debug_printmodeline(&set->crtc->mode);
689 * the appropriate crtc will be set later.
692 connector->encoder->crtc = NULL;
707 if (connector->encoder->crtc == set->crtc)
710 new_crtc = connector->encoder->crtc;
714 new_crtc = set->crtc;
723 if (new_crtc != connector->encoder->crtc) {
724 DRM_DEBUG_KMS("crtc changed, full mode switch\n");
726 connector->encoder->crtc = new_crtc;
743 set->crtc->enabled = drm_helper_crtc_in_use(set->crtc);
744 if (set->crtc->enabled) {
748 old_fb = set->crtc->fb;
749 set->crtc->fb = set->fb;
750 if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
754 set->crtc->base.id);
755 set->crtc->fb = old_fb;
768 set->crtc->x = set->x;
769 set->crtc->y = set->y;
771 old_fb = set->crtc->fb;
772 if (set->crtc->fb != set->fb)
773 set->crtc->fb = set->fb;
774 ret = crtc_funcs->mode_set_base(set->crtc,
777 set->crtc->fb = old_fb;
790 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
791 *crtc = save_crtcs[count++];
806 !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x,
830 static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc)
834 struct drm_device *dev = crtc->dev;
837 if (connector->encoder && connector->encoder->crtc == crtc)
848 * This is the main helper function provided by the crtc helper framework for
856 struct drm_crtc *crtc = encoder ? encoder->crtc : NULL;
865 /* from off to on, do crtc then encoder */
867 if (crtc) {
868 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
870 (*crtc_funcs->dpms) (crtc,
871 drm_helper_choose_crtc_dpms(crtc));
881 /* from on to off, do encoder then crtc */
889 if (crtc) {
890 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
892 (*crtc_funcs->dpms) (crtc,
893 drm_helper_choose_crtc_dpms(crtc));
921 struct drm_crtc *crtc;
927 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
929 if (!crtc->enabled)
932 ret = drm_crtc_helper_set_mode(crtc, &crtc->mode,
933 crtc->x, crtc->y, crtc->fb);
936 DRM_ERROR("failed to set mode on crtc %p\n", (void *)crtc);
939 if (drm_helper_choose_crtc_dpms(crtc)) {
942 if(encoder->crtc != crtc)
951 crtc_funcs = crtc->helper_private;
953 (*crtc_funcs->dpms) (crtc,
954 drm_helper_choose_crtc_dpms(crtc));