xref: /netbsd-src/sys/external/bsd/drm2/dist/include/drm/drm_crtc_helper.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: drm_crtc_helper.h,v 1.5 2021/12/18 23:45:45 riastradh Exp $	*/
2 
3 /*
4  * Copyright © 2006 Keith Packard
5  * Copyright © 2007-2008 Dave Airlie
6  * Copyright © 2007-2008 Intel Corporation
7  *   Jesse Barnes <jesse.barnes@intel.com>
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included in
17  * all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  */
27 
28 /*
29  * The DRM mode setting helper functions are common code for drivers to use if
30  * they wish.  Drivers are not forced to use this code in their
31  * implementations but it would be useful if they code they do use at least
32  * provides a consistent interface and operation to userspace
33  */
34 
35 #ifndef __DRM_CRTC_HELPER_H__
36 #define __DRM_CRTC_HELPER_H__
37 
38 #include <linux/spinlock.h>
39 #include <linux/types.h>
40 #include <linux/idr.h>
41 
42 #include <linux/fb.h>
43 
44 #include <drm/drm_crtc.h>
45 #include <drm/drm_modeset_helper_vtables.h>
46 #include <drm/drm_modeset_helper.h>
47 
48 void drm_helper_disable_unused_functions(struct drm_device *dev);
49 int drm_crtc_helper_set_config(struct drm_mode_set *set,
50 			       struct drm_modeset_acquire_ctx *ctx);
51 bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
52 			      struct drm_display_mode *mode,
53 			      int x, int y,
54 			      struct drm_framebuffer *old_fb);
55 bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
56 bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
57 
58 int drm_helper_connector_dpms(struct drm_connector *connector, int mode);
59 
60 void drm_helper_resume_force_mode(struct drm_device *dev);
61 int drm_helper_force_disable_all(struct drm_device *dev);
62 
63 #endif
64