Lines Matching +full:non +full:- +full:disruptive

2  * Copyright (c) 2006-2008 Intel Corporation
56 * track of a per-connector hpd interrupt.
73 if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && in drm_mode_validate_flag()
77 if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) && in drm_mode_validate_flag()
81 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) && in drm_mode_validate_flag()
94 struct drm_device *dev = connector->dev; in drm_mode_validate_pipeline()
119 &connector->display_info, in drm_mode_validate_pipeline()
149 cmdline_mode = &connector->cmdline_mode; in drm_helper_probe_add_cmdline_mode()
150 if (!cmdline_mode->specified) in drm_helper_probe_add_cmdline_mode()
154 list_for_each_entry(mode, &connector->probed_modes, head) { in drm_helper_probe_add_cmdline_mode()
155 if (mode->hdisplay != cmdline_mode->xres || in drm_helper_probe_add_cmdline_mode()
156 mode->vdisplay != cmdline_mode->yres) in drm_helper_probe_add_cmdline_mode()
159 if (cmdline_mode->refresh_specified) { in drm_helper_probe_add_cmdline_mode()
161 if (drm_mode_vrefresh(mode) != cmdline_mode->refresh) in drm_helper_probe_add_cmdline_mode()
166 mode->type |= DRM_MODE_TYPE_USERDEF; in drm_helper_probe_add_cmdline_mode()
170 mode = drm_mode_create_from_cmdline_mode(connector->dev, in drm_helper_probe_add_cmdline_mode()
182 const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; in drm_crtc_mode_valid()
184 if (!crtc_funcs || !crtc_funcs->mode_valid) in drm_crtc_mode_valid()
187 return crtc_funcs->mode_valid(crtc, mode); in drm_crtc_mode_valid()
194 encoder->helper_private; in drm_encoder_mode_valid()
196 if (!encoder_funcs || !encoder_funcs->mode_valid) in drm_encoder_mode_valid()
199 return encoder_funcs->mode_valid(encoder, mode); in drm_encoder_mode_valid()
209 connector->helper_private; in drm_connector_mode_valid()
214 else if (connector_funcs->mode_valid_ctx) in drm_connector_mode_valid()
215 ret = connector_funcs->mode_valid_ctx(connector, mode, ctx, in drm_connector_mode_valid()
217 else if (connector_funcs->mode_valid) in drm_connector_mode_valid()
218 *status = connector_funcs->mode_valid(connector, mode); in drm_connector_mode_valid()
233 connector->helper_private; in drm_kms_helper_disable_hpd()
235 if (funcs && funcs->disable_hpd) in drm_kms_helper_disable_hpd()
236 funcs->disable_hpd(connector); in drm_kms_helper_disable_hpd()
250 connector->helper_private; in drm_kms_helper_enable_hpd()
252 if (funcs && funcs->enable_hpd) in drm_kms_helper_enable_hpd()
253 funcs->enable_hpd(connector); in drm_kms_helper_enable_hpd()
255 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | in drm_kms_helper_enable_hpd()
269 if (dev->mode_config.delayed_event) in reschedule_output_poll_work()
282 schedule_delayed_work(&dev->mode_config.output_poll_work, delay); in reschedule_output_poll_work()
286 * drm_kms_helper_poll_enable - re-enable output polling.
289 * This function re-enables the output polling work, after it has been
305 if (drm_WARN_ON_ONCE(dev, !dev->mode_config.poll_enabled) || in drm_kms_helper_poll_enable()
306 !drm_kms_helper_poll || dev->mode_config.poll_running) in drm_kms_helper_poll_enable()
310 dev->mode_config.delayed_event) in drm_kms_helper_poll_enable()
313 dev->mode_config.poll_running = true; in drm_kms_helper_poll_enable()
318 * drm_kms_helper_poll_reschedule - reschedule the output polling work
335 if (dev->mode_config.poll_running) in drm_kms_helper_poll_reschedule()
343 const struct drm_connector_helper_funcs *funcs = connector->helper_private; in drm_helper_probe_detect_ctx()
350 ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx); in drm_helper_probe_detect_ctx()
352 if (funcs->detect_ctx) in drm_helper_probe_detect_ctx()
353 ret = funcs->detect_ctx(connector, &ctx, force); in drm_helper_probe_detect_ctx()
354 else if (connector->funcs->detect) in drm_helper_probe_detect_ctx()
355 ret = connector->funcs->detect(connector, force); in drm_helper_probe_detect_ctx()
360 if (ret == -EDEADLK) { in drm_helper_probe_detect_ctx()
368 if (ret != connector->status) in drm_helper_probe_detect_ctx()
369 connector->epoch_counter += 1; in drm_helper_probe_detect_ctx()
378 * drm_helper_probe_detect - probe connector status
385 * if @ctx is set, it might also return -EDEADLK.
392 const struct drm_connector_helper_funcs *funcs = connector->helper_private; in drm_helper_probe_detect()
393 struct drm_device *dev = connector->dev; in drm_helper_probe_detect()
399 ret = drm_modeset_lock(&dev->mode_config.connection_mutex, ctx); in drm_helper_probe_detect()
403 if (funcs->detect_ctx) in drm_helper_probe_detect()
404 ret = funcs->detect_ctx(connector, ctx, force); in drm_helper_probe_detect()
405 else if (connector->funcs->detect) in drm_helper_probe_detect()
406 ret = connector->funcs->detect(connector, force); in drm_helper_probe_detect()
410 if (ret != connector->status) in drm_helper_probe_detect()
411 connector->epoch_counter += 1; in drm_helper_probe_detect()
420 connector->helper_private; in drm_helper_probe_get_modes()
423 count = connector_funcs->get_modes(connector); in drm_helper_probe_get_modes()
427 drm_err(connector->dev, ".get_modes() returned %pe\n", in drm_helper_probe_get_modes()
436 if (count == 0 && connector->status == connector_status_connected) in drm_helper_probe_get_modes()
446 struct drm_device *dev = connector->dev; in __drm_helper_update_and_validate()
453 if (connector->interlace_allowed) in __drm_helper_update_and_validate()
455 if (connector->doublescan_allowed) in __drm_helper_update_and_validate()
457 if (connector->stereo_allowed) in __drm_helper_update_and_validate()
460 list_for_each_entry(mode, &connector->modes, head) { in __drm_helper_update_and_validate()
461 if (mode->status != MODE_OK) in __drm_helper_update_and_validate()
464 mode->status = drm_mode_validate_driver(dev, mode); in __drm_helper_update_and_validate()
465 if (mode->status != MODE_OK) in __drm_helper_update_and_validate()
468 mode->status = drm_mode_validate_size(mode, maxX, maxY); in __drm_helper_update_and_validate()
469 if (mode->status != MODE_OK) in __drm_helper_update_and_validate()
472 mode->status = drm_mode_validate_flag(mode, mode_flags); in __drm_helper_update_and_validate()
473 if (mode->status != MODE_OK) in __drm_helper_update_and_validate()
477 &mode->status); in __drm_helper_update_and_validate()
483 if (drm_WARN_ON_ONCE(dev, ret != -EDEADLK)) in __drm_helper_update_and_validate()
484 mode->status = MODE_ERROR; in __drm_helper_update_and_validate()
486 return -EDEADLK; in __drm_helper_update_and_validate()
489 if (mode->status != MODE_OK) in __drm_helper_update_and_validate()
491 mode->status = drm_mode_validate_ycbcr420(mode, connector); in __drm_helper_update_and_validate()
498 * drm_helper_probe_single_connector_modes - get complete set of display modes
520 * - &drm_connector_helper_funcs.get_modes vfunc
521 * - if the connector status is connector_status_connected, standard
534 * 4. Any non-stale mode on the modes list then undergoes validation
536 * - drm_mode_validate_basic() performs basic sanity checks
537 * - drm_mode_validate_size() filters out modes larger than @maxX and @maxY
539 * - drm_mode_validate_flag() checks the modes against basic connector
541 * - the optional &drm_connector_helper_funcs.mode_valid or
544 * - the optional &drm_crtc_helper_funcs.mode_valid,
559 struct drm_device *dev = connector->dev; in drm_helper_probe_single_connector_modes()
565 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); in drm_helper_probe_single_connector_modes()
569 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, in drm_helper_probe_single_connector_modes()
570 connector->name); in drm_helper_probe_single_connector_modes()
573 ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx); in drm_helper_probe_single_connector_modes()
574 if (ret == -EDEADLK) { in drm_helper_probe_single_connector_modes()
581 list_for_each_entry(mode, &connector->modes, head) in drm_helper_probe_single_connector_modes()
582 mode->status = MODE_STALE; in drm_helper_probe_single_connector_modes()
584 old_status = connector->status; in drm_helper_probe_single_connector_modes()
586 if (connector->force) { in drm_helper_probe_single_connector_modes()
587 if (connector->force == DRM_FORCE_ON || in drm_helper_probe_single_connector_modes()
588 connector->force == DRM_FORCE_ON_DIGITAL) in drm_helper_probe_single_connector_modes()
589 connector->status = connector_status_connected; in drm_helper_probe_single_connector_modes()
591 connector->status = connector_status_disconnected; in drm_helper_probe_single_connector_modes()
592 if (connector->funcs->force) in drm_helper_probe_single_connector_modes()
593 connector->funcs->force(connector); in drm_helper_probe_single_connector_modes()
597 if (ret == -EDEADLK) { in drm_helper_probe_single_connector_modes()
603 connector->status = ret; in drm_helper_probe_single_connector_modes()
612 if (old_status != connector->status) { in drm_helper_probe_single_connector_modes()
614 connector->base.id, in drm_helper_probe_single_connector_modes()
615 connector->name, in drm_helper_probe_single_connector_modes()
617 drm_get_connector_status_name(connector->status)); in drm_helper_probe_single_connector_modes()
625 dev->mode_config.delayed_event = true; in drm_helper_probe_single_connector_modes()
626 if (dev->mode_config.poll_enabled) in drm_helper_probe_single_connector_modes()
628 &dev->mode_config.output_poll_work, in drm_helper_probe_single_connector_modes()
633 * Re-enable polling in case the global poll config changed but polling in drm_helper_probe_single_connector_modes()
636 if (dev->mode_config.poll_enabled) in drm_helper_probe_single_connector_modes()
639 if (connector->status == connector_status_disconnected) { in drm_helper_probe_single_connector_modes()
641 connector->base.id, connector->name); in drm_helper_probe_single_connector_modes()
643 drm_mode_prune_invalid(dev, &connector->modes, false); in drm_helper_probe_single_connector_modes()
649 if (count == 0 && (connector->status == connector_status_connected || in drm_helper_probe_single_connector_modes()
650 connector->status == connector_status_unknown)) { in drm_helper_probe_single_connector_modes()
658 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) in drm_helper_probe_single_connector_modes()
664 if (ret == -EDEADLK) { in drm_helper_probe_single_connector_modes()
670 drm_mode_prune_invalid(dev, &connector->modes, true); in drm_helper_probe_single_connector_modes()
679 if (list_empty(&connector->modes) && in drm_helper_probe_single_connector_modes()
680 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { in drm_helper_probe_single_connector_modes()
683 if (ret == -EDEADLK) { in drm_helper_probe_single_connector_modes()
687 drm_mode_prune_invalid(dev, &connector->modes, true); in drm_helper_probe_single_connector_modes()
694 if (list_empty(&connector->modes)) in drm_helper_probe_single_connector_modes()
697 drm_mode_sort(&connector->modes); in drm_helper_probe_single_connector_modes()
699 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id, in drm_helper_probe_single_connector_modes()
700 connector->name); in drm_helper_probe_single_connector_modes()
701 list_for_each_entry(mode, &connector->modes, head) { in drm_helper_probe_single_connector_modes()
711 * drm_kms_helper_hotplug_event - fire off KMS hotplug events
720 * own, like drm_helper_hpd_irq_event() does - this is assumed to be done by the
733 if (dev->mode_config.funcs->output_poll_changed) in drm_kms_helper_hotplug_event()
734 dev->mode_config.funcs->output_poll_changed(dev); in drm_kms_helper_hotplug_event()
741 * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event
745 * fine-grained uevent for a single connector.
749 struct drm_device *dev = connector->dev; in drm_kms_helper_connector_hotplug_event()
753 if (dev->mode_config.funcs->output_poll_changed) in drm_kms_helper_connector_hotplug_event()
754 dev->mode_config.funcs->output_poll_changed(dev); in drm_kms_helper_connector_hotplug_event()
770 if (!dev->mode_config.poll_enabled) in output_poll_execute()
774 changed = dev->mode_config.delayed_event; in output_poll_execute()
775 dev->mode_config.delayed_event = false; in output_poll_execute()
777 if (!drm_kms_helper_poll && dev->mode_config.poll_running) { in output_poll_execute()
779 dev->mode_config.poll_running = false; in output_poll_execute()
783 if (!mutex_trylock(&dev->mode_config.mutex)) { in output_poll_execute()
791 if (connector->force) in output_poll_execute()
796 if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) in output_poll_execute()
799 old_status = connector->status; in output_poll_execute()
803 !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) in output_poll_execute()
808 old_epoch_counter = connector->epoch_counter; in output_poll_execute()
809 connector->status = drm_helper_probe_detect(connector, NULL, false); in output_poll_execute()
810 if (old_epoch_counter != connector->epoch_counter) { in output_poll_execute()
815 * that drivers can avoid to do disruptive tests (e.g. in output_poll_execute()
818 * flip-flop between unknown here in the poll work and in output_poll_execute()
826 if (connector->status == connector_status_unknown) { in output_poll_execute()
827 connector->status = old_status; in output_poll_execute()
832 new = drm_get_connector_status_name(connector->status); in output_poll_execute()
836 connector->base.id, in output_poll_execute()
837 connector->name, in output_poll_execute()
839 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n", in output_poll_execute()
840 connector->base.id, connector->name, in output_poll_execute()
841 old_epoch_counter, connector->epoch_counter); in output_poll_execute()
848 mutex_unlock(&dev->mode_config.mutex); in output_poll_execute()
859 * drm_kms_helper_is_poll_worker - is %current task an output poll worker?
868 * connector ->detect hook.
874 return work && work->func == output_poll_execute; in drm_kms_helper_is_poll_worker()
879 * drm_kms_helper_poll_disable - disable output polling
886 * disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable().
897 if (drm_WARN_ON(dev, !dev->mode_config.poll_enabled)) in drm_kms_helper_poll_disable()
900 if (dev->mode_config.poll_running) in drm_kms_helper_poll_disable()
903 cancel_delayed_work_sync(&dev->mode_config.output_poll_work); in drm_kms_helper_poll_disable()
905 dev->mode_config.poll_running = false; in drm_kms_helper_poll_disable()
910 * drm_kms_helper_poll_init - initialize and enable output polling
930 INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute); in drm_kms_helper_poll_init()
931 dev->mode_config.poll_enabled = true; in drm_kms_helper_poll_init()
938 * drm_kms_helper_poll_fini - disable output polling and clean it up
943 if (!dev->mode_config.poll_enabled) in drm_kms_helper_poll_fini()
948 dev->mode_config.poll_enabled = false; in drm_kms_helper_poll_fini()
954 struct drm_device *dev = connector->dev; in check_connector_changed()
959 drm_WARN_ON(dev, !(connector->polled & DRM_CONNECTOR_POLL_HPD)); in check_connector_changed()
961 drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex)); in check_connector_changed()
963 old_status = connector->status; in check_connector_changed()
964 old_epoch_counter = connector->epoch_counter; in check_connector_changed()
965 connector->status = drm_helper_probe_detect(connector, NULL, false); in check_connector_changed()
967 if (old_epoch_counter == connector->epoch_counter) { in check_connector_changed()
969 connector->base.id, in check_connector_changed()
970 connector->name, in check_connector_changed()
971 connector->epoch_counter); in check_connector_changed()
977 connector->base.id, in check_connector_changed()
978 connector->name, in check_connector_changed()
980 drm_get_connector_status_name(connector->status)); in check_connector_changed()
983 connector->base.id, in check_connector_changed()
984 connector->name, in check_connector_changed()
986 connector->epoch_counter); in check_connector_changed()
992 * drm_connector_helper_hpd_irq_event - hotplug processing
1014 struct drm_device *dev = connector->dev; in drm_connector_helper_hpd_irq_event()
1017 mutex_lock(&dev->mode_config.mutex); in drm_connector_helper_hpd_irq_event()
1019 mutex_unlock(&dev->mode_config.mutex); in drm_connector_helper_hpd_irq_event()
1024 connector->base.id, in drm_connector_helper_hpd_irq_event()
1025 connector->name); in drm_connector_helper_hpd_irq_event()
1033 * drm_helper_hpd_irq_event - hotplug processing
1045 * which have a more fine-grained detect logic can use
1065 if (!dev->mode_config.poll_enabled) in drm_helper_hpd_irq_event()
1068 mutex_lock(&dev->mode_config.mutex); in drm_helper_hpd_irq_event()
1072 if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) in drm_helper_hpd_irq_event()
1085 mutex_unlock(&dev->mode_config.mutex); in drm_helper_hpd_irq_event()
1100 * drm_crtc_helper_mode_valid_fixed - Validates a display mode
1106 * MODE_OK on success, or another mode-status code otherwise.
1112 if (mode->hdisplay != fixed_mode->hdisplay && mode->vdisplay != fixed_mode->vdisplay) in drm_crtc_helper_mode_valid_fixed()
1114 else if (mode->hdisplay != fixed_mode->hdisplay) in drm_crtc_helper_mode_valid_fixed()
1116 else if (mode->vdisplay != fixed_mode->vdisplay) in drm_crtc_helper_mode_valid_fixed()
1124 * drm_connector_helper_get_modes_from_ddc - Updates the connector's EDID
1142 if (!connector->ddc) in drm_connector_helper_get_modes_from_ddc()
1145 edid = drm_get_edid(connector, connector->ddc); in drm_connector_helper_get_modes_from_ddc()
1160 * drm_connector_helper_get_modes_fixed - Duplicates a display mode for a connector
1174 struct drm_device *dev = connector->dev; in drm_connector_helper_get_modes_fixed()
1184 if (mode->name[0] == '\0') in drm_connector_helper_get_modes_fixed()
1187 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_connector_helper_get_modes_fixed()
1190 if (mode->width_mm) in drm_connector_helper_get_modes_fixed()
1191 connector->display_info.width_mm = mode->width_mm; in drm_connector_helper_get_modes_fixed()
1192 if (mode->height_mm) in drm_connector_helper_get_modes_fixed()
1193 connector->display_info.height_mm = mode->height_mm; in drm_connector_helper_get_modes_fixed()
1200 * drm_connector_helper_get_modes - Read EDID and update connector.
1203 * Read the EDID using drm_edid_read() (which requires that connector->ddc is
1236 * drm_connector_helper_tv_get_modes - Fills the modes availables to a TV connector
1250 struct drm_device *dev = connector->dev; in drm_connector_helper_tv_get_modes()
1252 dev->mode_config.tv_mode_property; in drm_connector_helper_tv_get_modes()
1253 struct drm_cmdline_mode *cmdline = &connector->cmdline_mode; in drm_connector_helper_tv_get_modes()
1267 for (i = 0; i < tv_mode_property->num_values; i++) in drm_connector_helper_tv_get_modes()
1268 supported_tv_modes |= BIT(tv_mode_property->values[i]); in drm_connector_helper_tv_get_modes()
1274 if (drm_object_property_get_default_value(&connector->base, in drm_connector_helper_tv_get_modes()
1279 if (cmdline->tv_mode_specified) in drm_connector_helper_tv_get_modes()
1280 default_mode = cmdline->tv_mode; in drm_connector_helper_tv_get_modes()
1309 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_connector_helper_tv_get_modes()