Compositor

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Compositor API

(printing everything from compositor.h – but you only see that kerneldoc
knows about so if it doesn’t comply with rules from kerneldoc it won’t show up)
struct weston_head

Represents a monitor

Definition

struct weston_head {
  struct weston_compositor *compositor;
  struct wl_list compositor_link;
  struct wl_signal destroy_signal;
  struct weston_output *output;
  struct wl_list output_link;
  struct wl_list resource_list;
  struct wl_global *global;
  int32_t mm_width;
  int32_t mm_height;
  char *make;
  char *model;
  char *serial_number;
  uint32_t subpixel;
  bool connection_internal;
  bool device_changed;
  char *name;
  bool connected;
  bool non_desktop;
};

Members

Description

This object represents a monitor (hardware backends like DRM) or a window (windowed nested backends).

struct weston_output

representation of an output

Definition

struct weston_output {
  uint32_t id;
  char *name;
  struct wl_signal user_destroy_signal;
  void *renderer_state;
  struct wl_list link;
  struct weston_compositor *compositor;
  struct weston_matrix matrix;
  struct weston_matrix inverse_matrix;
  struct wl_list animation_list;
  int32_t x, y, width, height;
  pixman_region32_t region;
  pixman_region32_t previous_damage;
  bool repaint_needed;
  bool repainted;
  enum {
    REPAINT_NOT_SCHEDULED = 0,
    REPAINT_BEGIN_FROM_IDLE,
    REPAINT_SCHEDULED,
    REPAINT_AWAITING_COMPLETION,
  } repaint_status;
  struct timespec next_repaint;
  struct wl_event_source *idle_repaint_source;
  struct weston_output_zoom zoom;
  int dirty;
  struct wl_signal frame_signal;
  struct wl_signal destroy_signal;
  int move_x, move_y;
  struct timespec frame_time;
  uint64_t msc;
  int disable_planes;
  int destroying;
  struct wl_list feedback_list;
  uint32_t transform;
  int32_t native_scale;
  int32_t current_scale;
  int32_t original_scale;
  struct weston_mode *native_mode;
  struct weston_mode *current_mode;
  struct weston_mode *original_mode;
  struct wl_list mode_list;
  struct wl_list head_list;
  void (*start_repaint_loop)(struct weston_output *output);
  int (*repaint)(struct weston_output *output,pixman_region32_t *damage, void *repaint_data);
  void (*destroy)(struct weston_output *output);
  void (*assign_planes)(struct weston_output *output, void *repaint_data);
  int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
  int32_t backlight_current;
  void (*set_backlight)(struct weston_output *output, uint32_t value);
  void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
  uint16_t gamma_size;
  void (*set_gamma)(struct weston_output *output,uint16_t size,uint16_t *r,uint16_t *g, uint16_t *b);
  struct weston_timeline_object timeline;
  bool enabled;
  int scale;
  int (*enable)(struct weston_output *output);
  int (*disable)(struct weston_output *output);
  int (*attach_head)(struct weston_output *output, struct weston_head *head);
  void (*detach_head)(struct weston_output *output, struct weston_head *head);
};

Members

user_destroy_signal
Matches the lifetime from the user perspective
matrix
From global to output buffer coordinates.
inverse_matrix
From output buffer to global coordinates.
region
Output area in global coordinates, simple rect
repaint_status
State of the repaint loop
destroy_signal
sent when disabled
frame_time
presentation timestamp
backlight_current
backlight values are on 0-255 range, where higher is brighter
enable
a pointer function
disable
a pointer function
attach_head

Attach a head in the backend

Parameters:

output:
The output to attach to.
head:
The head to attach.

Returns: 0 on success, -1 on failure.

Do anything necessary to account for a new head being attached to the output, and check any conditions possible. On failure, both the head and the output must be left as before the call.

Libweston core will add the head to the head_list after a successful call.

struct weston_pointer

Pointer representation in weston

Definition

struct weston_pointer {
  struct weston_seat *seat;
  struct wl_list pointer_clients;
  struct weston_view *focus;
  struct weston_pointer_client *focus_client;
  uint32_t focus_serial;
  struct wl_listener focus_view_listener;
  struct wl_listener focus_resource_listener;
  struct wl_signal focus_signal;
  struct wl_signal motion_signal;
  struct wl_signal destroy_signal;
  struct weston_view *sprite;
  struct wl_listener sprite_destroy_listener;
  int32_t hotspot_x, hotspot_y;
  struct weston_pointer_grab *grab;
  struct weston_pointer_grab default_grab;
  wl_fixed_t grab_x, grab_y;
  uint32_t grab_button;
  uint32_t grab_serial;
  struct timespec grab_time;
  wl_fixed_t x, y;
  wl_fixed_t sx, sy;
  uint32_t button_count;
  struct wl_listener output_destroy_listener;
  struct wl_list timestamps_list;
};

Members

seat
a weston_seat
pointer_clients
a list of pointer clients
focus
the current weston_view of the pointer

Description

Some description here

(printing everything from compositor.c – the same thing happens only those that
are documented)
void weston_surface_update_output_mask(struct weston_surface * es, uint32_t mask)

update mask

Parameters

struct weston_surface * es
undescribed
uint32_t mask
undescribed

Description

param es The surface param mask The new set of outputs for the surface

Sets the surface’s set of outputs to the ones specified by the new output mask provided. Identifies the outputs that have changed, the posts enter and leave events for these outputs as appropriate.

WL_EXPORT void weston_surface_damage(struct weston_surface * surface)

Parameters

struct weston_surface * surface
the weston_surface surface->damage is the damage from the client, and causes surface_flush_damage() to copy pixels. No window management action can cause damage to the client-provided content, warranting re-upload!

Description

Instead of surface->damage, this function should record the damage with all the views for this surface to avoid extraneous texture uploads.

bool fixed_sum_gt(wl_fixed_t a, wl_fixed_t b, wl_fixed_t c)

Parameters

wl_fixed_t a
undescribed
wl_fixed_t b
undescribed
wl_fixed_t c
undescribed
WL_EXPORT int weston_output_attach_head(struct weston_output * output, struct weston_head * head)

Attach a head to an output

Parameters

struct weston_output * output
undescribed
struct weston_head * head
undescribed

Description

param output The output to attach to. param head The head that is not yet attached. return 0 on success, -1 on failure.

Attaches the given head to the output. All heads of an output are clones and share the resolution and timings.

Cloning heads this way uses less resources than creating an output for each head, but is not always possible due to environment, driver and hardware limitations.

On failure, the head remains unattached. Success of this function does not guarantee the output configuration is actually valid. The final checks are made on weston_output_enable() unless the output was already enabled.

memberof weston_output

WL_EXPORT int weston_output_enable(struct weston_output * output)

Constructs a weston_output object that can be used by the compositor.

Parameters

struct weston_output * output
The weston_output object that needs to be enabled. Must not be enabled already. Must have at least one head attached.

Description

Output coordinates are calculated and each new output is by default assigned to the right of previous one.

Sets up the transformation, zoom, and geometry of the output using the properties that need to be configured by the compositor.

Establishes a repaint timer for the output with the relevant display object’s event loop. See output_repaint_timer_handler().

The output is assigned an ID. Weston can support up to 32 distinct outputs, with IDs numbered from 0-31; the compositor’s output_id_pool is referred to and used to find the first available ID number, and then this ID is marked as used in output_id_pool.

The output is also assigned a Wayland global with the wl_output external interface.

Backend specific function is called to set up the output output.

Output is added to the compositor’s output list

If the backend specific function fails, the weston_output object is returned to a state it was before calling this function and is added to the compositor’s pending_output_list in case it needs to be reconfigured or just so it can be destroyed at shutdown.

Return

0 is returned on success, -1 on failure.

WL_EXPORT struct weston_output * weston_compositor_create_output_with_head(struct weston_compositor * compositor, struct weston_head * head)

Parameters

struct weston_compositor * compositor
The compositor.
struct weston_head * head
The head to attach to the output.

Return

A new weston_output, or NULL on failure.

This creates a new weston_output that starts with the given head attached. The output inherits the name of the head. The head must not be already attached to another output.

An output must be configured before it can be enabled.

memberof weston_compositor

WL_EXPORT char * weston_compositor_print_scene_graph(struct weston_compositor * ec)

Parameters

struct weston_compositor * ec
undescribed

Description

graph.

void debug_scene_graph_cb(struct weston_debug_stream * stream, void * data)

graph’ debug scope is bound by a client. This one-shot weston-debug scope prints the current scene graph when bound, and then terminates the stream.

Parameters

struct weston_debug_stream * stream
undescribed
void * data
undescribed
WL_EXPORT size_t weston_module_path_from_env(const char * name, char * path, size_t path_len)

Parameters

const char * name
undescribed
char * path
undescribed
size_t path_len
undescribed

Description

environment. If found, writes the full path into the path variable.

The module map is a string in environment variable WESTON_MODULE_MAP, where each entry is of the form “name=path” and entries are separated by semicolons. Whitespace is significant.

param name The name to search for. param path Where the path is written to if found. param path_len Allocated bytes at c path . returns The length of the string written to path on success, or 0 if the module was not specified in the environment map or path_len was too small.

Windowed API

(using windowed-output-api.h)

struct weston_windowed_output_api

insert description here

Definition

struct weston_windowed_output_api {
  int (*output_set_size)(struct weston_output *output, int width, int height);
  int (*create_head)(struct weston_compositor *compositor, const char *name);
};

Members

output_set_size

Assign a given width and height to an output.

This assigns a desired width and height to a windowed output. The backend decides what should be done and applies the desired configuration. After using this function and generic weston_output_set_*, a windowed output should be in a state where weston_output_enable() can be run.

create_head

Create a new windowed head.

This creates a new head in the backend. The new head will be advertised in the compositor’s head list and triggers a head_changed callback.

A new output can be created for the head. The output must be configured with output_set_size() and weston_output_set_{scale,transform}() before enabling it.

weston_compositor_set_heads_changed_cb(), weston_compositor_create_output_with_head()