pixman-renderer: pass initial size explicitly

In a journey to decouple renderer from weston_output, pass the initial
framebuffer size to Pixman-renderer explicitly.

Now Pixman-renderer will never look into weston_output::current_mode.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-07-22 14:47:03 +03:00 committed by Pekka Paalanen
parent deff50963e
commit f4559b0760
7 changed files with 30 additions and 8 deletions

View File

@ -1186,6 +1186,7 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
unsigned int i;
const struct pixman_renderer_output_options options = {
.use_shadow = b->use_pixman_shadow,
.fb_size = { .width = w, .height = h },
};
switch (format) {

View File

@ -235,6 +235,10 @@ headless_output_enable_pixman(struct headless_output *output)
const struct pixel_format_info *pfmt;
const struct pixman_renderer_output_options options = {
.use_shadow = true,
.fb_size = {
.width = output->base.current_mode->width,
.height = output->base.current_mode->height
},
};
pfmt = pixel_format_get_info(headless_formats[0]);

View File

@ -345,7 +345,7 @@ rdp_switch_mode(struct weston_output *output, struct weston_mode *target_mode)
rdpSettings *settings;
pixman_image_t *new_shadow_buffer;
struct weston_mode *local_mode;
const struct pixman_renderer_output_options options = { .use_shadow = true, };
struct pixman_renderer_output_options options = { .use_shadow = true, };
assert(output);
@ -364,6 +364,9 @@ rdp_switch_mode(struct weston_output *output, struct weston_mode *target_mode)
output->current_mode->flags |= WL_OUTPUT_MODE_CURRENT;
pixman_renderer_output_destroy(output);
options.fb_size.width = output->current_mode->width;
options.fb_size.height = output->current_mode->height;
pixman_renderer_output_create(output, &options);
new_shadow_buffer = pixman_image_create_bits(PIXMAN_x8r8g8b8, target_mode->width,
@ -442,6 +445,10 @@ rdp_output_enable(struct weston_output *base)
struct wl_event_loop *loop;
const struct pixman_renderer_output_options options = {
.use_shadow = true,
.fb_size = {
.width = output->base.current_mode->width,
.height = output->base.current_mode->height
},
};
assert(output);

View File

@ -823,6 +823,10 @@ wayland_output_init_pixman_renderer(struct wayland_output *output)
{
const struct pixman_renderer_output_options options = {
.use_shadow = true,
.fb_size = {
.width = output->base.current_mode->width,
.height = output->base.current_mode->height
},
};
return pixman_renderer_output_create(&output->base, &options);
}

View File

@ -859,6 +859,10 @@ x11_output_switch_mode(struct weston_output *base, struct weston_mode *mode)
if (b->use_pixman) {
const struct pixman_renderer_output_options options = {
.use_shadow = true,
.fb_size = {
.width = output->base.current_mode->width,
.height = output->base.current_mode->height
},
};
pixman_renderer_output_destroy(&output->base);
x11_output_deinit_shm(b, output);
@ -1049,6 +1053,10 @@ x11_output_enable(struct weston_output *base)
if (b->use_pixman) {
const struct pixman_renderer_output_options options = {
.use_shadow = true,
.fb_size = {
.width = mode->width,
.height = mode->height
},
};
if (x11_output_init_shm(b, output,
mode->width, mode->height) < 0) {

View File

@ -986,12 +986,8 @@ pixman_renderer_output_create(struct weston_output *output,
struct weston_geometry area = {
.x = 0,
.y = 0,
.width = output->current_mode->width,
.height = output->current_mode->height
};
struct weston_size fb_size = {
.width = area.width,
.height = area.height
.width = options->fb_size.width,
.height = options->fb_size.height
};
po = zalloc(sizeof *po);
@ -1003,7 +999,7 @@ pixman_renderer_output_create(struct weston_output *output,
if (options->use_shadow)
po->shadow_format = pixel_format_get_info(DRM_FORMAT_XRGB8888);
if (!pixman_renderer_resize_output(output, &fb_size, &area)) {
if (!pixman_renderer_resize_output(output, &options->fb_size, &area)) {
output->renderer_state = NULL;
free(po);
return -1;

View File

@ -35,6 +35,8 @@ pixman_renderer_init(struct weston_compositor *ec);
struct pixman_renderer_output_options {
/** Composite into a shadow buffer, copying to the hardware buffer */
bool use_shadow;
/** Initial framebuffer size */
struct weston_size fb_size;
};
int