mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
output: use pending render format if any
If a modeset contains a render format change, use that instead of the current one stored in wlr_output.render_format. This fixes render_bit_depth configuration not being applied without a second modeset in Sway.
This commit is contained in:
parent
28e8d92263
commit
2c6aeed7d6
1 changed files with 10 additions and 5 deletions
|
@ -10,14 +10,14 @@
|
|||
#include "types/wlr_output.h"
|
||||
|
||||
static struct wlr_swapchain *create_swapchain(struct wlr_output *output,
|
||||
int width, int height, bool allow_modifiers) {
|
||||
int width, int height, uint32_t render_format, bool allow_modifiers) {
|
||||
struct wlr_allocator *allocator = output->allocator;
|
||||
assert(output->allocator != NULL);
|
||||
|
||||
const struct wlr_drm_format_set *display_formats =
|
||||
wlr_output_get_primary_formats(output, allocator->buffer_caps);
|
||||
struct wlr_drm_format format = {0};
|
||||
if (!output_pick_format(output, display_formats, &format, output->render_format)) {
|
||||
if (!output_pick_format(output, display_formats, &format, render_format)) {
|
||||
wlr_log(WLR_ERROR, "Failed to pick primary buffer format for output '%s'",
|
||||
output->name);
|
||||
return NULL;
|
||||
|
@ -73,15 +73,20 @@ bool wlr_output_configure_primary_swapchain(struct wlr_output *output,
|
|||
int width, height;
|
||||
output_pending_resolution(output, state, &width, &height);
|
||||
|
||||
uint32_t format = output->render_format;
|
||||
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
format = state->render_format;
|
||||
}
|
||||
|
||||
// Re-use the existing swapchain if possible
|
||||
struct wlr_swapchain *old_swapchain = *swapchain_ptr;
|
||||
if (old_swapchain != NULL &&
|
||||
old_swapchain->width == width && old_swapchain->height == height &&
|
||||
old_swapchain->format.format == output->render_format) {
|
||||
old_swapchain->format.format == format) {
|
||||
return true;
|
||||
}
|
||||
|
||||
struct wlr_swapchain *swapchain = create_swapchain(output, width, height, true);
|
||||
struct wlr_swapchain *swapchain = create_swapchain(output, width, height, format, true);
|
||||
if (swapchain == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to create swapchain for output '%s'", output->name);
|
||||
return false;
|
||||
|
@ -92,7 +97,7 @@ bool wlr_output_configure_primary_swapchain(struct wlr_output *output,
|
|||
wlr_log(WLR_DEBUG, "Output test failed on '%s', retrying without modifiers",
|
||||
output->name);
|
||||
wlr_swapchain_destroy(swapchain);
|
||||
swapchain = create_swapchain(output, width, height, false);
|
||||
swapchain = create_swapchain(output, width, height, format, false);
|
||||
if (swapchain == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to create modifier-less swapchain for output '%s'",
|
||||
output->name);
|
||||
|
|
Loading…
Reference in a new issue