mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-22 06:47:12 -04:00
Merge gitlab.freedesktop.org:wlroots/wlroots
This commit is contained in:
commit
26f6fab4eb
275 changed files with 7472 additions and 5463 deletions
|
|
@ -8,8 +8,8 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include "render/allocator/allocator.h"
|
||||
#include "render/swapchain.h"
|
||||
#include "types/wlr_buffer.h"
|
||||
#include "types/wlr_output.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
static bool output_set_hardware_cursor(struct wlr_output *output,
|
||||
struct wlr_buffer *buffer, int hotspot_x, int hotspot_y) {
|
||||
|
|
@ -167,7 +167,7 @@ static void output_cursor_damage_whole(struct wlr_output_cursor *cursor) {
|
|||
.output = cursor->output,
|
||||
.damage = &damage,
|
||||
};
|
||||
wlr_signal_emit_safe(&cursor->output->events.damage, &event);
|
||||
wl_signal_emit_mutable(&cursor->output->events.damage, &event);
|
||||
|
||||
pixman_region32_fini(&damage);
|
||||
}
|
||||
|
|
@ -375,28 +375,50 @@ static bool output_cursor_attempt_hardware(struct wlr_output_cursor *cursor) {
|
|||
bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
||||
const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height,
|
||||
int32_t hotspot_x, int32_t hotspot_y) {
|
||||
struct wlr_buffer *buffer = NULL;
|
||||
|
||||
if (pixels) {
|
||||
struct wlr_readonly_data_buffer *ro_buffer = readonly_data_buffer_create(
|
||||
DRM_FORMAT_ARGB8888, stride, width, height, pixels);
|
||||
if (ro_buffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
buffer = &ro_buffer->base;
|
||||
}
|
||||
bool ok = wlr_output_cursor_set_buffer(cursor, buffer, hotspot_x, hotspot_y);
|
||||
|
||||
wlr_buffer_drop(buffer);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool wlr_output_cursor_set_buffer(struct wlr_output_cursor *cursor,
|
||||
struct wlr_buffer *buffer, int32_t hotspot_x, int32_t hotspot_y) {
|
||||
struct wlr_renderer *renderer = cursor->output->renderer;
|
||||
if (!renderer) {
|
||||
// if the backend has no renderer, we can't draw a cursor, but this is
|
||||
// actually okay, for ex. with the noop backend
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
output_cursor_reset(cursor);
|
||||
|
||||
cursor->width = width;
|
||||
cursor->height = height;
|
||||
if (buffer != NULL) {
|
||||
cursor->width = buffer->width;
|
||||
cursor->height = buffer->height;
|
||||
} else {
|
||||
cursor->width = 0;
|
||||
cursor->height = 0;
|
||||
}
|
||||
|
||||
cursor->hotspot_x = hotspot_x;
|
||||
cursor->hotspot_y = hotspot_y;
|
||||
|
||||
output_cursor_update_visible(cursor);
|
||||
|
||||
wlr_texture_destroy(cursor->texture);
|
||||
cursor->texture = NULL;
|
||||
|
||||
cursor->enabled = false;
|
||||
if (pixels != NULL) {
|
||||
cursor->texture = wlr_texture_from_pixels(renderer,
|
||||
DRM_FORMAT_ARGB8888, stride, width, height, pixels);
|
||||
if (buffer != NULL) {
|
||||
cursor->texture = wlr_texture_from_buffer(renderer, buffer);
|
||||
if (cursor->texture == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -547,7 +569,6 @@ struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {
|
|||
return NULL;
|
||||
}
|
||||
cursor->output = output;
|
||||
wl_signal_init(&cursor->events.destroy);
|
||||
wl_list_init(&cursor->surface_commit.link);
|
||||
cursor->surface_commit.notify = output_cursor_handle_commit;
|
||||
wl_list_init(&cursor->surface_destroy.link);
|
||||
|
|
@ -562,7 +583,6 @@ void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor) {
|
|||
return;
|
||||
}
|
||||
output_cursor_reset(cursor);
|
||||
wlr_signal_emit_safe(&cursor->events.destroy, cursor);
|
||||
if (cursor->output->hardware_cursor == cursor) {
|
||||
// If this cursor was the hardware cursor, disable it
|
||||
output_set_hardware_cursor(cursor->output, NULL, 0, 0);
|
||||
|
|
|
|||
|
|
@ -10,16 +10,27 @@
|
|||
#include "render/allocator/allocator.h"
|
||||
#include "render/swapchain.h"
|
||||
#include "types/wlr_output.h"
|
||||
#include "util/env.h"
|
||||
#include "util/global.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
#define OUTPUT_VERSION 4
|
||||
|
||||
static void send_geometry(struct wl_resource *resource) {
|
||||
struct wlr_output *output = wlr_output_from_resource(resource);
|
||||
|
||||
const char *make = output->make;
|
||||
if (make == NULL) {
|
||||
make = "Unknown";
|
||||
}
|
||||
|
||||
const char *model = output->model;
|
||||
if (model == NULL) {
|
||||
model = "Unknown";
|
||||
}
|
||||
|
||||
wl_output_send_geometry(resource, 0, 0,
|
||||
output->phys_width, output->phys_height, output->subpixel,
|
||||
output->make, output->model, output->transform);
|
||||
make, model, output->transform);
|
||||
}
|
||||
|
||||
static void send_current_mode(struct wl_resource *resource) {
|
||||
|
|
@ -113,7 +124,7 @@ static void output_bind(struct wl_client *wl_client, void *data,
|
|||
.resource = resource,
|
||||
};
|
||||
|
||||
wlr_signal_emit_safe(&output->events.bind, &evt);
|
||||
wl_signal_emit_mutable(&output->events.bind, &evt);
|
||||
}
|
||||
|
||||
void wlr_output_create_global(struct wlr_output *output) {
|
||||
|
|
@ -176,7 +187,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
|
|||
}
|
||||
|
||||
output->enabled = enabled;
|
||||
wlr_signal_emit_safe(&output->events.enable, output);
|
||||
wl_signal_emit_mutable(&output->events.enable, output);
|
||||
}
|
||||
|
||||
static void output_update_matrix(struct wlr_output *output) {
|
||||
|
|
@ -194,52 +205,17 @@ static void output_update_matrix(struct wlr_output *output) {
|
|||
}
|
||||
|
||||
void wlr_output_enable(struct wlr_output *output, bool enable) {
|
||||
if (output->enabled == enable) {
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_ENABLED;
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_ENABLED;
|
||||
output->pending.enabled = enable;
|
||||
}
|
||||
|
||||
static void output_state_clear_mode(struct wlr_output_state *state) {
|
||||
if (!(state->committed & WLR_OUTPUT_STATE_MODE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
state->mode = NULL;
|
||||
|
||||
state->committed &= ~WLR_OUTPUT_STATE_MODE;
|
||||
wlr_output_state_set_enabled(&output->pending, enable);
|
||||
}
|
||||
|
||||
void wlr_output_set_mode(struct wlr_output *output,
|
||||
struct wlr_output_mode *mode) {
|
||||
output_state_clear_mode(&output->pending);
|
||||
|
||||
if (output->current_mode == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_MODE;
|
||||
output->pending.mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
||||
output->pending.mode = mode;
|
||||
wlr_output_state_set_mode(&output->pending, mode);
|
||||
}
|
||||
|
||||
void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
||||
int32_t height, int32_t refresh) {
|
||||
output_state_clear_mode(&output->pending);
|
||||
|
||||
if (output->width == width && output->height == height &&
|
||||
output->refresh == refresh) {
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_MODE;
|
||||
output->pending.mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM;
|
||||
output->pending.custom_mode.width = width;
|
||||
output->pending.custom_mode.height = height;
|
||||
output->pending.custom_mode.refresh = refresh;
|
||||
wlr_output_state_set_custom_mode(&output->pending, width, height, refresh);
|
||||
}
|
||||
|
||||
void wlr_output_update_mode(struct wlr_output *output,
|
||||
|
|
@ -279,65 +255,29 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
|
|||
}
|
||||
wlr_output_schedule_done(output);
|
||||
|
||||
wlr_signal_emit_safe(&output->events.mode, output);
|
||||
wl_signal_emit_mutable(&output->events.mode, output);
|
||||
}
|
||||
|
||||
void wlr_output_set_transform(struct wlr_output *output,
|
||||
enum wl_output_transform transform) {
|
||||
if (output->transform == transform) {
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_TRANSFORM;
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_TRANSFORM;
|
||||
output->pending.transform = transform;
|
||||
wlr_output_state_set_transform(&output->pending, transform);
|
||||
}
|
||||
|
||||
void wlr_output_set_scale(struct wlr_output *output, float scale) {
|
||||
if (output->scale == scale) {
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_SCALE;
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_SCALE;
|
||||
output->pending.scale = scale;
|
||||
wlr_output_state_set_scale(&output->pending, scale);
|
||||
}
|
||||
|
||||
void wlr_output_enable_adaptive_sync(struct wlr_output *output, bool enabled) {
|
||||
bool currently_enabled =
|
||||
output->adaptive_sync_status != WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
||||
if (currently_enabled == enabled) {
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||
output->pending.adaptive_sync_enabled = enabled;
|
||||
wlr_output_state_set_adaptive_sync_enabled(&output->pending, enabled);
|
||||
}
|
||||
|
||||
void wlr_output_set_render_format(struct wlr_output *output, uint32_t format) {
|
||||
if (output->render_format == format) {
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_RENDER_FORMAT;
|
||||
return;
|
||||
}
|
||||
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_RENDER_FORMAT;
|
||||
output->pending.render_format = format;
|
||||
wlr_output_state_set_render_format(&output->pending, format);
|
||||
}
|
||||
|
||||
void wlr_output_set_subpixel(struct wlr_output *output,
|
||||
enum wl_output_subpixel subpixel) {
|
||||
if (output->subpixel == subpixel) {
|
||||
return;
|
||||
}
|
||||
|
||||
output->subpixel = subpixel;
|
||||
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &output->resources) {
|
||||
send_geometry(resource);
|
||||
}
|
||||
wlr_output_schedule_done(output);
|
||||
wlr_output_state_set_subpixel(&output->pending, subpixel);
|
||||
}
|
||||
|
||||
void wlr_output_set_name(struct wlr_output *output, const char *name) {
|
||||
|
|
@ -366,7 +306,7 @@ void wlr_output_set_description(struct wlr_output *output, const char *desc) {
|
|||
}
|
||||
wlr_output_schedule_done(output);
|
||||
|
||||
wlr_signal_emit_safe(&output->events.description, output);
|
||||
wl_signal_emit_mutable(&output->events.description, output);
|
||||
}
|
||||
|
||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -375,12 +315,35 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|||
wlr_output_destroy_global(output);
|
||||
}
|
||||
|
||||
static void output_state_init(struct wlr_output_state *state) {
|
||||
memset(state, 0, sizeof(*state));
|
||||
pixman_region32_init(&state->damage);
|
||||
}
|
||||
|
||||
static void output_state_finish(struct wlr_output_state *state) {
|
||||
wlr_buffer_unlock(state->buffer);
|
||||
// struct wlr_buffer is ref'counted, so the pointer may remain valid after
|
||||
// wlr_buffer_unlock(). Reset the field to NULL to ensure nobody mistakenly
|
||||
// reads it after output_state_finish().
|
||||
state->buffer = NULL;
|
||||
pixman_region32_fini(&state->damage);
|
||||
free(state->gamma_lut);
|
||||
}
|
||||
|
||||
static void output_state_move(struct wlr_output_state *dst,
|
||||
struct wlr_output_state *src) {
|
||||
*dst = *src;
|
||||
output_state_init(src);
|
||||
}
|
||||
|
||||
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||
const struct wlr_output_impl *impl, struct wl_display *display) {
|
||||
assert(impl->commit);
|
||||
if (impl->set_cursor || impl->move_cursor) {
|
||||
assert(impl->set_cursor && impl->move_cursor);
|
||||
}
|
||||
|
||||
memset(output, 0, sizeof(*output));
|
||||
output->backend = backend;
|
||||
output->impl = impl;
|
||||
output->display = display;
|
||||
|
|
@ -402,13 +365,11 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
|||
wl_signal_init(&output->events.mode);
|
||||
wl_signal_init(&output->events.description);
|
||||
wl_signal_init(&output->events.destroy);
|
||||
pixman_region32_init(&output->pending.damage);
|
||||
output_state_init(&output->pending);
|
||||
|
||||
const char *no_hardware_cursors = getenv("WLR_NO_HARDWARE_CURSORS");
|
||||
if (no_hardware_cursors != NULL && strcmp(no_hardware_cursors, "1") == 0) {
|
||||
wlr_log(WLR_DEBUG,
|
||||
"WLR_NO_HARDWARE_CURSORS set, forcing software cursors");
|
||||
output->software_cursor_locks = 1;
|
||||
output->software_cursor_locks = env_parse_bool("WLR_NO_HARDWARE_CURSORS");
|
||||
if (output->software_cursor_locks) {
|
||||
wlr_log(WLR_DEBUG, "WLR_NO_HARDWARE_CURSORS set, forcing software cursors");
|
||||
}
|
||||
|
||||
wlr_addon_set_init(&output->addons);
|
||||
|
|
@ -426,7 +387,7 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
wlr_output_destroy_global(output);
|
||||
output_clear_back_buffer(output);
|
||||
|
||||
wlr_signal_emit_safe(&output->events.destroy, output);
|
||||
wl_signal_emit_mutable(&output->events.destroy, output);
|
||||
wlr_addon_set_finish(&output->addons);
|
||||
|
||||
// The backend is responsible for free-ing the list of modes
|
||||
|
|
@ -451,8 +412,11 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
|
||||
free(output->name);
|
||||
free(output->description);
|
||||
free(output->make);
|
||||
free(output->model);
|
||||
free(output->serial);
|
||||
|
||||
pixman_region32_fini(&output->pending.damage);
|
||||
output_state_finish(&output->pending);
|
||||
|
||||
if (output->impl && output->impl->destroy) {
|
||||
output->impl->destroy(output);
|
||||
|
|
@ -526,17 +490,17 @@ static void output_state_clear(struct wlr_output_state *state) {
|
|||
state->committed = 0;
|
||||
}
|
||||
|
||||
void output_pending_resolution(struct wlr_output *output, int *width,
|
||||
int *height) {
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_MODE) {
|
||||
switch (output->pending.mode_type) {
|
||||
void output_pending_resolution(struct wlr_output *output,
|
||||
const struct wlr_output_state *state, int *width, int *height) {
|
||||
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
||||
switch (state->mode_type) {
|
||||
case WLR_OUTPUT_STATE_MODE_FIXED:
|
||||
*width = output->pending.mode->width;
|
||||
*height = output->pending.mode->height;
|
||||
*width = state->mode->width;
|
||||
*height = state->mode->height;
|
||||
return;
|
||||
case WLR_OUTPUT_STATE_MODE_CUSTOM:
|
||||
*width = output->pending.custom_mode.width;
|
||||
*height = output->pending.custom_mode.height;
|
||||
*width = state->custom_mode.width;
|
||||
*height = state->custom_mode.height;
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
|
|
@ -546,8 +510,66 @@ void output_pending_resolution(struct wlr_output *output, int *width,
|
|||
}
|
||||
}
|
||||
|
||||
static bool output_basic_test(struct wlr_output *output) {
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
/**
|
||||
* Compare a struct wlr_output_state with the current state of a struct
|
||||
* wlr_output.
|
||||
*
|
||||
* Returns a bitfield of the unchanged fields.
|
||||
*
|
||||
* Some fields are not checked: damage always changes in-between frames, the
|
||||
* gamma LUT is too expensive to check, the contents of the buffer might have
|
||||
* changed, etc.
|
||||
*/
|
||||
static uint32_t output_compare_state(struct wlr_output *output,
|
||||
const struct wlr_output_state *state) {
|
||||
uint32_t fields = 0;
|
||||
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
||||
bool unchanged = false;
|
||||
switch (state->mode_type) {
|
||||
case WLR_OUTPUT_STATE_MODE_FIXED:
|
||||
unchanged = output->current_mode == state->mode;
|
||||
break;
|
||||
case WLR_OUTPUT_STATE_MODE_CUSTOM:
|
||||
unchanged = output->width == state->custom_mode.width &&
|
||||
output->height == state->custom_mode.height &&
|
||||
output->refresh == state->custom_mode.refresh;
|
||||
break;
|
||||
}
|
||||
if (unchanged) {
|
||||
fields |= WLR_OUTPUT_STATE_MODE;
|
||||
}
|
||||
}
|
||||
if ((state->committed & WLR_OUTPUT_STATE_ENABLED) && output->enabled == state->enabled) {
|
||||
fields |= WLR_OUTPUT_STATE_ENABLED;
|
||||
}
|
||||
if ((state->committed & WLR_OUTPUT_STATE_SCALE) && output->scale == state->scale) {
|
||||
fields |= WLR_OUTPUT_STATE_SCALE;
|
||||
}
|
||||
if ((state->committed & WLR_OUTPUT_STATE_TRANSFORM) &&
|
||||
output->transform == state->transform) {
|
||||
fields |= WLR_OUTPUT_STATE_TRANSFORM;
|
||||
}
|
||||
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
||||
bool enabled =
|
||||
output->adaptive_sync_status != WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
||||
if (enabled == state->adaptive_sync_enabled) {
|
||||
fields |= WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||
}
|
||||
}
|
||||
if ((state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) &&
|
||||
output->render_format == state->render_format) {
|
||||
fields |= WLR_OUTPUT_STATE_RENDER_FORMAT;
|
||||
}
|
||||
if ((state->committed & WLR_OUTPUT_STATE_SUBPIXEL) &&
|
||||
output->subpixel == state->subpixel) {
|
||||
fields |= WLR_OUTPUT_STATE_SUBPIXEL;
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
static bool output_basic_test(struct wlr_output *output,
|
||||
const struct wlr_output_state *state) {
|
||||
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
if (output->frame_pending) {
|
||||
wlr_log(WLR_DEBUG, "Tried to commit a buffer while a frame is pending");
|
||||
return false;
|
||||
|
|
@ -574,23 +596,24 @@ static bool output_basic_test(struct wlr_output *output) {
|
|||
// If the size doesn't match, reject buffer (scaling is not
|
||||
// supported)
|
||||
int pending_width, pending_height;
|
||||
output_pending_resolution(output, &pending_width, &pending_height);
|
||||
if (output->pending.buffer->width != pending_width ||
|
||||
output->pending.buffer->height != pending_height) {
|
||||
output_pending_resolution(output, state,
|
||||
&pending_width, &pending_height);
|
||||
if (state->buffer->width != pending_width ||
|
||||
state->buffer->height != pending_height) {
|
||||
wlr_log(WLR_DEBUG, "Direct scan-out buffer size mismatch");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
struct wlr_allocator *allocator = output->allocator;
|
||||
assert(allocator != NULL);
|
||||
|
||||
const struct wlr_drm_format_set *display_formats =
|
||||
wlr_output_get_primary_formats(output, allocator->buffer_caps);
|
||||
struct wlr_drm_format *format = output_pick_format(output, display_formats,
|
||||
output->pending.render_format);
|
||||
state->render_format);
|
||||
if (format == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to pick primary buffer format for output");
|
||||
return false;
|
||||
|
|
@ -600,77 +623,115 @@ static bool output_basic_test(struct wlr_output *output) {
|
|||
}
|
||||
|
||||
bool enabled = output->enabled;
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
|
||||
enabled = output->pending.enabled;
|
||||
if (state->committed & WLR_OUTPUT_STATE_ENABLED) {
|
||||
enabled = state->enabled;
|
||||
}
|
||||
|
||||
if (enabled && (output->pending.committed & (WLR_OUTPUT_STATE_ENABLED |
|
||||
if (enabled && (state->committed & (WLR_OUTPUT_STATE_ENABLED |
|
||||
WLR_OUTPUT_STATE_MODE))) {
|
||||
int pending_width, pending_height;
|
||||
output_pending_resolution(output, &pending_width, &pending_height);
|
||||
output_pending_resolution(output, state,
|
||||
&pending_width, &pending_height);
|
||||
if (pending_width == 0 || pending_height == 0) {
|
||||
wlr_log(WLR_DEBUG, "Tried to enable an output with a zero mode");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
if (!enabled && state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
wlr_log(WLR_DEBUG, "Tried to commit a buffer on a disabled output");
|
||||
return false;
|
||||
}
|
||||
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_MODE) {
|
||||
if (!enabled && state->committed & WLR_OUTPUT_STATE_MODE) {
|
||||
wlr_log(WLR_DEBUG, "Tried to modeset a disabled output");
|
||||
return false;
|
||||
}
|
||||
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
||||
if (!enabled && state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
||||
wlr_log(WLR_DEBUG, "Tried to enable adaptive sync on a disabled output");
|
||||
return false;
|
||||
}
|
||||
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
if (!enabled && state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
wlr_log(WLR_DEBUG, "Tried to set format for a disabled output");
|
||||
return false;
|
||||
}
|
||||
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
|
||||
if (!enabled && state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
|
||||
wlr_log(WLR_DEBUG, "Tried to set the gamma lut on a disabled output");
|
||||
return false;
|
||||
}
|
||||
if (!enabled && state->committed & WLR_OUTPUT_STATE_SUBPIXEL) {
|
||||
wlr_log(WLR_DEBUG, "Tried to set the subpixel layout on a disabled output");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wlr_output_test(struct wlr_output *output) {
|
||||
bool had_buffer = output->pending.committed & WLR_OUTPUT_STATE_BUFFER;
|
||||
bool success;
|
||||
bool wlr_output_test_state(struct wlr_output *output,
|
||||
const struct wlr_output_state *state) {
|
||||
uint32_t unchanged = output_compare_state(output, state);
|
||||
|
||||
if (!output_basic_test(output)) {
|
||||
return false;
|
||||
}
|
||||
if (!output_ensure_buffer(output)) {
|
||||
// Create a shallow copy of the state with only the fields which have been
|
||||
// changed and potentially a new buffer.
|
||||
struct wlr_output_state copy = *state;
|
||||
copy.committed &= ~unchanged;
|
||||
|
||||
if (!output_basic_test(output, ©)) {
|
||||
return false;
|
||||
}
|
||||
if (!output->impl->test) {
|
||||
return true;
|
||||
}
|
||||
|
||||
success = output->impl->test(output);
|
||||
bool new_back_buffer = false;
|
||||
if (!output_ensure_buffer(output, ©, &new_back_buffer)) {
|
||||
return false;
|
||||
}
|
||||
if (new_back_buffer) {
|
||||
assert((copy.committed & WLR_OUTPUT_STATE_BUFFER) == 0);
|
||||
copy.committed |= WLR_OUTPUT_STATE_BUFFER;
|
||||
copy.buffer = output->back_buffer;
|
||||
}
|
||||
|
||||
if (!had_buffer) {
|
||||
bool success = output->impl->test(output, ©);
|
||||
if (new_back_buffer) {
|
||||
output_clear_back_buffer(output);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool wlr_output_commit(struct wlr_output *output) {
|
||||
if (!output_basic_test(output)) {
|
||||
bool wlr_output_test(struct wlr_output *output) {
|
||||
return wlr_output_test_state(output, &output->pending);
|
||||
}
|
||||
|
||||
bool wlr_output_commit_state(struct wlr_output *output,
|
||||
const struct wlr_output_state *state) {
|
||||
uint32_t unchanged = output_compare_state(output, state);
|
||||
|
||||
// Create a shallow copy of the state with only the fields which have been
|
||||
// changed and potentially a new buffer.
|
||||
struct wlr_output_state pending = *state;
|
||||
pending.committed &= ~unchanged;
|
||||
|
||||
if (!output_basic_test(output, &pending)) {
|
||||
wlr_log(WLR_ERROR, "Basic output test failed for %s", output->name);
|
||||
output_clear_back_buffer(output);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!output_ensure_buffer(output)) {
|
||||
bool new_back_buffer = false;
|
||||
if (!output_ensure_buffer(output, &pending, &new_back_buffer)) {
|
||||
output_clear_back_buffer(output);
|
||||
return false;
|
||||
}
|
||||
if (new_back_buffer) {
|
||||
assert((pending.committed & WLR_OUTPUT_STATE_BUFFER) == 0);
|
||||
pending.committed |= WLR_OUTPUT_STATE_BUFFER;
|
||||
// Lock the buffer to ensure it stays valid past the
|
||||
// output_clear_back_buffer() call below.
|
||||
pending.buffer = wlr_buffer_lock(output->back_buffer);
|
||||
}
|
||||
|
||||
if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
|
||||
if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
|
||||
output->idle_frame != NULL) {
|
||||
wl_event_source_remove(output->idle_frame);
|
||||
output->idle_frame = NULL;
|
||||
|
|
@ -682,27 +743,30 @@ bool wlr_output_commit(struct wlr_output *output) {
|
|||
struct wlr_output_event_precommit pre_event = {
|
||||
.output = output,
|
||||
.when = &now,
|
||||
.state = &pending,
|
||||
};
|
||||
wlr_signal_emit_safe(&output->events.precommit, &pre_event);
|
||||
wl_signal_emit_mutable(&output->events.precommit, &pre_event);
|
||||
|
||||
// output_clear_back_buffer detaches the buffer from the renderer. This is
|
||||
// important to do before calling impl->commit(), because this marks an
|
||||
// implicit rendering synchronization point. The backend needs it to avoid
|
||||
// displaying a buffer when asynchronous GPU work isn't finished.
|
||||
struct wlr_buffer *back_buffer = NULL;
|
||||
if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
|
||||
if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
|
||||
output->back_buffer != NULL) {
|
||||
back_buffer = wlr_buffer_lock(output->back_buffer);
|
||||
output_clear_back_buffer(output);
|
||||
}
|
||||
|
||||
if (!output->impl->commit(output)) {
|
||||
if (!output->impl->commit(output, &pending)) {
|
||||
wlr_buffer_unlock(back_buffer);
|
||||
output_state_clear(&output->pending);
|
||||
if (new_back_buffer) {
|
||||
wlr_buffer_unlock(pending.buffer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
if (pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
struct wlr_output_cursor *cursor;
|
||||
wl_list_for_each(cursor, &output->cursors, link) {
|
||||
if (!cursor->enabled || !cursor->visible || cursor->surface == NULL) {
|
||||
|
|
@ -712,24 +776,29 @@ bool wlr_output_commit(struct wlr_output *output) {
|
|||
}
|
||||
}
|
||||
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
output->render_format = output->pending.render_format;
|
||||
if (pending.committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
output->render_format = pending.render_format;
|
||||
}
|
||||
|
||||
if (pending.committed & WLR_OUTPUT_STATE_SUBPIXEL) {
|
||||
output->subpixel = pending.subpixel;
|
||||
}
|
||||
|
||||
output->commit_seq++;
|
||||
|
||||
bool scale_updated = output->pending.committed & WLR_OUTPUT_STATE_SCALE;
|
||||
bool scale_updated = pending.committed & WLR_OUTPUT_STATE_SCALE;
|
||||
if (scale_updated) {
|
||||
output->scale = output->pending.scale;
|
||||
output->scale = pending.scale;
|
||||
}
|
||||
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_TRANSFORM) {
|
||||
output->transform = output->pending.transform;
|
||||
if (pending.committed & WLR_OUTPUT_STATE_TRANSFORM) {
|
||||
output->transform = pending.transform;
|
||||
output_update_matrix(output);
|
||||
}
|
||||
|
||||
bool geometry_updated = output->pending.committed &
|
||||
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM);
|
||||
bool geometry_updated = pending.committed &
|
||||
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM |
|
||||
WLR_OUTPUT_STATE_SUBPIXEL);
|
||||
if (geometry_updated || scale_updated) {
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &output->resources) {
|
||||
|
|
@ -744,15 +813,14 @@ bool wlr_output_commit(struct wlr_output *output) {
|
|||
}
|
||||
|
||||
// Destroy the swapchains when an output is disabled
|
||||
if ((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) &&
|
||||
!output->pending.enabled) {
|
||||
if ((pending.committed & WLR_OUTPUT_STATE_ENABLED) && !pending.enabled) {
|
||||
wlr_swapchain_destroy(output->swapchain);
|
||||
output->swapchain = NULL;
|
||||
wlr_swapchain_destroy(output->cursor_swapchain);
|
||||
output->cursor_swapchain = NULL;
|
||||
}
|
||||
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
if (pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
output->frame_pending = true;
|
||||
output->needs_frame = false;
|
||||
}
|
||||
|
|
@ -761,34 +829,46 @@ bool wlr_output_commit(struct wlr_output *output) {
|
|||
wlr_swapchain_set_buffer_submitted(output->swapchain, back_buffer);
|
||||
}
|
||||
|
||||
uint32_t committed = output->pending.committed;
|
||||
output_state_clear(&output->pending);
|
||||
|
||||
struct wlr_output_event_commit event = {
|
||||
.output = output,
|
||||
.committed = committed,
|
||||
.committed = pending.committed,
|
||||
.when = &now,
|
||||
.buffer = back_buffer,
|
||||
.buffer = (pending.committed & WLR_OUTPUT_STATE_BUFFER) ? pending.buffer : NULL,
|
||||
};
|
||||
wlr_signal_emit_safe(&output->events.commit, &event);
|
||||
wl_signal_emit_mutable(&output->events.commit, &event);
|
||||
|
||||
if (back_buffer != NULL) {
|
||||
wlr_buffer_unlock(back_buffer);
|
||||
wlr_buffer_unlock(back_buffer);
|
||||
if (new_back_buffer) {
|
||||
wlr_buffer_unlock(pending.buffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wlr_output_commit(struct wlr_output *output) {
|
||||
// Make sure the pending state is cleared before the output is committed
|
||||
struct wlr_output_state state = {0};
|
||||
output_state_move(&state, &output->pending);
|
||||
bool ok = wlr_output_commit_state(output, &state);
|
||||
output_state_finish(&state);
|
||||
return ok;
|
||||
}
|
||||
|
||||
void wlr_output_rollback(struct wlr_output *output) {
|
||||
output_clear_back_buffer(output);
|
||||
output_state_clear(&output->pending);
|
||||
}
|
||||
|
||||
void output_state_attach_buffer(struct wlr_output_state *state,
|
||||
struct wlr_buffer *buffer) {
|
||||
output_state_clear_buffer(state);
|
||||
state->committed |= WLR_OUTPUT_STATE_BUFFER;
|
||||
state->buffer = wlr_buffer_lock(buffer);
|
||||
}
|
||||
|
||||
void wlr_output_attach_buffer(struct wlr_output *output,
|
||||
struct wlr_buffer *buffer) {
|
||||
output_state_clear_buffer(&output->pending);
|
||||
output->pending.committed |= WLR_OUTPUT_STATE_BUFFER;
|
||||
output->pending.buffer = wlr_buffer_lock(buffer);
|
||||
output_state_attach_buffer(&output->pending, buffer);
|
||||
}
|
||||
|
||||
void wlr_output_set_source_box(struct wlr_output *output,
|
||||
|
|
@ -800,7 +880,7 @@ void wlr_output_set_source_box(struct wlr_output *output,
|
|||
void wlr_output_send_frame(struct wlr_output *output) {
|
||||
output->frame_pending = false;
|
||||
if (output->enabled) {
|
||||
wlr_signal_emit_safe(&output->events.frame, output);
|
||||
wl_signal_emit_mutable(&output->events.frame, output);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -846,7 +926,7 @@ void wlr_output_send_present(struct wlr_output *output,
|
|||
event->when = &now;
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&output->events.present, event);
|
||||
wl_signal_emit_mutable(&output->events.present, event);
|
||||
}
|
||||
|
||||
void wlr_output_set_gamma(struct wlr_output *output, size_t size,
|
||||
|
|
@ -878,7 +958,7 @@ void wlr_output_update_needs_frame(struct wlr_output *output) {
|
|||
return;
|
||||
}
|
||||
output->needs_frame = true;
|
||||
wlr_signal_emit_safe(&output->events.needs_frame, output);
|
||||
wl_signal_emit_mutable(&output->events.needs_frame, output);
|
||||
}
|
||||
|
||||
void wlr_output_damage_whole(struct wlr_output *output) {
|
||||
|
|
@ -892,7 +972,7 @@ void wlr_output_damage_whole(struct wlr_output *output) {
|
|||
.output = output,
|
||||
.damage = &damage,
|
||||
};
|
||||
wlr_signal_emit_safe(&output->events.damage, &event);
|
||||
wl_signal_emit_mutable(&output->events.damage, &event);
|
||||
|
||||
pixman_region32_fini(&damage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ bool wlr_output_init_render(struct wlr_output *output,
|
|||
* If set to false, the swapchain's format is guaranteed to not use modifiers.
|
||||
*/
|
||||
static bool output_create_swapchain(struct wlr_output *output,
|
||||
bool allow_modifiers) {
|
||||
const struct wlr_output_state *state, bool allow_modifiers) {
|
||||
int width, height;
|
||||
output_pending_resolution(output, &width, &height);
|
||||
output_pending_resolution(output, state, &width, &height);
|
||||
|
||||
struct wlr_allocator *allocator = output->allocator;
|
||||
assert(allocator != NULL);
|
||||
|
|
@ -99,10 +99,10 @@ static bool output_create_swapchain(struct wlr_output *output,
|
|||
}
|
||||
|
||||
static bool output_attach_back_buffer(struct wlr_output *output,
|
||||
int *buffer_age) {
|
||||
const struct wlr_output_state *state, int *buffer_age) {
|
||||
assert(output->back_buffer == NULL);
|
||||
|
||||
if (!output_create_swapchain(output, true)) {
|
||||
if (!output_create_swapchain(output, state, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -138,23 +138,29 @@ void output_clear_back_buffer(struct wlr_output *output) {
|
|||
output->back_buffer = NULL;
|
||||
}
|
||||
|
||||
bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age) {
|
||||
if (!output_attach_back_buffer(output, buffer_age)) {
|
||||
static bool output_attach_render(struct wlr_output *output,
|
||||
struct wlr_output_state *state, int *buffer_age) {
|
||||
if (!output_attach_back_buffer(output, state, buffer_age)) {
|
||||
return false;
|
||||
}
|
||||
wlr_output_attach_buffer(output, output->back_buffer);
|
||||
output_state_attach_buffer(state, output->back_buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool output_attach_empty_buffer(struct wlr_output *output) {
|
||||
assert(!(output->pending.committed & WLR_OUTPUT_STATE_BUFFER));
|
||||
bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age) {
|
||||
return output_attach_render(output, &output->pending, buffer_age);
|
||||
}
|
||||
|
||||
if (!wlr_output_attach_render(output, NULL)) {
|
||||
static bool output_attach_empty_back_buffer(struct wlr_output *output,
|
||||
const struct wlr_output_state *state) {
|
||||
assert(!(state->committed & WLR_OUTPUT_STATE_BUFFER));
|
||||
|
||||
if (!output_attach_back_buffer(output, state, NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int width, height;
|
||||
output_pending_resolution(output, &width, &height);
|
||||
output_pending_resolution(output, state, &width, &height);
|
||||
|
||||
struct wlr_renderer *renderer = output->renderer;
|
||||
wlr_renderer_begin(renderer, width, height);
|
||||
|
|
@ -164,42 +170,62 @@ static bool output_attach_empty_buffer(struct wlr_output *output) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool output_ensure_buffer(struct wlr_output *output) {
|
||||
static bool output_test_with_back_buffer(struct wlr_output *output,
|
||||
const struct wlr_output_state *state) {
|
||||
assert(output->impl->test != NULL);
|
||||
|
||||
// Create a shallow copy of the state with the empty back buffer included
|
||||
// to pass to the backend.
|
||||
struct wlr_output_state copy = *state;
|
||||
assert((copy.committed & WLR_OUTPUT_STATE_BUFFER) == 0);
|
||||
copy.committed |= WLR_OUTPUT_STATE_BUFFER;
|
||||
assert(output->back_buffer != NULL);
|
||||
copy.buffer = output->back_buffer;
|
||||
|
||||
return output->impl->test(output, ©);
|
||||
}
|
||||
|
||||
// This function may attach a new, empty back buffer if necessary.
|
||||
// If so, the new_back_buffer out parameter will be set to true.
|
||||
bool output_ensure_buffer(struct wlr_output *output,
|
||||
const struct wlr_output_state *state,
|
||||
bool *new_back_buffer) {
|
||||
assert(*new_back_buffer == false);
|
||||
|
||||
// If we're lighting up an output or changing its mode, make sure to
|
||||
// provide a new buffer
|
||||
bool needs_new_buffer = false;
|
||||
if ((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) &&
|
||||
output->pending.enabled) {
|
||||
if ((state->committed & WLR_OUTPUT_STATE_ENABLED) && state->enabled) {
|
||||
needs_new_buffer = true;
|
||||
}
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_MODE) {
|
||||
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
||||
needs_new_buffer = true;
|
||||
}
|
||||
if (output->pending.committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
needs_new_buffer = true;
|
||||
}
|
||||
if (!needs_new_buffer ||
|
||||
(output->pending.committed & WLR_OUTPUT_STATE_BUFFER)) {
|
||||
if (!needs_new_buffer || (state->committed & WLR_OUTPUT_STATE_BUFFER)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the backend doesn't necessarily need a new buffer on modeset, don't
|
||||
// bother allocating one.
|
||||
if (!output->impl->test || output->impl->test(output)) {
|
||||
if (!output->impl->test || output->impl->test(output, state)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
wlr_log(WLR_DEBUG, "Attaching empty buffer to output for modeset");
|
||||
|
||||
if (!output_attach_empty_buffer(output)) {
|
||||
goto error;
|
||||
if (!output_attach_empty_back_buffer(output, state)) {
|
||||
return false;
|
||||
}
|
||||
if (!output->impl->test || output->impl->test(output)) {
|
||||
|
||||
if (output_test_with_back_buffer(output, state)) {
|
||||
*new_back_buffer = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
output_clear_back_buffer(output);
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_BUFFER;
|
||||
|
||||
if (output->swapchain->format->len == 0) {
|
||||
return false;
|
||||
|
|
@ -209,20 +235,28 @@ bool output_ensure_buffer(struct wlr_output *output) {
|
|||
// modifiers to see if that makes a difference.
|
||||
wlr_log(WLR_DEBUG, "Output modeset test failed, retrying without modifiers");
|
||||
|
||||
if (!output_create_swapchain(output, false)) {
|
||||
if (!output_create_swapchain(output, state, false)) {
|
||||
return false;
|
||||
}
|
||||
if (!output_attach_empty_buffer(output)) {
|
||||
goto error;
|
||||
}
|
||||
if (!output->impl->test(output)) {
|
||||
goto error;
|
||||
}
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (!output_attach_empty_back_buffer(output, state)) {
|
||||
goto error_destroy_swapchain;
|
||||
}
|
||||
|
||||
if (output_test_with_back_buffer(output, state)) {
|
||||
*new_back_buffer = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
output_clear_back_buffer(output);
|
||||
output->pending.committed &= ~WLR_OUTPUT_STATE_BUFFER;
|
||||
|
||||
error_destroy_swapchain:
|
||||
// Destroy the modifierless swapchain so that the output does not get stuck
|
||||
// without modifiers. A new swapchain with modifiers will be created when
|
||||
// needed by output_attach_back_buffer().
|
||||
wlr_swapchain_destroy(output->swapchain);
|
||||
output->swapchain = NULL;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +325,7 @@ uint32_t wlr_output_preferred_read_format(struct wlr_output *output) {
|
|||
return DRM_FORMAT_INVALID;
|
||||
}
|
||||
|
||||
if (!output_attach_back_buffer(output, NULL)) {
|
||||
if (!output_attach_back_buffer(output, &output->pending, NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
52
types/output/state.c
Normal file
52
types/output/state.c
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include "types/wlr_output.h"
|
||||
|
||||
void wlr_output_state_set_enabled(struct wlr_output_state *state,
|
||||
bool enabled) {
|
||||
state->committed |= WLR_OUTPUT_STATE_ENABLED;
|
||||
state->enabled = enabled;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_mode(struct wlr_output_state *state,
|
||||
struct wlr_output_mode *mode) {
|
||||
state->committed |= WLR_OUTPUT_STATE_MODE;
|
||||
state->mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
||||
state->mode = mode;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
|
||||
int32_t width, int32_t height, int32_t refresh) {
|
||||
state->committed |= WLR_OUTPUT_STATE_MODE;
|
||||
state->mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM;
|
||||
state->custom_mode.width = width;
|
||||
state->custom_mode.height = height;
|
||||
state->custom_mode.refresh = refresh;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale) {
|
||||
state->committed |= WLR_OUTPUT_STATE_SCALE;
|
||||
state->scale = scale;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_transform(struct wlr_output_state *state,
|
||||
enum wl_output_transform transform) {
|
||||
state->committed |= WLR_OUTPUT_STATE_TRANSFORM;
|
||||
state->transform = transform;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_adaptive_sync_enabled(struct wlr_output_state *state,
|
||||
bool enabled) {
|
||||
state->committed |= WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
|
||||
state->adaptive_sync_enabled = enabled;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_render_format(struct wlr_output_state *state,
|
||||
uint32_t format) {
|
||||
state->committed |= WLR_OUTPUT_STATE_RENDER_FORMAT;
|
||||
state->render_format = format;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_subpixel(struct wlr_output_state *state,
|
||||
enum wl_output_subpixel subpixel) {
|
||||
state->committed |= WLR_OUTPUT_STATE_SUBPIXEL;
|
||||
state->subpixel = subpixel;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue