2018-07-13 12:40:56 +00:00
|
|
|
/*
|
|
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
|
|
* future consistency of this API.
|
|
|
|
*/
|
|
|
|
#ifndef WLR_USE_UNSTABLE
|
|
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
|
|
#endif
|
|
|
|
|
2017-09-23 11:10:10 +00:00
|
|
|
#ifndef WLR_INTERFACES_WLR_OUTPUT_H
|
|
|
|
#define WLR_INTERFACES_WLR_OUTPUT_H
|
2017-09-23 08:26:01 +00:00
|
|
|
|
2017-06-19 22:41:02 +00:00
|
|
|
#include <stdbool.h>
|
2018-02-12 20:29:23 +00:00
|
|
|
#include <wlr/backend.h>
|
2017-10-31 17:00:33 +00:00
|
|
|
#include <wlr/types/wlr_box.h>
|
2017-10-21 04:37:25 +00:00
|
|
|
#include <wlr/types/wlr_output.h>
|
2017-06-19 22:41:02 +00:00
|
|
|
|
2021-06-18 10:15:08 +00:00
|
|
|
/**
|
|
|
|
* Output state fields that don't require backend support. Backends can ignore
|
|
|
|
* them without breaking the API contract.
|
|
|
|
*/
|
|
|
|
#define WLR_OUTPUT_STATE_BACKEND_OPTIONAL \
|
|
|
|
(WLR_OUTPUT_STATE_DAMAGE | \
|
|
|
|
WLR_OUTPUT_STATE_SCALE | \
|
|
|
|
WLR_OUTPUT_STATE_TRANSFORM | \
|
|
|
|
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)
|
|
|
|
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* A backend implementation of wlr_output.
|
|
|
|
*
|
2020-12-01 15:22:42 +00:00
|
|
|
* The commit function is mandatory. Other functions are optional.
|
2020-06-19 15:44:32 +00:00
|
|
|
*/
|
2017-06-19 22:41:02 +00:00
|
|
|
struct wlr_output_impl {
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Set the output cursor plane image.
|
|
|
|
*
|
2020-12-04 15:41:16 +00:00
|
|
|
* If buffer is NULL, the cursor should be hidden.
|
2020-06-19 15:44:32 +00:00
|
|
|
*
|
|
|
|
* The hotspot indicates the offset that needs to be applied to the
|
|
|
|
* top-left corner of the image to match the cursor position. In other
|
|
|
|
* words, the image should be displayed at (x - hotspot_x, y - hotspot_y).
|
2021-03-09 21:29:32 +00:00
|
|
|
* The hotspot is given in the texture's coordinate space.
|
2020-06-19 15:44:32 +00:00
|
|
|
*/
|
2020-12-04 15:41:16 +00:00
|
|
|
bool (*set_cursor)(struct wlr_output *output, struct wlr_buffer *buffer,
|
|
|
|
int hotspot_x, int hotspot_y);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Set the output cursor plane position.
|
|
|
|
*
|
|
|
|
* The position is relative to the cursor hotspot, see set_cursor.
|
|
|
|
*/
|
2017-08-13 14:51:50 +00:00
|
|
|
bool (*move_cursor)(struct wlr_output *output, int x, int y);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Cleanup backend-specific resources tied to the output.
|
|
|
|
*/
|
2017-08-13 14:51:50 +00:00
|
|
|
void (*destroy)(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Make the output's back-buffer current for the renderer.
|
|
|
|
*
|
|
|
|
* buffer_age must be set to the buffer age in number of frames, or -1 if
|
|
|
|
* unknown.
|
|
|
|
*/
|
2019-04-23 16:26:21 +00:00
|
|
|
bool (*attach_render)(struct wlr_output *output, int *buffer_age);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Unset the current renderer's buffer.
|
|
|
|
*
|
|
|
|
* This is the opposite of attach_render.
|
|
|
|
*/
|
|
|
|
void (*rollback_render)(struct wlr_output *output);
|
|
|
|
/**
|
|
|
|
* Check that the pending output state is a valid configuration.
|
|
|
|
*
|
|
|
|
* If this function returns true, commit can only fail due to a runtime
|
|
|
|
* error.
|
|
|
|
*/
|
2020-04-02 10:41:19 +00:00
|
|
|
bool (*test)(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Commit the pending output state.
|
|
|
|
*
|
|
|
|
* If a buffer has been attached, a frame event is scheduled.
|
|
|
|
*/
|
2019-04-23 16:26:21 +00:00
|
|
|
bool (*commit)(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Get the maximum number of gamma LUT elements for each channel.
|
|
|
|
*
|
|
|
|
* Zero can be returned if the output doesn't support gamma LUTs.
|
|
|
|
*/
|
2018-10-03 08:36:33 +00:00
|
|
|
size_t (*get_gamma_size)(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Export the output's current back-buffer as a DMA-BUF.
|
|
|
|
*/
|
2018-05-21 17:50:51 +00:00
|
|
|
bool (*export_dmabuf)(struct wlr_output *output,
|
2018-05-31 11:33:27 +00:00
|
|
|
struct wlr_dmabuf_attributes *attribs);
|
2020-12-02 09:35:27 +00:00
|
|
|
/**
|
|
|
|
* Get the list of formats suitable for the cursor, assuming a buffer with
|
|
|
|
* the specified capabilities.
|
|
|
|
*
|
|
|
|
* If unimplemented, the cursor buffer has no format constraint. If NULL is
|
|
|
|
* returned, no format is suitable.
|
|
|
|
*/
|
|
|
|
const struct wlr_drm_format_set *(*get_cursor_formats)(
|
|
|
|
struct wlr_output *output, uint32_t buffer_caps);
|
|
|
|
/**
|
|
|
|
* Get the size suitable for the cursor buffer. Attempts to use a different
|
|
|
|
* size for the cursor may fail.
|
|
|
|
*/
|
|
|
|
void (*get_cursor_size)(struct wlr_output *output, int *width, int *height);
|
2020-12-01 15:21:10 +00:00
|
|
|
/**
|
|
|
|
* Get the list of DMA-BUF formats suitable for the primary buffer,
|
|
|
|
* assuming a buffer with the specified capabilities.
|
|
|
|
*
|
|
|
|
* If unimplemented, the primary buffer has no format constraint. If NULL
|
|
|
|
* is returned, no format is suitable.
|
|
|
|
*/
|
|
|
|
const struct wlr_drm_format_set *(*get_primary_formats)(
|
|
|
|
struct wlr_output *output, uint32_t buffer_caps);
|
2017-06-19 22:41:02 +00:00
|
|
|
};
|
|
|
|
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Initialize a new output.
|
|
|
|
*/
|
2017-10-21 04:37:25 +00:00
|
|
|
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
2018-01-04 11:46:15 +00:00
|
|
|
const struct wlr_output_impl *impl, struct wl_display *display);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Update the current output mode.
|
|
|
|
*
|
|
|
|
* The backend must call this function when the mode is updated to notify
|
|
|
|
* compositors about the change.
|
|
|
|
*/
|
2017-12-17 17:02:55 +00:00
|
|
|
void wlr_output_update_mode(struct wlr_output *output,
|
|
|
|
struct wlr_output_mode *mode);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Update the current output custom mode.
|
|
|
|
*
|
|
|
|
* The backend must call this function when the mode is updated to notify
|
|
|
|
* compositors about the change.
|
|
|
|
*/
|
2017-12-17 17:02:55 +00:00
|
|
|
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
|
|
|
|
int32_t height, int32_t refresh);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Update the current output status.
|
|
|
|
*
|
|
|
|
* The backend must call this function when the status is updated to notify
|
|
|
|
* compositors about the change.
|
|
|
|
*/
|
2018-01-04 11:46:15 +00:00
|
|
|
void wlr_output_update_enabled(struct wlr_output *output, bool enabled);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Notify compositors that they need to submit a new frame in order to apply
|
|
|
|
* output changes.
|
|
|
|
*/
|
2019-04-23 17:22:42 +00:00
|
|
|
void wlr_output_update_needs_frame(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Notify compositors that the output needs to be fully repainted.
|
|
|
|
*/
|
2018-04-17 23:15:25 +00:00
|
|
|
void wlr_output_damage_whole(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Send a frame event.
|
|
|
|
*
|
|
|
|
* See wlr_output.events.frame.
|
|
|
|
*/
|
2018-01-26 21:39:23 +00:00
|
|
|
void wlr_output_send_frame(struct wlr_output *output);
|
2020-06-19 15:44:32 +00:00
|
|
|
/**
|
|
|
|
* Send a present event.
|
|
|
|
*
|
|
|
|
* See wlr_output.events.present.
|
|
|
|
*/
|
2018-10-02 10:11:09 +00:00
|
|
|
void wlr_output_send_present(struct wlr_output *output,
|
|
|
|
struct wlr_output_event_present *event);
|
2017-06-19 22:41:02 +00:00
|
|
|
|
|
|
|
#endif
|