2019-09-12 10:39:06 +02:00
|
|
|
#ifndef LIFTOFF_H
|
|
|
|
#define LIFTOFF_H
|
|
|
|
|
2019-10-07 08:47:53 +02:00
|
|
|
#include <stdarg.h>
|
2019-09-12 10:39:06 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <xf86drmMode.h>
|
|
|
|
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_device;
|
2019-09-30 20:19:27 +02:00
|
|
|
struct liftoff_output;
|
|
|
|
struct liftoff_layer;
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
/**
|
|
|
|
* Initialize libliftoff for a DRM node. The node is expected to have
|
|
|
|
* DRM_CLIENT_CAP_UNIVERSAL_PLANES and DRM_CLIENT_CAP_ATOMIC enabled.
|
|
|
|
*/
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_device *liftoff_device_create(int drm_fd);
|
|
|
|
void liftoff_device_destroy(struct liftoff_device *device);
|
2019-09-12 10:39:06 +02:00
|
|
|
/**
|
|
|
|
* Build a layer to plane mapping and append the plane configuration to `req`.
|
|
|
|
* Callers are expected to commit `req` afterwards and can read the layer to
|
|
|
|
* plane mapping with `liftoff_layer_get_plane_id`.
|
|
|
|
*/
|
2019-10-19 13:02:54 +02:00
|
|
|
bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req);
|
2019-09-12 10:39:06 +02:00
|
|
|
|
|
|
|
/**
|
2019-11-24 12:59:10 +01:00
|
|
|
* Make the device manage a CRTC's planes. The returned output allows callers
|
2019-09-12 10:39:06 +02:00
|
|
|
* to attach layers.
|
|
|
|
*/
|
2019-11-24 12:59:10 +01:00
|
|
|
struct liftoff_output *liftoff_output_create(struct liftoff_device *device,
|
2019-09-12 10:39:06 +02:00
|
|
|
uint32_t crtc_id);
|
|
|
|
void liftoff_output_destroy(struct liftoff_output *output);
|
2019-09-30 20:22:01 +02:00
|
|
|
/**
|
|
|
|
* Indicate on which layer composition can take place. Users should be able to
|
|
|
|
* blend layers that haven't been mapped to a plane to this layer. The
|
|
|
|
* composition layer won't be used if all other layers have been mapped to a
|
|
|
|
* plane. There is at most one composition layer per output.
|
|
|
|
*/
|
|
|
|
void liftoff_output_set_composition_layer(struct liftoff_output *output,
|
|
|
|
struct liftoff_layer *layer);
|
2019-09-12 10:39:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new layer on an output.
|
|
|
|
*/
|
|
|
|
struct liftoff_layer *liftoff_layer_create(struct liftoff_output *output);
|
|
|
|
void liftoff_layer_destroy(struct liftoff_layer *layer);
|
|
|
|
/**
|
2019-12-13 11:36:09 +01:00
|
|
|
* Set a property on the layer. Any plane property can be set (except CRTC_ID).
|
|
|
|
* If none of the planes support the property, the layer won't be mapped to any
|
|
|
|
* plane.
|
|
|
|
*
|
|
|
|
* Setting a zero FB_ID disables the layer.
|
2019-09-12 10:39:06 +02:00
|
|
|
*/
|
|
|
|
void liftoff_layer_set_property(struct liftoff_layer *layer, const char *name,
|
|
|
|
uint64_t value);
|
2019-12-13 11:36:09 +01:00
|
|
|
/**
|
|
|
|
* Force composition on this layer. This unsets any previous FB_ID value. To
|
|
|
|
* switch back to direct scan-out, set FB_ID again.
|
|
|
|
*
|
|
|
|
* This can be used when no KMS FB ID is available for this layer but it still
|
|
|
|
* needs to be displayed (e.g. the buffer cannot be imported in KMS).
|
|
|
|
*/
|
|
|
|
void liftoff_layer_set_fb_composited(struct liftoff_layer *layer);
|
2019-09-12 10:39:06 +02:00
|
|
|
/**
|
|
|
|
* Retrieve the plane mapped to this layer. Zero is returned if no plane is
|
|
|
|
* mapped.
|
|
|
|
*/
|
|
|
|
uint32_t liftoff_layer_get_plane_id(struct liftoff_layer *layer);
|
|
|
|
|
2019-10-07 08:47:53 +02:00
|
|
|
enum liftoff_log_importance {
|
|
|
|
LIFTOFF_SILENT,
|
|
|
|
LIFTOFF_ERROR,
|
2019-12-12 15:44:45 +01:00
|
|
|
LIFTOFF_DEBUG,
|
2019-10-07 08:47:53 +02:00
|
|
|
};
|
|
|
|
|
2020-02-29 02:51:17 +01:00
|
|
|
enum liftoff_log_flags {
|
|
|
|
LIFTOFF_LOG_NO_FLAG = 0,
|
|
|
|
LIFTOFF_LOG_SECTION_START = 1,
|
|
|
|
LIFTOFF_LOG_SECTION_END = 2,
|
|
|
|
};
|
|
|
|
|
2020-02-29 02:04:26 +01:00
|
|
|
typedef void (*liftoff_log_func)(enum liftoff_log_importance importance,
|
2020-02-29 02:51:17 +01:00
|
|
|
enum liftoff_log_flags flags,
|
|
|
|
const char *fmt, va_list args);
|
2019-10-07 08:47:53 +02:00
|
|
|
|
|
|
|
void liftoff_log_init(enum liftoff_log_importance verbosity,
|
|
|
|
liftoff_log_func callback);
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
#endif
|