blob: 1266031f09f15b4df99244d8a663335d36b6a76a [file] [log] [blame]
Giulio Camuffo1c0e40d2016-04-29 15:40:34 -07001/*
2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2011 Intel Corporation
4 * Copyright © 2015 Giulio Camuffo
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28#ifndef WESTON_COMPOSITOR_DRM_H
29#define WESTON_COMPOSITOR_DRM_H
30
31#include "compositor.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define WESTON_DRM_BACKEND_CONFIG_VERSION 1
38
Giulio Camuffo8aedf7b2016-06-02 21:48:12 +030039struct libinput_device;
40
Giulio Camuffo1c0e40d2016-04-29 15:40:34 -070041enum weston_drm_backend_output_mode {
42 /** The output is disabled */
43 WESTON_DRM_BACKEND_OUTPUT_OFF,
44 /** The output will use the current active mode */
45 WESTON_DRM_BACKEND_OUTPUT_CURRENT,
46 /** The output will use the preferred mode. A modeline can be provided
47 * by setting weston_backend_output_config::modeline in the form of
48 * "WIDTHxHEIGHT" or in the form of an explicit modeline calculated
49 * using e.g. the cvt tool. If a valid modeline is supplied it will be
50 * used, if invalid or NULL the preferred available mode will be used. */
51 WESTON_DRM_BACKEND_OUTPUT_PREFERRED,
52};
53
54struct weston_drm_backend_output_config {
55 struct weston_backend_output_config base;
56
57 /** The pixel format to be used by the output. Valid values are:
58 * - NULL - The format set at backend creation time will be used;
59 * - "xrgb8888";
60 * - "rgb565"
61 * - "xrgb2101010"
62 */
63 char *gbm_format;
64 /** The seat to be used by the output. Set to NULL to use the
65 * default seat. */
66 char *seat;
67 /** The modeline to be used by the output. Refer to the documentation
68 * of WESTON_DRM_BACKEND_OUTPUT_PREFERRED for details. */
69 char *modeline;
70};
71
72/** The backend configuration struct.
73 *
74 * weston_drm_backend_config contains the configuration used by a DRM
75 * backend.
76 */
77struct weston_drm_backend_config {
78 struct weston_backend_config base;
79
80 /** The connector id of the output to be initialized.
81 *
82 * A value of 0 will enable all available outputs.
83 */
84 int connector;
85
86 /** The tty to be used. Set to 0 to use the current tty. */
87 int tty;
88
89 /** Whether to use the pixman renderer instead of the OpenGL ES renderer. */
90 bool use_pixman;
91
92 /** The seat to be used for input and output.
93 *
94 * If NULL the default "seat0" will be used. The backend will
95 * take ownership of the seat_id pointer and will free it on
96 * backend destruction.
97 */
98 char *seat_id;
99
100 /** The pixel format of the framebuffer to be used.
101 *
102 * Valid values are:
103 * - NULL - The default format ("xrgb8888") will be used;
104 * - "xrgb8888";
105 * - "rgb565"
106 * - "xrgb2101010"
107 * The backend will take ownership of the format pointer and will free
108 * it on backend destruction.
109 */
110 char *gbm_format;
111
112 /** Callback used to configure the outputs.
113 *
114 * This function will be called by the backend when a new DRM
115 * output needs to be configured.
116 */
117 enum weston_drm_backend_output_mode
118 (*configure_output)(struct weston_compositor *compositor,
119 bool use_current_mode,
120 const char *name,
121 struct weston_drm_backend_output_config *output_config);
Giulio Camuffo8aedf7b2016-06-02 21:48:12 +0300122
123 /** Callback used to configure input devices.
124 *
125 * This function will be called by the backend when a new input device
126 * needs to be configured.
127 * If NULL the device will use the default configuration.
128 */
129 void (*configure_device)(struct weston_compositor *compositor,
130 struct libinput_device *device);
Giulio Camuffo1c0e40d2016-04-29 15:40:34 -0700131 bool use_current_mode;
132};
133
134#ifdef __cplusplus
135}
136#endif
137
138#endif /* WESTON_COMPOSITOR_DRM_H */