2019-07-16 20:11:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2008-2011 Kristian Høgsberg
|
|
|
|
* Copyright © 2017, 2018 General Electric Company
|
|
|
|
* Copyright © 2012, 2017-2019 Collabora, Ltd.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2019-07-16 21:09:06 +00:00
|
|
|
/*
|
|
|
|
* This header contains the libweston ABI exported only for internal backends.
|
|
|
|
*/
|
|
|
|
|
2019-07-16 20:11:25 +00:00
|
|
|
#ifndef LIBWESTON_BACKEND_INTERNAL_H
|
|
|
|
#define LIBWESTON_BACKEND_INTERNAL_H
|
|
|
|
|
2021-07-23 14:35:22 +00:00
|
|
|
struct weston_hdr_metadata_type1;
|
|
|
|
|
2019-07-16 21:09:06 +00:00
|
|
|
struct weston_backend {
|
2023-01-13 17:21:31 +00:00
|
|
|
void (*destroy)(struct weston_backend *backend);
|
2019-07-16 21:09:06 +00:00
|
|
|
|
|
|
|
/** Begin a repaint sequence
|
|
|
|
*
|
|
|
|
* Provides the backend with explicit markers around repaint
|
|
|
|
* sequences, which may allow the backend to aggregate state
|
|
|
|
* application. This call will be bracketed by the repaint_flush (on
|
|
|
|
* success), or repaint_cancel (when any output in the grouping fails
|
|
|
|
* repaint).
|
|
|
|
*
|
|
|
|
* Returns an opaque pointer, which the backend may use as private
|
|
|
|
* data referring to the repaint cycle.
|
|
|
|
*/
|
2023-01-13 17:21:31 +00:00
|
|
|
void (*repaint_begin)(struct weston_backend *backend);
|
2019-07-16 21:09:06 +00:00
|
|
|
|
|
|
|
/** Cancel a repaint sequence
|
|
|
|
*
|
|
|
|
* Cancels a repaint sequence, when an error has occurred during
|
|
|
|
* one output's repaint; see repaint_begin.
|
|
|
|
*/
|
2023-01-13 17:21:31 +00:00
|
|
|
void (*repaint_cancel)(struct weston_backend *backend);
|
2019-07-16 21:09:06 +00:00
|
|
|
|
|
|
|
/** Conclude a repaint sequence
|
|
|
|
*
|
|
|
|
* Called on successful completion of a repaint sequence; see
|
|
|
|
* repaint_begin.
|
|
|
|
*/
|
2023-01-13 17:21:31 +00:00
|
|
|
int (*repaint_flush)(struct weston_backend *backend);
|
2019-07-16 21:09:06 +00:00
|
|
|
|
|
|
|
/** Allocate a new output
|
|
|
|
*
|
2023-01-13 17:21:31 +00:00
|
|
|
* @param backend The backend.
|
2019-07-16 21:09:06 +00:00
|
|
|
* @param name Name for the new output.
|
|
|
|
*
|
|
|
|
* Allocates a new output structure that embeds a weston_output,
|
|
|
|
* initializes it, and returns the pointer to the weston_output
|
|
|
|
* member.
|
|
|
|
*
|
|
|
|
* Must set weston_output members @c destroy, @c enable and @c disable.
|
|
|
|
*/
|
|
|
|
struct weston_output *
|
2023-01-13 17:21:31 +00:00
|
|
|
(*create_output)(struct weston_backend *backend, const char *name);
|
2019-07-16 21:09:06 +00:00
|
|
|
|
|
|
|
/** Notify of device addition/removal
|
|
|
|
*
|
2023-01-13 17:21:31 +00:00
|
|
|
* @param backend The backend.
|
2019-07-16 21:09:06 +00:00
|
|
|
* @param device The device that has changed.
|
|
|
|
* @param added Where it was added (or removed)
|
|
|
|
*
|
|
|
|
* Called when a device has been added/removed from the session.
|
|
|
|
* The backend can decide what to do based on whether it is a
|
|
|
|
* device that it is controlling or not.
|
|
|
|
*/
|
2023-01-13 17:21:31 +00:00
|
|
|
void (*device_changed)(struct weston_backend *backend,
|
2019-07-16 21:09:06 +00:00
|
|
|
dev_t device, bool added);
|
2019-11-16 18:26:52 +00:00
|
|
|
|
|
|
|
/** Verifies if the dmabuf can be used directly/scanned-out by the HW.
|
|
|
|
*
|
2023-01-13 17:21:31 +00:00
|
|
|
* @param backend The backend.
|
2019-11-16 18:26:52 +00:00
|
|
|
* @param buffer The dmabuf to verify.
|
|
|
|
*
|
|
|
|
* Determines if the buffer can be imported directly by the display
|
|
|
|
* controller/HW. Back-ends can use this to check if the supplied
|
|
|
|
* buffer can be scanned-out, as to void importing it into the GPU.
|
|
|
|
*/
|
2023-01-13 17:21:31 +00:00
|
|
|
bool (*can_scanout_dmabuf)(struct weston_backend *backend,
|
2019-11-16 18:26:52 +00:00
|
|
|
struct linux_dmabuf_buffer *buffer);
|
2019-07-16 21:09:06 +00:00
|
|
|
};
|
|
|
|
|
2019-07-16 20:11:25 +00:00
|
|
|
/* weston_head */
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_init(struct weston_head *head, const char *name);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_release(struct weston_head *head);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_set_connection_status(struct weston_head *head, bool connected);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_set_internal(struct weston_head *head);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_set_monitor_strings(struct weston_head *head,
|
|
|
|
const char *make,
|
|
|
|
const char *model,
|
|
|
|
const char *serialno);
|
|
|
|
void
|
|
|
|
weston_head_set_non_desktop(struct weston_head *head, bool non_desktop);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_set_physical_size(struct weston_head *head,
|
|
|
|
int32_t mm_width, int32_t mm_height);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_set_subpixel(struct weston_head *head,
|
|
|
|
enum wl_output_subpixel sp);
|
2019-11-25 23:29:31 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
weston_head_set_transform(struct weston_head *head, uint32_t transform);
|
|
|
|
|
2021-07-08 11:47:54 +00:00
|
|
|
void
|
|
|
|
weston_head_set_supported_eotf_mask(struct weston_head *head,
|
|
|
|
uint32_t eotf_mask);
|
|
|
|
|
2019-07-16 20:34:14 +00:00
|
|
|
/* weston_output */
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_init(struct weston_output *output,
|
|
|
|
struct weston_compositor *compositor,
|
|
|
|
const char *name);
|
|
|
|
void
|
|
|
|
weston_output_damage(struct weston_output *output);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_release(struct weston_output *output);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_finish_frame(struct weston_output *output,
|
|
|
|
const struct timespec *stamp,
|
|
|
|
uint32_t presented_flags);
|
2021-08-24 01:29:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_repaint_failed(struct weston_output *output);
|
|
|
|
|
2019-07-16 20:34:14 +00:00
|
|
|
int
|
|
|
|
weston_output_mode_set_native(struct weston_output *output,
|
|
|
|
struct weston_mode *mode,
|
|
|
|
int32_t scale);
|
|
|
|
void
|
|
|
|
weston_output_transform_coordinate(struct weston_output *output,
|
|
|
|
double device_x, double device_y,
|
|
|
|
double *x, double *y);
|
|
|
|
|
2020-12-08 13:22:36 +00:00
|
|
|
void
|
2022-09-20 19:53:27 +00:00
|
|
|
weston_region_global_to_output(pixman_region32_t *dst,
|
|
|
|
struct weston_output *output,
|
|
|
|
pixman_region32_t *src);
|
2020-12-08 13:22:36 +00:00
|
|
|
|
2021-07-23 14:35:22 +00:00
|
|
|
const struct weston_hdr_metadata_type1 *
|
|
|
|
weston_output_get_hdr_metadata_type1(const struct weston_output *output);
|
|
|
|
|
2019-07-16 20:44:21 +00:00
|
|
|
/* weston_seat */
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_axis(struct weston_seat *seat, const struct timespec *time,
|
|
|
|
struct weston_pointer_axis_event *event);
|
|
|
|
void
|
|
|
|
notify_axis_source(struct weston_seat *seat, uint32_t source);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_button(struct weston_seat *seat, const struct timespec *time,
|
|
|
|
int32_t button, enum wl_pointer_button_state state);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_key(struct weston_seat *seat, const struct timespec *time, uint32_t key,
|
|
|
|
enum wl_keyboard_key_state state,
|
|
|
|
enum weston_key_state_update update_state);
|
|
|
|
void
|
|
|
|
notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
|
|
|
|
enum weston_key_state_update update_state);
|
|
|
|
void
|
|
|
|
notify_keyboard_focus_out(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_motion(struct weston_seat *seat, const struct timespec *time,
|
|
|
|
struct weston_pointer_motion_event *event);
|
|
|
|
void
|
|
|
|
notify_motion_absolute(struct weston_seat *seat, const struct timespec *time,
|
|
|
|
double x, double y);
|
|
|
|
void
|
|
|
|
notify_modifiers(struct weston_seat *seat, uint32_t serial);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_pointer_frame(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
|
|
|
|
double x, double y);
|
|
|
|
|
2022-10-25 20:58:24 +00:00
|
|
|
void
|
|
|
|
clear_pointer_focus(struct weston_seat *seat);
|
|
|
|
|
2019-07-16 20:44:21 +00:00
|
|
|
/* weston_touch_device */
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_touch_normalized(struct weston_touch_device *device,
|
|
|
|
const struct timespec *time,
|
|
|
|
int touch_id,
|
|
|
|
double x, double y,
|
|
|
|
const struct weston_point2d_device_normalized *norm,
|
|
|
|
int touch_type);
|
|
|
|
|
|
|
|
/** Feed in touch down, motion, and up events, non-calibratable device.
|
|
|
|
*
|
|
|
|
* @sa notify_touch_cal
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
notify_touch(struct weston_touch_device *device, const struct timespec *time,
|
|
|
|
int touch_id, double x, double y, int touch_type)
|
|
|
|
{
|
|
|
|
notify_touch_normalized(device, time, touch_id, x, y, NULL, touch_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_touch_frame(struct weston_touch_device *device);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_touch_cancel(struct weston_touch_device *device);
|
|
|
|
|
|
|
|
void
|
|
|
|
notify_touch_calibrator(struct weston_touch_device *device,
|
|
|
|
const struct timespec *time, int32_t slot,
|
|
|
|
const struct weston_point2d_device_normalized *norm,
|
|
|
|
int touch_type);
|
|
|
|
void
|
|
|
|
notify_touch_calibrator_cancel(struct weston_touch_device *device);
|
|
|
|
void
|
|
|
|
notify_touch_calibrator_frame(struct weston_touch_device *device);
|
2019-07-16 20:11:25 +00:00
|
|
|
|
|
|
|
#endif
|