blob: 3f150dba28b3370743af5f56016e40d162e28445 [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
39enum weston_drm_backend_output_mode {
40 /** The output is disabled */
41 WESTON_DRM_BACKEND_OUTPUT_OFF,
42 /** The output will use the current active mode */
43 WESTON_DRM_BACKEND_OUTPUT_CURRENT,
44 /** The output will use the preferred mode. A modeline can be provided
45 * by setting weston_backend_output_config::modeline in the form of
46 * "WIDTHxHEIGHT" or in the form of an explicit modeline calculated
47 * using e.g. the cvt tool. If a valid modeline is supplied it will be
48 * used, if invalid or NULL the preferred available mode will be used. */
49 WESTON_DRM_BACKEND_OUTPUT_PREFERRED,
50};
51
52struct weston_drm_backend_output_config {
53 struct weston_backend_output_config base;
54
55 /** The pixel format to be used by the output. Valid values are:
56 * - NULL - The format set at backend creation time will be used;
57 * - "xrgb8888";
58 * - "rgb565"
59 * - "xrgb2101010"
60 */
61 char *gbm_format;
62 /** The seat to be used by the output. Set to NULL to use the
63 * default seat. */
64 char *seat;
65 /** The modeline to be used by the output. Refer to the documentation
66 * of WESTON_DRM_BACKEND_OUTPUT_PREFERRED for details. */
67 char *modeline;
68};
69
70/** The backend configuration struct.
71 *
72 * weston_drm_backend_config contains the configuration used by a DRM
73 * backend.
74 */
75struct weston_drm_backend_config {
76 struct weston_backend_config base;
77
78 /** The connector id of the output to be initialized.
79 *
80 * A value of 0 will enable all available outputs.
81 */
82 int connector;
83
84 /** The tty to be used. Set to 0 to use the current tty. */
85 int tty;
86
87 /** Whether to use the pixman renderer instead of the OpenGL ES renderer. */
88 bool use_pixman;
89
90 /** The seat to be used for input and output.
91 *
92 * If NULL the default "seat0" will be used. The backend will
93 * take ownership of the seat_id pointer and will free it on
94 * backend destruction.
95 */
96 char *seat_id;
97
98 /** The pixel format of the framebuffer to be used.
99 *
100 * Valid values are:
101 * - NULL - The default format ("xrgb8888") will be used;
102 * - "xrgb8888";
103 * - "rgb565"
104 * - "xrgb2101010"
105 * The backend will take ownership of the format pointer and will free
106 * it on backend destruction.
107 */
108 char *gbm_format;
109
110 /** Callback used to configure the outputs.
111 *
112 * This function will be called by the backend when a new DRM
113 * output needs to be configured.
114 */
115 enum weston_drm_backend_output_mode
116 (*configure_output)(struct weston_compositor *compositor,
117 bool use_current_mode,
118 const char *name,
119 struct weston_drm_backend_output_config *output_config);
120 bool use_current_mode;
121};
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* WESTON_COMPOSITOR_DRM_H */