2019-08-21 22:07:37 +02:00
|
|
|
#ifndef PRIVATE_H
|
|
|
|
#define PRIVATE_H
|
|
|
|
|
2019-10-07 08:47:53 +02:00
|
|
|
#include <libliftoff.h>
|
2019-08-21 22:07:37 +02:00
|
|
|
#include "list.h"
|
2019-10-07 08:47:53 +02:00
|
|
|
#include "log.h"
|
2019-08-21 22:07:37 +02:00
|
|
|
|
2019-11-15 21:43:44 +01:00
|
|
|
/* Layer priority is assigned depending on the number of updates during a
|
|
|
|
* given number of page-flips */
|
|
|
|
#define LIFTOFF_PRIORITY_PERIOD 60
|
|
|
|
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_device {
|
2019-08-21 22:07:37 +02:00
|
|
|
int drm_fd;
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_list planes; /* liftoff_plane.link */
|
|
|
|
struct liftoff_list outputs; /* liftoff_output.link */
|
2019-09-08 16:41:25 +02:00
|
|
|
|
|
|
|
uint32_t *crtcs;
|
|
|
|
size_t crtcs_len;
|
2019-11-15 21:43:44 +01:00
|
|
|
|
|
|
|
int page_flip_counter;
|
2021-09-30 09:41:39 +02:00
|
|
|
int test_commit_counter;
|
2019-08-21 22:07:37 +02:00
|
|
|
};
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_output {
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_device *device;
|
2019-08-21 22:07:37 +02:00
|
|
|
uint32_t crtc_id;
|
2019-09-08 16:41:25 +02:00
|
|
|
size_t crtc_index;
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_list link; /* liftoff_device.outputs */
|
2019-08-21 22:07:37 +02:00
|
|
|
|
2019-09-30 20:22:01 +02:00
|
|
|
struct liftoff_layer *composition_layer;
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_list layers; /* liftoff_layer.link */
|
2019-12-12 23:22:18 +01:00
|
|
|
/* layer added or removed, or composition layer changed */
|
|
|
|
bool layers_changed;
|
2020-02-26 10:47:37 +01:00
|
|
|
|
|
|
|
int alloc_reused_counter;
|
2019-08-21 22:07:37 +02:00
|
|
|
};
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_layer {
|
|
|
|
struct liftoff_output *output;
|
|
|
|
struct liftoff_list link; /* liftoff_output.layers */
|
2019-08-21 22:07:37 +02:00
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_layer_property *props;
|
2019-08-21 22:07:37 +02:00
|
|
|
size_t props_len;
|
|
|
|
|
2019-12-13 11:36:09 +01:00
|
|
|
bool force_composition; /* FB needs to be composited */
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_plane *plane;
|
2019-11-15 21:43:44 +01:00
|
|
|
|
|
|
|
int current_priority, pending_priority;
|
2020-12-05 12:28:50 +01:00
|
|
|
/* prop added or force_composition changed */
|
|
|
|
bool changed;
|
2019-08-21 22:07:37 +02:00
|
|
|
};
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_layer_property {
|
2019-08-21 22:07:37 +02:00
|
|
|
char name[DRM_PROP_NAME_LEN];
|
2020-12-05 12:28:50 +01:00
|
|
|
uint64_t value, prev_value;
|
2019-08-21 22:07:37 +02:00
|
|
|
};
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_plane {
|
2019-08-21 22:07:37 +02:00
|
|
|
uint32_t id;
|
|
|
|
uint32_t possible_crtcs;
|
2019-09-09 19:55:43 +02:00
|
|
|
uint32_t type;
|
2019-09-08 17:33:09 +02:00
|
|
|
int zpos; /* greater values mean closer to the eye */
|
2019-08-21 22:07:37 +02:00
|
|
|
/* TODO: formats */
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_list link; /* liftoff_device.planes */
|
2019-08-21 22:07:37 +02:00
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_plane_property *props;
|
2019-08-21 22:07:37 +02:00
|
|
|
size_t props_len;
|
2019-08-23 17:48:13 +02:00
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_layer *layer;
|
2022-08-18 22:01:31 +02:00
|
|
|
/* Used to avoid picking planes currently in-use by other CRTCs on first
|
|
|
|
* commit */
|
|
|
|
uint32_t crtc_id;
|
2019-08-21 22:07:37 +02:00
|
|
|
};
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_plane_property {
|
2019-08-21 22:07:37 +02:00
|
|
|
char name[DRM_PROP_NAME_LEN];
|
|
|
|
uint32_t id;
|
|
|
|
};
|
|
|
|
|
2019-09-15 16:00:48 +02:00
|
|
|
struct liftoff_rect {
|
|
|
|
int x, y;
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
|
2021-08-13 22:02:33 +02:00
|
|
|
int
|
|
|
|
device_test_commit(struct liftoff_device *device, drmModeAtomicReq *req,
|
|
|
|
uint32_t flags);
|
|
|
|
|
|
|
|
struct liftoff_layer_property *
|
|
|
|
layer_get_property(struct liftoff_layer *layer, const char *name);
|
|
|
|
|
|
|
|
void
|
|
|
|
layer_get_rect(struct liftoff_layer *layer, struct liftoff_rect *rect);
|
|
|
|
|
|
|
|
bool
|
|
|
|
layer_intersects(struct liftoff_layer *a, struct liftoff_layer *b);
|
|
|
|
|
|
|
|
void
|
|
|
|
layer_mark_clean(struct liftoff_layer *layer);
|
|
|
|
|
|
|
|
void
|
|
|
|
layer_update_priority(struct liftoff_layer *layer, bool make_current);
|
|
|
|
|
|
|
|
bool
|
|
|
|
layer_has_fb(struct liftoff_layer *layer);
|
|
|
|
|
|
|
|
bool
|
|
|
|
layer_is_visible(struct liftoff_layer *layer);
|
|
|
|
|
|
|
|
int
|
|
|
|
plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer,
|
|
|
|
drmModeAtomicReq *req);
|
|
|
|
|
|
|
|
void
|
|
|
|
output_log_layers(struct liftoff_output *output);
|
2019-12-12 23:40:01 +01:00
|
|
|
|
2019-08-21 22:07:37 +02:00
|
|
|
#endif
|