Add full refresh rate support to custom modes

This commit is contained in:
emersion 2017-12-17 18:02:55 +01:00
parent b852fb9a2b
commit 0256de0002
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
11 changed files with 98 additions and 40 deletions

View file

@ -39,7 +39,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
if (wl_list_length(&output->modes) == 0) {
// Output has no mode, send the current width/height
wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT,
output->width, output->height, 0);
output->width, output->height, output->refresh);
}
}
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) {
@ -65,9 +65,9 @@ static void wlr_output_send_current_mode_to_resource(
wl_output_send_mode(resource, flags | WL_OUTPUT_MODE_CURRENT,
mode->width, mode->height, mode->refresh);
} else {
// Output has no mode, send the current width/height
// Output has no mode
wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT, output->width,
output->height, 0);
output->height, output->refresh);
}
if (version >= WL_OUTPUT_DONE_SINCE_VERSION) {
wl_output_send_done(resource);
@ -192,9 +192,17 @@ bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
return result;
}
void wlr_output_update_size(struct wlr_output *output, int32_t width,
int32_t height) {
if (output->width == width && output->height == height) {
void wlr_output_update_mode(struct wlr_output *output,
struct wlr_output_mode *mode) {
output->current_mode = mode;
wlr_output_update_custom_mode(output, mode->width, mode->height,
mode->refresh);
}
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh) {
if (output->width == width && output->height == height &&
output->refresh == refresh) {
return;
}
@ -202,6 +210,8 @@ void wlr_output_update_size(struct wlr_output *output, int32_t width,
output->height = height;
wlr_output_update_matrix(output);
output->refresh = refresh;
struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) {
wlr_output_send_current_mode_to_resource(resource);