mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
types/wlr_output: Handle subpixel hints through output commits
This commit is contained in:
parent
68f2f8cf92
commit
74381f3bc3
3 changed files with 17 additions and 9 deletions
|
@ -22,7 +22,8 @@
|
||||||
WLR_OUTPUT_STATE_SCALE | \
|
WLR_OUTPUT_STATE_SCALE | \
|
||||||
WLR_OUTPUT_STATE_TRANSFORM | \
|
WLR_OUTPUT_STATE_TRANSFORM | \
|
||||||
WLR_OUTPUT_STATE_RENDER_FORMAT | \
|
WLR_OUTPUT_STATE_RENDER_FORMAT | \
|
||||||
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)
|
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED | \
|
||||||
|
WLR_OUTPUT_STATE_SUBPIXEL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A backend implementation of wlr_output.
|
* A backend implementation of wlr_output.
|
||||||
|
|
|
@ -62,6 +62,7 @@ enum wlr_output_state_field {
|
||||||
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6,
|
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6,
|
||||||
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
|
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
|
||||||
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
|
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
|
||||||
|
WLR_OUTPUT_STATE_SUBPIXEL = 1 << 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlr_output_state_mode_type {
|
enum wlr_output_state_mode_type {
|
||||||
|
@ -80,6 +81,7 @@ struct wlr_output_state {
|
||||||
enum wl_output_transform transform;
|
enum wl_output_transform transform;
|
||||||
bool adaptive_sync_enabled;
|
bool adaptive_sync_enabled;
|
||||||
uint32_t render_format;
|
uint32_t render_format;
|
||||||
|
enum wl_output_subpixel subpixel;
|
||||||
|
|
||||||
// only valid if WLR_OUTPUT_STATE_BUFFER
|
// only valid if WLR_OUTPUT_STATE_BUFFER
|
||||||
struct wlr_buffer *buffer;
|
struct wlr_buffer *buffer;
|
||||||
|
|
|
@ -328,16 +328,12 @@ void wlr_output_set_render_format(struct wlr_output *output, uint32_t format) {
|
||||||
void wlr_output_set_subpixel(struct wlr_output *output,
|
void wlr_output_set_subpixel(struct wlr_output *output,
|
||||||
enum wl_output_subpixel subpixel) {
|
enum wl_output_subpixel subpixel) {
|
||||||
if (output->subpixel == subpixel) {
|
if (output->subpixel == subpixel) {
|
||||||
|
output->pending.committed &= ~WLR_OUTPUT_STATE_SUBPIXEL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->subpixel = subpixel;
|
output->pending.committed |= WLR_OUTPUT_STATE_SUBPIXEL;
|
||||||
|
output->pending.subpixel = subpixel;
|
||||||
struct wl_resource *resource;
|
|
||||||
wl_resource_for_each(resource, &output->resources) {
|
|
||||||
send_geometry(resource);
|
|
||||||
}
|
|
||||||
wlr_output_schedule_done(output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_set_name(struct wlr_output *output, const char *name) {
|
void wlr_output_set_name(struct wlr_output *output, const char *name) {
|
||||||
|
@ -634,6 +630,10 @@ static bool output_basic_test(struct wlr_output *output) {
|
||||||
wlr_log(WLR_DEBUG, "Tried to set the gamma lut on a disabled output");
|
wlr_log(WLR_DEBUG, "Tried to set the gamma lut on a disabled output");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_SUBPIXEL) {
|
||||||
|
wlr_log(WLR_DEBUG, "Tried to set the subpixel layout on a disabled output");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -716,6 +716,10 @@ bool wlr_output_commit(struct wlr_output *output) {
|
||||||
output->render_format = output->pending.render_format;
|
output->render_format = output->pending.render_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output->pending.committed & WLR_OUTPUT_STATE_SUBPIXEL) {
|
||||||
|
output->subpixel = output->pending.subpixel;
|
||||||
|
}
|
||||||
|
|
||||||
output->commit_seq++;
|
output->commit_seq++;
|
||||||
|
|
||||||
bool scale_updated = output->pending.committed & WLR_OUTPUT_STATE_SCALE;
|
bool scale_updated = output->pending.committed & WLR_OUTPUT_STATE_SCALE;
|
||||||
|
@ -729,7 +733,8 @@ bool wlr_output_commit(struct wlr_output *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool geometry_updated = output->pending.committed &
|
bool geometry_updated = output->pending.committed &
|
||||||
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM);
|
(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM |
|
||||||
|
WLR_OUTPUT_STATE_SUBPIXEL);
|
||||||
if (geometry_updated || scale_updated) {
|
if (geometry_updated || scale_updated) {
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &output->resources) {
|
wl_resource_for_each(resource, &output->resources) {
|
||||||
|
|
Loading…
Reference in a new issue