mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 14:15:58 +01:00
output: pass wlr_output_state to output_pending_resolution
This commit is contained in:
parent
25dd3cc0cd
commit
927661d246
3 changed files with 16 additions and 14 deletions
|
@ -4,8 +4,8 @@
|
|||
#include <wlr/render/drm_format_set.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
||||
void output_pending_resolution(struct wlr_output *output, int *width,
|
||||
int *height);
|
||||
void output_pending_resolution(struct wlr_output *output,
|
||||
const struct wlr_output_state *state, int *width, int *height);
|
||||
|
||||
struct wlr_drm_format *output_pick_format(struct wlr_output *output,
|
||||
const struct wlr_drm_format_set *display_formats, uint32_t format);
|
||||
|
|
|
@ -535,17 +535,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();
|
||||
|
@ -583,7 +583,8 @@ 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);
|
||||
output_pending_resolution(output, &output->pending,
|
||||
&pending_width, &pending_height);
|
||||
if (output->pending.buffer->width != pending_width ||
|
||||
output->pending.buffer->height != pending_height) {
|
||||
wlr_log(WLR_DEBUG, "Direct scan-out buffer size mismatch");
|
||||
|
@ -616,7 +617,8 @@ static bool output_basic_test(struct wlr_output *output) {
|
|||
if (enabled && (output->pending.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, &output->pending,
|
||||
&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;
|
||||
|
|
|
@ -46,7 +46,7 @@ bool wlr_output_init_render(struct wlr_output *output,
|
|||
static bool output_create_swapchain(struct wlr_output *output,
|
||||
bool allow_modifiers) {
|
||||
int width, height;
|
||||
output_pending_resolution(output, &width, &height);
|
||||
output_pending_resolution(output, &output->pending, &width, &height);
|
||||
|
||||
struct wlr_allocator *allocator = output->allocator;
|
||||
assert(allocator != NULL);
|
||||
|
@ -154,7 +154,7 @@ static bool output_attach_empty_buffer(struct wlr_output *output) {
|
|||
}
|
||||
|
||||
int width, height;
|
||||
output_pending_resolution(output, &width, &height);
|
||||
output_pending_resolution(output, &output->pending, &width, &height);
|
||||
|
||||
struct wlr_renderer *renderer = output->renderer;
|
||||
wlr_renderer_begin(renderer, width, height);
|
||||
|
|
Loading…
Reference in a new issue