1f453ba04SDave Airlie /* 2f453ba04SDave Airlie * Copyright © 2006 Keith Packard 3f453ba04SDave Airlie * Copyright © 2007-2008 Dave Airlie 4f453ba04SDave Airlie * Copyright © 2007-2008 Intel Corporation 5f453ba04SDave Airlie * Jesse Barnes <jesse.barnes@intel.com> 6f453ba04SDave Airlie * 7f453ba04SDave Airlie * Permission is hereby granted, free of charge, to any person obtaining a 8f453ba04SDave Airlie * copy of this software and associated documentation files (the "Software"), 9f453ba04SDave Airlie * to deal in the Software without restriction, including without limitation 10f453ba04SDave Airlie * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11f453ba04SDave Airlie * and/or sell copies of the Software, and to permit persons to whom the 12f453ba04SDave Airlie * Software is furnished to do so, subject to the following conditions: 13f453ba04SDave Airlie * 14f453ba04SDave Airlie * The above copyright notice and this permission notice shall be included in 15f453ba04SDave Airlie * all copies or substantial portions of the Software. 16f453ba04SDave Airlie * 17f453ba04SDave Airlie * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18f453ba04SDave Airlie * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19f453ba04SDave Airlie * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20f453ba04SDave Airlie * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 21f453ba04SDave Airlie * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22f453ba04SDave Airlie * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23f453ba04SDave Airlie * OTHER DEALINGS IN THE SOFTWARE. 24f453ba04SDave Airlie */ 25f453ba04SDave Airlie 26f453ba04SDave Airlie /* 27f453ba04SDave Airlie * The DRM mode setting helper functions are common code for drivers to use if 28f453ba04SDave Airlie * they wish. Drivers are not forced to use this code in their 29f453ba04SDave Airlie * implementations but it would be useful if they code they do use at least 30f453ba04SDave Airlie * provides a consistent interface and operation to userspace 31f453ba04SDave Airlie */ 32f453ba04SDave Airlie 33f453ba04SDave Airlie #ifndef __DRM_CRTC_HELPER_H__ 34f453ba04SDave Airlie #define __DRM_CRTC_HELPER_H__ 35f453ba04SDave Airlie 36f453ba04SDave Airlie #include <linux/spinlock.h> 37f453ba04SDave Airlie #include <linux/types.h> 38f453ba04SDave Airlie #include <linux/idr.h> 39f453ba04SDave Airlie 40f453ba04SDave Airlie #include <linux/fb.h> 41f453ba04SDave Airlie 426d11a2f0SThierry Reding #include <drm/drm_crtc.h> 43092d01daSDaniel Vetter #include <drm/drm_modeset_helper_vtables.h> 441de72fafSDaniel Vetter #include <drm/drm_modeset_helper.h> 45f453ba04SDave Airlie 4691faa047SDaniel Vetter void drm_helper_disable_unused_functions(struct drm_device *dev); 47a4eff9aaSDaniel Vetter int drm_crtc_helper_set_config(struct drm_mode_set *set, 48a4eff9aaSDaniel Vetter struct drm_modeset_acquire_ctx *ctx); 4991faa047SDaniel Vetter bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 50f453ba04SDave Airlie struct drm_display_mode *mode, 513c4fdcfbSKristian Høgsberg int x, int y, 523c4fdcfbSKristian Høgsberg struct drm_framebuffer *old_fb); 5391faa047SDaniel Vetter bool drm_helper_crtc_in_use(struct drm_crtc *crtc); 5491faa047SDaniel Vetter bool drm_helper_encoder_in_use(struct drm_encoder *encoder); 55f453ba04SDave Airlie 5691faa047SDaniel Vetter int drm_helper_connector_dpms(struct drm_connector *connector, int mode); 57c9fb15f6SKeith Packard 5891faa047SDaniel Vetter void drm_helper_resume_force_mode(struct drm_device *dev); 598d754544SDaniel Vetter 602f324b42SDaniel Vetter int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, 612f324b42SDaniel Vetter struct drm_display_mode *adjusted_mode, int x, int y, 622f324b42SDaniel Vetter struct drm_framebuffer *old_fb); 632f324b42SDaniel Vetter int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, 642f324b42SDaniel Vetter struct drm_framebuffer *old_fb); 652f324b42SDaniel Vetter 668d754544SDaniel Vetter /* drm_probe_helper.c */ 6791faa047SDaniel Vetter int drm_helper_probe_single_connector_modes(struct drm_connector 688d754544SDaniel Vetter *connector, uint32_t maxX, 698d754544SDaniel Vetter uint32_t maxY); 706c5ed5aeSMaarten Lankhorst int drm_helper_probe_detect(struct drm_connector *connector, 716c5ed5aeSMaarten Lankhorst struct drm_modeset_acquire_ctx *ctx, 726c5ed5aeSMaarten Lankhorst bool force); 7391faa047SDaniel Vetter void drm_kms_helper_poll_init(struct drm_device *dev); 7491faa047SDaniel Vetter void drm_kms_helper_poll_fini(struct drm_device *dev); 7591faa047SDaniel Vetter bool drm_helper_hpd_irq_event(struct drm_device *dev); 7691faa047SDaniel Vetter void drm_kms_helper_hotplug_event(struct drm_device *dev); 77fbf81762SDave Airlie 7891faa047SDaniel Vetter void drm_kms_helper_poll_disable(struct drm_device *dev); 7991faa047SDaniel Vetter void drm_kms_helper_poll_enable(struct drm_device *dev); 8025c058ccSLukas Wunner bool drm_kms_helper_is_poll_worker(void); 81d0d110e0SVille Syrjälä 82f453ba04SDave Airlie #endif 83