|
|
@ -154,38 +154,50 @@ static void output_update_matrix(struct wlr_output *output) {
|
|
|
|
output->height, output->transform);
|
|
|
|
output->height, output->transform);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool wlr_output_enable(struct wlr_output *output, bool enable) {
|
|
|
|
void wlr_output_enable(struct wlr_output *output, bool enable) {
|
|
|
|
if (output->enabled == enable) {
|
|
|
|
if (output->enabled == enable) {
|
|
|
|
return true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (output->impl->enable) {
|
|
|
|
output->pending.committed |= WLR_OUTPUT_STATE_ENABLED;
|
|
|
|
return output->impl->enable(output, enable);
|
|
|
|
output->pending.enabled = enable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
static void output_state_clear_mode(struct wlr_output_state *state) {
|
|
|
|
|
|
|
|
if (!(state->committed & WLR_OUTPUT_STATE_MODE)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool wlr_output_set_mode(struct wlr_output *output,
|
|
|
|
state->mode = NULL;
|
|
|
|
struct wlr_output_mode *mode) {
|
|
|
|
|
|
|
|
if (!output->impl || !output->impl->set_mode) {
|
|
|
|
state->committed &= ~WLR_OUTPUT_STATE_MODE;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_output_set_mode(struct wlr_output *output,
|
|
|
|
|
|
|
|
struct wlr_output_mode *mode) {
|
|
|
|
if (output->current_mode == mode) {
|
|
|
|
if (output->current_mode == mode) {
|
|
|
|
return true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return output->impl->set_mode(output, mode);
|
|
|
|
|
|
|
|
|
|
|
|
output_state_clear_mode(&output->pending);
|
|
|
|
|
|
|
|
output->pending.committed |= WLR_OUTPUT_STATE_MODE;
|
|
|
|
|
|
|
|
output->pending.mode_type = WLR_OUTPUT_STATE_MODE_FIXED;
|
|
|
|
|
|
|
|
output->pending.mode = mode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
|
|
|
void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
|
|
|
int32_t height, int32_t refresh) {
|
|
|
|
int32_t height, int32_t refresh) {
|
|
|
|
if (!output->impl || !output->impl->set_custom_mode) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output->width == width && output->height == height &&
|
|
|
|
if (output->width == width && output->height == height &&
|
|
|
|
output->refresh == refresh) {
|
|
|
|
output->refresh == refresh) {
|
|
|
|
return true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return output->impl->set_custom_mode(output, width, height, refresh);
|
|
|
|
|
|
|
|
|
|
|
|
output_state_clear_mode(&output->pending);
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_output_update_mode(struct wlr_output *output,
|
|
|
|
void wlr_output_update_mode(struct wlr_output *output,
|
|
|
@ -227,16 +239,8 @@ void wlr_output_set_transform(struct wlr_output *output,
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
output->transform = transform;
|
|
|
|
output->pending.committed |= WLR_OUTPUT_STATE_TRANSFORM;
|
|
|
|
output_update_matrix(output);
|
|
|
|
output->pending.transform = transform;
|
|
|
|
|
|
|
|
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
|
|
wl_resource_for_each(resource, &output->resources) {
|
|
|
|
|
|
|
|
send_geometry(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wlr_output_schedule_done(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&output->events.transform, output);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_output_set_scale(struct wlr_output *output, float scale) {
|
|
|
|
void wlr_output_set_scale(struct wlr_output *output, float scale) {
|
|
|
@ -244,15 +248,8 @@ void wlr_output_set_scale(struct wlr_output *output, float scale) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
output->scale = scale;
|
|
|
|
output->pending.committed |= WLR_OUTPUT_STATE_SCALE;
|
|
|
|
|
|
|
|
output->pending.scale = scale;
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
|
|
wl_resource_for_each(resource, &output->resources) {
|
|
|
|
|
|
|
|
send_scale(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wlr_output_schedule_done(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&output->events.scale, output);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_output_set_subpixel(struct wlr_output *output,
|
|
|
|
void wlr_output_set_subpixel(struct wlr_output *output,
|
|
|
@ -478,18 +475,15 @@ static void output_state_clear(struct wlr_output_state *state) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool wlr_output_commit(struct wlr_output *output) {
|
|
|
|
bool wlr_output_commit(struct wlr_output *output) {
|
|
|
|
|
|
|
|
if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
|
|
|
if (output->frame_pending) {
|
|
|
|
if (output->frame_pending) {
|
|
|
|
wlr_log(WLR_ERROR, "Tried to commit when a frame is pending");
|
|
|
|
wlr_log(WLR_ERROR, "Tried to commit a buffer while a frame is pending");
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (output->idle_frame != NULL) {
|
|
|
|
if (output->idle_frame != NULL) {
|
|
|
|
wl_event_source_remove(output->idle_frame);
|
|
|
|
wl_event_source_remove(output->idle_frame);
|
|
|
|
output->idle_frame = NULL;
|
|
|
|
output->idle_frame = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!(output->pending.committed & WLR_OUTPUT_STATE_BUFFER)) {
|
|
|
|
|
|
|
|
wlr_log(WLR_ERROR, "Tried to commit without attaching a buffer");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct timespec now;
|
|
|
|
struct timespec now;
|
|
|
@ -506,6 +500,7 @@ bool wlr_output_commit(struct wlr_output *output) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
|
|
|
struct wlr_output_cursor *cursor;
|
|
|
|
struct wlr_output_cursor *cursor;
|
|
|
|
wl_list_for_each(cursor, &output->cursors, link) {
|
|
|
|
wl_list_for_each(cursor, &output->cursors, link) {
|
|
|
|
if (!cursor->enabled || !cursor->visible || cursor->surface == NULL) {
|
|
|
|
if (!cursor->enabled || !cursor->visible || cursor->surface == NULL) {
|
|
|
@ -513,15 +508,46 @@ bool wlr_output_commit(struct wlr_output *output) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wlr_surface_send_frame_done(cursor->surface, &now);
|
|
|
|
wlr_surface_send_frame_done(cursor->surface, &now);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
output->commit_seq++;
|
|
|
|
output->commit_seq++;
|
|
|
|
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&output->events.commit, output);
|
|
|
|
wlr_signal_emit_safe(&output->events.commit, output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool scale_updated = output->pending.committed & WLR_OUTPUT_STATE_SCALE;
|
|
|
|
|
|
|
|
if (scale_updated) {
|
|
|
|
|
|
|
|
output->scale = output->pending.scale;
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&output->events.scale, output);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (output->pending.committed & WLR_OUTPUT_STATE_TRANSFORM) {
|
|
|
|
|
|
|
|
output->transform = output->pending.transform;
|
|
|
|
|
|
|
|
output_update_matrix(output);
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&output->events.transform, output);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool geometry_updated = output->pending.committed &
|
|
|
|
|
|
|
|
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM);
|
|
|
|
|
|
|
|
if (geometry_updated || scale_updated) {
|
|
|
|
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
|
|
wl_resource_for_each(resource, &output->resources) {
|
|
|
|
|
|
|
|
if (geometry_updated) {
|
|
|
|
|
|
|
|
send_geometry(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (scale_updated) {
|
|
|
|
|
|
|
|
send_scale(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wlr_output_schedule_done(output);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
|
|
|
|
output->frame_pending = true;
|
|
|
|
output->frame_pending = true;
|
|
|
|
output->needs_frame = false;
|
|
|
|
output->needs_frame = false;
|
|
|
|
output_state_clear(&output->pending);
|
|
|
|
|
|
|
|
pixman_region32_clear(&output->damage);
|
|
|
|
pixman_region32_clear(&output->damage);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output_state_clear(&output->pending);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|