blob: dbd5ace44b52d23295a3abf7765560ea73c34996 [file] [log] [blame]
Daniel Stonedd1bc502019-06-17 12:13:46 +01001/*
2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2011 Intel Corporation
4 * Copyright © 2017, 2018 Collabora, Ltd.
5 * Copyright © 2017, 2018 General Electric Company
6 * Copyright (c) 2018 DisplayLink (UK) Ltd.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial
18 * portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 */
29
30#include "config.h"
31
32#include <errno.h>
33#include <stdint.h>
34#include <stdlib.h>
35#include <ctype.h>
36#include <string.h>
37#include <fcntl.h>
38#include <unistd.h>
39#include <linux/input.h>
40#include <linux/vt.h>
41#include <assert.h>
42#include <sys/mman.h>
43#include <time.h>
44
45
46#include <xf86drm.h>
47#include <xf86drmMode.h>
48#include <drm_fourcc.h>
49
50#include <gbm.h>
51#include <libudev.h>
52
53#include <libweston/libweston.h>
54#include <libweston/backend-drm.h>
Marius Vladc901e892019-06-21 22:49:18 +030055#include <libweston/weston-log.h>
Daniel Stonedd1bc502019-06-17 12:13:46 +010056#include "shared/helpers.h"
57#include "libinput-seat.h"
Marius Vlade41c1bf2019-07-16 23:11:25 +030058#include "backend.h"
Marius Vlada72e3712019-07-10 13:46:39 +030059#include "libweston-internal.h"
Daniel Stonedd1bc502019-06-17 12:13:46 +010060
61#ifndef DRM_CLIENT_CAP_ASPECT_RATIO
62#define DRM_CLIENT_CAP_ASPECT_RATIO 4
63#endif
64
65#ifndef GBM_BO_USE_CURSOR
66#define GBM_BO_USE_CURSOR GBM_BO_USE_CURSOR_64X64
67#endif
68
69#ifndef GBM_BO_USE_LINEAR
70#define GBM_BO_USE_LINEAR (1 << 4)
71#endif
72
73/**
74 * A small wrapper to print information into the 'drm-backend' debug scope.
75 *
76 * The following conventions are used to print variables:
77 *
78 * - fixed uint32_t values, including Weston object IDs such as weston_output
79 * IDs, DRM object IDs such as CRTCs or properties, and GBM/DRM formats:
80 * "%lu (0x%lx)" (unsigned long) value, (unsigned long) value
81 *
82 * - fixed uint64_t values, such as DRM property values (including object IDs
83 * when used as a value):
84 * "%llu (0x%llx)" (unsigned long long) value, (unsigned long long) value
85 *
86 * - non-fixed-width signed int:
87 * "%d" value
88 *
89 * - non-fixed-width unsigned int:
90 * "%u (0x%x)" value, value
91 *
92 * - non-fixed-width unsigned long:
93 * "%lu (0x%lx)" value, value
94 *
95 * Either the integer or hexadecimal forms may be omitted if it is known that
96 * one representation is not useful (e.g. width/height in hex are rarely what
97 * you want).
98 *
99 * This is to avoid implicit widening or narrowing when we use fixed-size
100 * types: uint32_t can be resolved by either unsigned int or unsigned long
101 * on a 32-bit system but only unsigned int on a 64-bit system, with uint64_t
102 * being unsigned long long on a 32-bit system and unsigned long on a 64-bit
103 * system. To avoid confusing side effects, we explicitly cast to the widest
104 * possible type and use a matching format specifier.
105 */
106#define drm_debug(b, ...) \
107 weston_log_scope_printf((b)->debug, __VA_ARGS__)
108
109#define MAX_CLONED_CONNECTORS 4
110
111/**
112 * aspect ratio info taken from the drmModeModeInfo flag bits 19-22,
113 * which should be used to fill the aspect ratio field in weston_mode.
114 */
115#define DRM_MODE_FLAG_PIC_AR_BITS_POS 19
116#ifndef DRM_MODE_FLAG_PIC_AR_MASK
117#define DRM_MODE_FLAG_PIC_AR_MASK (0xF << DRM_MODE_FLAG_PIC_AR_BITS_POS)
118#endif
119
120/**
121 * Represents the values of an enum-type KMS property
122 */
123struct drm_property_enum_info {
124 const char *name; /**< name as string (static, not freed) */
125 bool valid; /**< true if value is supported; ignore if false */
126 uint64_t value; /**< raw value */
127};
128
129/**
130 * Holds information on a DRM property, including its ID and the enum
131 * values it holds.
132 *
133 * DRM properties are allocated dynamically, and maintained as DRM objects
134 * within the normal object ID space; they thus do not have a stable ID
135 * to refer to. This includes enum values, which must be referred to by
136 * integer values, but these are not stable.
137 *
138 * drm_property_info allows a cache to be maintained where Weston can use
139 * enum values internally to refer to properties, with the mapping to DRM
140 * ID values being maintained internally.
141 */
142struct drm_property_info {
143 const char *name; /**< name as string (static, not freed) */
144 uint32_t prop_id; /**< KMS property object ID */
145 unsigned int num_enum_values; /**< number of enum values */
146 struct drm_property_enum_info *enum_values; /**< array of enum values */
147};
148
149/**
150 * List of properties attached to DRM planes
151 */
152enum wdrm_plane_property {
153 WDRM_PLANE_TYPE = 0,
154 WDRM_PLANE_SRC_X,
155 WDRM_PLANE_SRC_Y,
156 WDRM_PLANE_SRC_W,
157 WDRM_PLANE_SRC_H,
158 WDRM_PLANE_CRTC_X,
159 WDRM_PLANE_CRTC_Y,
160 WDRM_PLANE_CRTC_W,
161 WDRM_PLANE_CRTC_H,
162 WDRM_PLANE_FB_ID,
163 WDRM_PLANE_CRTC_ID,
164 WDRM_PLANE_IN_FORMATS,
165 WDRM_PLANE_IN_FENCE_FD,
166 WDRM_PLANE_FB_DAMAGE_CLIPS,
167 WDRM_PLANE__COUNT
168};
169
170/**
171 * Possible values for the WDRM_PLANE_TYPE property.
172 */
173enum wdrm_plane_type {
174 WDRM_PLANE_TYPE_PRIMARY = 0,
175 WDRM_PLANE_TYPE_CURSOR,
176 WDRM_PLANE_TYPE_OVERLAY,
177 WDRM_PLANE_TYPE__COUNT
178};
179
180/**
181 * List of properties attached to a DRM connector
182 */
183enum wdrm_connector_property {
184 WDRM_CONNECTOR_EDID = 0,
185 WDRM_CONNECTOR_DPMS,
186 WDRM_CONNECTOR_CRTC_ID,
187 WDRM_CONNECTOR_NON_DESKTOP,
Ankit Nautiyala344fe32019-05-14 18:36:08 +0530188 WDRM_CONNECTOR_CONTENT_PROTECTION,
189 WDRM_CONNECTOR_HDCP_CONTENT_TYPE,
Daniel Stonedd1bc502019-06-17 12:13:46 +0100190 WDRM_CONNECTOR__COUNT
191};
192
Ankit Nautiyala344fe32019-05-14 18:36:08 +0530193enum wdrm_content_protection_state {
194 WDRM_CONTENT_PROTECTION_UNDESIRED = 0,
195 WDRM_CONTENT_PROTECTION_DESIRED,
196 WDRM_CONTENT_PROTECTION_ENABLED,
197 WDRM_CONTENT_PROTECTION__COUNT
198};
199
200enum wdrm_hdcp_content_type {
201 WDRM_HDCP_CONTENT_TYPE0 = 0,
202 WDRM_HDCP_CONTENT_TYPE1,
203 WDRM_HDCP_CONTENT_TYPE__COUNT
204};
205
Daniel Stonedd1bc502019-06-17 12:13:46 +0100206enum wdrm_dpms_state {
207 WDRM_DPMS_STATE_OFF = 0,
208 WDRM_DPMS_STATE_ON,
209 WDRM_DPMS_STATE_STANDBY, /* unused */
210 WDRM_DPMS_STATE_SUSPEND, /* unused */
211 WDRM_DPMS_STATE__COUNT
212};
213
214/**
215 * List of properties attached to DRM CRTCs
216 */
217enum wdrm_crtc_property {
218 WDRM_CRTC_MODE_ID = 0,
219 WDRM_CRTC_ACTIVE,
220 WDRM_CRTC__COUNT
221};
222
223struct drm_backend {
224 struct weston_backend base;
225 struct weston_compositor *compositor;
226
227 struct udev *udev;
228 struct wl_event_source *drm_source;
229
230 struct udev_monitor *udev_monitor;
231 struct wl_event_source *udev_drm_source;
232
233 struct {
234 int id;
235 int fd;
236 char *filename;
237 dev_t devnum;
238 } drm;
239 struct gbm_device *gbm;
240 struct wl_listener session_listener;
241 uint32_t gbm_format;
242
243 /* we need these parameters in order to not fail drmModeAddFB2()
244 * due to out of bounds dimensions, and then mistakenly set
245 * sprites_are_broken:
246 */
247 int min_width, max_width;
248 int min_height, max_height;
249
250 struct wl_list plane_list;
251 int sprites_are_broken;
252 int sprites_hidden;
253
254 void *repaint_data;
255
256 bool state_invalid;
257
258 /* CRTC IDs not used by any enabled output. */
259 struct wl_array unused_crtcs;
260
261 int cursors_are_broken;
262
263 bool universal_planes;
264 bool atomic_modeset;
265
266 bool use_pixman;
267 bool use_pixman_shadow;
268
269 struct udev_input input;
270
271 int32_t cursor_width;
272 int32_t cursor_height;
273
274 uint32_t pageflip_timeout;
275
276 bool shutting_down;
277
278 bool aspect_ratio_supported;
279
280 bool fb_modifiers;
281
282 struct weston_log_scope *debug;
283};
284
285struct drm_mode {
286 struct weston_mode base;
287 drmModeModeInfo mode_info;
288 uint32_t blob_id;
289};
290
291enum drm_fb_type {
292 BUFFER_INVALID = 0, /**< never used */
293 BUFFER_CLIENT, /**< directly sourced from client */
294 BUFFER_DMABUF, /**< imported from linux_dmabuf client */
295 BUFFER_PIXMAN_DUMB, /**< internal Pixman rendering */
296 BUFFER_GBM_SURFACE, /**< internal EGL rendering */
297 BUFFER_CURSOR, /**< internal cursor buffer */
298};
299
300struct drm_fb {
301 enum drm_fb_type type;
302
303 int refcnt;
304
305 uint32_t fb_id, size;
306 uint32_t handles[4];
307 uint32_t strides[4];
308 uint32_t offsets[4];
309 int num_planes;
310 const struct pixel_format_info *format;
311 uint64_t modifier;
312 int width, height;
313 int fd;
314 struct weston_buffer_reference buffer_ref;
315 struct weston_buffer_release_reference buffer_release_ref;
316
317 /* Used by gbm fbs */
318 struct gbm_bo *bo;
319 struct gbm_surface *gbm_surface;
320
321 /* Used by dumb fbs */
322 void *map;
323};
324
325struct drm_edid {
326 char eisa_id[13];
327 char monitor_name[13];
328 char pnp_id[5];
329 char serial_number[13];
330};
331
332/**
333 * Pending state holds one or more drm_output_state structures, collected from
334 * performing repaint. This pending state is transient, and only lives between
335 * beginning a repaint group and flushing the results: after flush, each
336 * output state will complete and be retired separately.
337 */
338struct drm_pending_state {
339 struct drm_backend *backend;
340 struct wl_list output_list;
341};
342
343/*
344 * Output state holds the dynamic state for one Weston output, i.e. a KMS CRTC,
345 * plus >= 1 each of encoder/connector/plane. Since everything but the planes
346 * is currently statically assigned per-output, we mainly use this to track
347 * plane state.
348 *
349 * pending_state is set when the output state is owned by a pending_state,
350 * i.e. when it is being constructed and has not yet been applied. When the
351 * output state has been applied, the owning pending_state is freed.
352 */
353struct drm_output_state {
354 struct drm_pending_state *pending_state;
355 struct drm_output *output;
356 struct wl_list link;
357 enum dpms_enum dpms;
Ankit Nautiyala344fe32019-05-14 18:36:08 +0530358 enum weston_hdcp_protection protection;
Daniel Stonedd1bc502019-06-17 12:13:46 +0100359 struct wl_list plane_list;
360};
361
362/**
363 * Plane state holds the dynamic state for a plane: where it is positioned,
364 * and which buffer it is currently displaying.
365 *
366 * The plane state is owned by an output state, except when setting an initial
367 * state. See drm_output_state for notes on state object lifetime.
368 */
369struct drm_plane_state {
370 struct drm_plane *plane;
371 struct drm_output *output;
372 struct drm_output_state *output_state;
373
374 struct drm_fb *fb;
375
376 struct weston_view *ev; /**< maintained for drm_assign_planes only */
377
378 int32_t src_x, src_y;
379 uint32_t src_w, src_h;
380 int32_t dest_x, dest_y;
381 uint32_t dest_w, dest_h;
382
383 bool complete;
384
385 /* We don't own the fd, so we shouldn't close it */
386 int in_fence_fd;
387
388 pixman_region32_t damage; /* damage to kernel */
389
390 struct wl_list link; /* drm_output_state::plane_list */
391};
392
393/**
394 * A plane represents one buffer, positioned within a CRTC, and stacked
395 * relative to other planes on the same CRTC.
396 *
397 * Each CRTC has a 'primary plane', which use used to display the classic
398 * framebuffer contents, as accessed through the legacy drmModeSetCrtc
399 * call (which combines setting the CRTC's actual physical mode, and the
400 * properties of the primary plane).
401 *
402 * The cursor plane also has its own alternate legacy API.
403 *
404 * Other planes are used opportunistically to display content we do not
405 * wish to blit into the primary plane. These non-primary/cursor planes
406 * are referred to as 'sprites'.
407 */
408struct drm_plane {
409 struct weston_plane base;
410
411 struct drm_backend *backend;
412
413 enum wdrm_plane_type type;
414
415 uint32_t possible_crtcs;
416 uint32_t plane_id;
417 uint32_t count_formats;
418
419 struct drm_property_info props[WDRM_PLANE__COUNT];
420
421 /* The last state submitted to the kernel for this plane. */
422 struct drm_plane_state *state_cur;
423
424 struct wl_list link;
425
426 struct {
427 uint32_t format;
428 uint32_t count_modifiers;
429 uint64_t *modifiers;
430 } formats[];
431};
432
433struct drm_head {
434 struct weston_head base;
435 struct drm_backend *backend;
436
437 drmModeConnector *connector;
438 uint32_t connector_id;
439 struct drm_edid edid;
440
441 /* Holds the properties for the connector */
442 struct drm_property_info props_conn[WDRM_CONNECTOR__COUNT];
443
444 struct backlight *backlight;
445
446 drmModeModeInfo inherited_mode; /**< Original mode on the connector */
447 uint32_t inherited_crtc_id; /**< Original CRTC assignment */
448};
449
450struct drm_output {
451 struct weston_output base;
452 struct drm_backend *backend;
453
454 uint32_t crtc_id; /* object ID to pass to DRM functions */
455 int pipe; /* index of CRTC in resource array / bitmasks */
456
457 /* Holds the properties for the CRTC */
458 struct drm_property_info props_crtc[WDRM_CRTC__COUNT];
459
460 int page_flip_pending;
461 int atomic_complete_pending;
462 int destroy_pending;
463 int disable_pending;
464 int dpms_off_pending;
465
Stefan Agner974390a2019-07-08 00:42:05 +0200466 uint32_t gbm_cursor_handle[2];
Daniel Stonedd1bc502019-06-17 12:13:46 +0100467 struct drm_fb *gbm_cursor_fb[2];
468 struct drm_plane *cursor_plane;
469 struct weston_view *cursor_view;
470 int current_cursor;
471
472 struct gbm_surface *gbm_surface;
473 uint32_t gbm_format;
474 uint32_t gbm_bo_flags;
475
476 /* Plane being displayed directly on the CRTC */
477 struct drm_plane *scanout_plane;
478
479 /* The last state submitted to the kernel for this CRTC. */
480 struct drm_output_state *state_cur;
481 /* The previously-submitted state, where the hardware has not
482 * yet acknowledged completion of state_cur. */
483 struct drm_output_state *state_last;
484
485 struct drm_fb *dumb[2];
486 pixman_image_t *image[2];
487 int current_image;
488 pixman_region32_t previous_damage;
489
490 struct vaapi_recorder *recorder;
491 struct wl_listener recorder_frame_listener;
492
493 struct wl_event_source *pageflip_timer;
494
495 bool virtual;
496
497 submit_frame_cb virtual_submit_frame;
498};
499
500static inline struct drm_head *
501to_drm_head(struct weston_head *base)
502{
503 return container_of(base, struct drm_head, base);
504}
505
506static inline struct drm_output *
507to_drm_output(struct weston_output *base)
508{
509 return container_of(base, struct drm_output, base);
510}
511
512static inline struct drm_backend *
513to_drm_backend(struct weston_compositor *base)
514{
515 return container_of(base->backend, struct drm_backend, base);
516}
517
518static inline struct drm_mode *
519to_drm_mode(struct weston_mode *base)
520{
521 return container_of(base, struct drm_mode, base);
522}
Daniel Stonefbe6c1d2019-06-17 16:04:26 +0100523
Daniel Stone4c2fc702019-06-18 11:12:07 +0100524struct drm_output *
525drm_output_find_by_crtc(struct drm_backend *b, uint32_t crtc_id);
526
527struct drm_head *
528drm_head_find_by_connector(struct drm_backend *backend, uint32_t connector_id);
529
Daniel Stone7580b3c2019-06-18 11:16:53 +0100530static inline bool
531drm_view_transform_supported(struct weston_view *ev, struct weston_output *output)
532{
533 struct weston_buffer_viewport *viewport = &ev->surface->buffer_viewport;
534
535 /* This will incorrectly disallow cases where the combination of
536 * buffer and view transformations match the output transform.
537 * Fixing this requires a full analysis of the transformation
538 * chain. */
539 if (ev->transform.enabled &&
540 ev->transform.matrix.type >= WESTON_MATRIX_TRANSFORM_ROTATE)
541 return false;
542
543 if (viewport->buffer.transform != output->transform)
544 return false;
545
546 return true;
547}
548
Daniel Stonefbe6c1d2019-06-17 16:04:26 +0100549int
550drm_mode_ensure_blob(struct drm_backend *backend, struct drm_mode *mode);
551
552struct drm_mode *
553drm_output_choose_mode(struct drm_output *output,
554 struct weston_mode *target_mode);
555void
556update_head_from_connector(struct drm_head *head,
557 drmModeObjectProperties *props);
558
559void
560drm_mode_list_destroy(struct drm_backend *backend, struct wl_list *mode_list);
561
562void
563drm_output_print_modes(struct drm_output *output);
564
565int
566drm_output_set_mode(struct weston_output *base,
567 enum weston_drm_backend_output_mode mode,
568 const char *modeline);
569
Daniel Stone4c2fc702019-06-18 11:12:07 +0100570void
571drm_property_info_populate(struct drm_backend *b,
572 const struct drm_property_info *src,
573 struct drm_property_info *info,
574 unsigned int num_infos,
575 drmModeObjectProperties *props);
Daniel Stonefbe6c1d2019-06-17 16:04:26 +0100576uint64_t
577drm_property_get_value(struct drm_property_info *info,
578 const drmModeObjectProperties *props,
579 uint64_t def);
Daniel Stone4c2fc702019-06-18 11:12:07 +0100580int
581drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane,
582 const drmModeObjectProperties *props);
583void
584drm_property_info_free(struct drm_property_info *info, int num_props);
585
586extern struct drm_property_enum_info plane_type_enums[];
587extern const struct drm_property_info plane_props[];
588extern struct drm_property_enum_info dpms_state_enums[];
Ankit Nautiyala344fe32019-05-14 18:36:08 +0530589extern struct drm_property_enum_info content_protection_enums[];
590extern struct drm_property_enum_info hdcp_content_type_enums[];
Daniel Stone4c2fc702019-06-18 11:12:07 +0100591extern const struct drm_property_info connector_props[];
592extern const struct drm_property_info crtc_props[];
593
594int
595init_kms_caps(struct drm_backend *b);
596
597int
598drm_pending_state_test(struct drm_pending_state *pending_state);
599int
600drm_pending_state_apply(struct drm_pending_state *pending_state);
601int
602drm_pending_state_apply_sync(struct drm_pending_state *pending_state);
603
604void
605drm_output_set_gamma(struct weston_output *output_base,
606 uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b);
607
608void
609drm_output_update_msc(struct drm_output *output, unsigned int seq);
610void
611drm_output_update_complete(struct drm_output *output, uint32_t flags,
612 unsigned int sec, unsigned int usec);
613int
614on_drm_input(int fd, uint32_t mask, void *data);
615
616struct drm_plane_state *
617drm_output_state_get_existing_plane(struct drm_output_state *state_output,
618 struct drm_plane *plane);
619void
620drm_plane_state_free(struct drm_plane_state *state, bool force);
621void
622drm_output_state_free(struct drm_output_state *state);
623void
624drm_pending_state_free(struct drm_pending_state *pending_state);
Daniel Stone7580b3c2019-06-18 11:16:53 +0100625
626struct drm_fb *
627drm_fb_ref(struct drm_fb *fb);
628void
629drm_fb_unref(struct drm_fb *fb);
630
631struct drm_fb *
632drm_fb_create_dumb(struct drm_backend *b, int width, int height,
633 uint32_t format);
634struct drm_fb *
635drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend,
636 bool is_opaque, enum drm_fb_type type);
637struct drm_fb *
638drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev);
Daniel Stone6b466f22019-06-18 11:30:54 +0100639
640
641struct drm_pending_state *
642drm_pending_state_alloc(struct drm_backend *backend);
643void
644drm_pending_state_free(struct drm_pending_state *pending_state);
645struct drm_output_state *
646drm_pending_state_get_output(struct drm_pending_state *pending_state,
647 struct drm_output *output);
648
649
650/**
651 * Mode for drm_output_state_duplicate.
652 */
653enum drm_output_state_duplicate_mode {
654 DRM_OUTPUT_STATE_CLEAR_PLANES, /**< reset all planes to off */
655 DRM_OUTPUT_STATE_PRESERVE_PLANES, /**< preserve plane state */
656};
657
658struct drm_output_state *
659drm_output_state_alloc(struct drm_output *output,
660 struct drm_pending_state *pending_state);
661struct drm_output_state *
662drm_output_state_duplicate(struct drm_output_state *src,
663 struct drm_pending_state *pending_state,
664 enum drm_output_state_duplicate_mode plane_mode);
665void
666drm_output_state_free(struct drm_output_state *state);
667struct drm_plane_state *
668drm_output_state_get_plane(struct drm_output_state *state_output,
669 struct drm_plane *plane);
670struct drm_plane_state *
671drm_output_state_get_existing_plane(struct drm_output_state *state_output,
672 struct drm_plane *plane);
673
674
675
676struct drm_plane_state *
677drm_plane_state_alloc(struct drm_output_state *state_output,
678 struct drm_plane *plane);
679struct drm_plane_state *
680drm_plane_state_duplicate(struct drm_output_state *state_output,
681 struct drm_plane_state *src);
682void
683drm_plane_state_free(struct drm_plane_state *state, bool force);
684void
685drm_plane_state_put_back(struct drm_plane_state *state);
686bool
687drm_plane_state_coords_for_view(struct drm_plane_state *state,
688 struct weston_view *ev);
Daniel Stonee404b722019-06-22 18:40:31 +0100689
690void
691drm_assign_planes(struct weston_output *output_base, void *repaint_data);
692
693bool
694drm_plane_is_available(struct drm_plane *plane, struct drm_output *output);