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:
parent
deff50963e
commit
f4559b0760
|
@ -1186,6 +1186,7 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
const struct pixman_renderer_output_options options = {
|
const struct pixman_renderer_output_options options = {
|
||||||
.use_shadow = b->use_pixman_shadow,
|
.use_shadow = b->use_pixman_shadow,
|
||||||
|
.fb_size = { .width = w, .height = h },
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
|
|
@ -235,6 +235,10 @@ headless_output_enable_pixman(struct headless_output *output)
|
||||||
const struct pixel_format_info *pfmt;
|
const struct pixel_format_info *pfmt;
|
||||||
const struct pixman_renderer_output_options options = {
|
const struct pixman_renderer_output_options options = {
|
||||||
.use_shadow = true,
|
.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]);
|
pfmt = pixel_format_get_info(headless_formats[0]);
|
||||||
|
|
|
@ -345,7 +345,7 @@ rdp_switch_mode(struct weston_output *output, struct weston_mode *target_mode)
|
||||||
rdpSettings *settings;
|
rdpSettings *settings;
|
||||||
pixman_image_t *new_shadow_buffer;
|
pixman_image_t *new_shadow_buffer;
|
||||||
struct weston_mode *local_mode;
|
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);
|
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;
|
output->current_mode->flags |= WL_OUTPUT_MODE_CURRENT;
|
||||||
|
|
||||||
pixman_renderer_output_destroy(output);
|
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);
|
pixman_renderer_output_create(output, &options);
|
||||||
|
|
||||||
new_shadow_buffer = pixman_image_create_bits(PIXMAN_x8r8g8b8, target_mode->width,
|
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;
|
struct wl_event_loop *loop;
|
||||||
const struct pixman_renderer_output_options options = {
|
const struct pixman_renderer_output_options options = {
|
||||||
.use_shadow = true,
|
.use_shadow = true,
|
||||||
|
.fb_size = {
|
||||||
|
.width = output->base.current_mode->width,
|
||||||
|
.height = output->base.current_mode->height
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(output);
|
assert(output);
|
||||||
|
|
|
@ -823,6 +823,10 @@ wayland_output_init_pixman_renderer(struct wayland_output *output)
|
||||||
{
|
{
|
||||||
const struct pixman_renderer_output_options options = {
|
const struct pixman_renderer_output_options options = {
|
||||||
.use_shadow = true,
|
.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);
|
return pixman_renderer_output_create(&output->base, &options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -859,6 +859,10 @@ x11_output_switch_mode(struct weston_output *base, struct weston_mode *mode)
|
||||||
if (b->use_pixman) {
|
if (b->use_pixman) {
|
||||||
const struct pixman_renderer_output_options options = {
|
const struct pixman_renderer_output_options options = {
|
||||||
.use_shadow = true,
|
.use_shadow = true,
|
||||||
|
.fb_size = {
|
||||||
|
.width = output->base.current_mode->width,
|
||||||
|
.height = output->base.current_mode->height
|
||||||
|
},
|
||||||
};
|
};
|
||||||
pixman_renderer_output_destroy(&output->base);
|
pixman_renderer_output_destroy(&output->base);
|
||||||
x11_output_deinit_shm(b, output);
|
x11_output_deinit_shm(b, output);
|
||||||
|
@ -1049,6 +1053,10 @@ x11_output_enable(struct weston_output *base)
|
||||||
if (b->use_pixman) {
|
if (b->use_pixman) {
|
||||||
const struct pixman_renderer_output_options options = {
|
const struct pixman_renderer_output_options options = {
|
||||||
.use_shadow = true,
|
.use_shadow = true,
|
||||||
|
.fb_size = {
|
||||||
|
.width = mode->width,
|
||||||
|
.height = mode->height
|
||||||
|
},
|
||||||
};
|
};
|
||||||
if (x11_output_init_shm(b, output,
|
if (x11_output_init_shm(b, output,
|
||||||
mode->width, mode->height) < 0) {
|
mode->width, mode->height) < 0) {
|
||||||
|
|
|
@ -986,12 +986,8 @@ pixman_renderer_output_create(struct weston_output *output,
|
||||||
struct weston_geometry area = {
|
struct weston_geometry area = {
|
||||||
.x = 0,
|
.x = 0,
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.width = output->current_mode->width,
|
.width = options->fb_size.width,
|
||||||
.height = output->current_mode->height
|
.height = options->fb_size.height
|
||||||
};
|
|
||||||
struct weston_size fb_size = {
|
|
||||||
.width = area.width,
|
|
||||||
.height = area.height
|
|
||||||
};
|
};
|
||||||
|
|
||||||
po = zalloc(sizeof *po);
|
po = zalloc(sizeof *po);
|
||||||
|
@ -1003,7 +999,7 @@ pixman_renderer_output_create(struct weston_output *output,
|
||||||
if (options->use_shadow)
|
if (options->use_shadow)
|
||||||
po->shadow_format = pixel_format_get_info(DRM_FORMAT_XRGB8888);
|
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;
|
output->renderer_state = NULL;
|
||||||
free(po);
|
free(po);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -35,6 +35,8 @@ pixman_renderer_init(struct weston_compositor *ec);
|
||||||
struct pixman_renderer_output_options {
|
struct pixman_renderer_output_options {
|
||||||
/** Composite into a shadow buffer, copying to the hardware buffer */
|
/** Composite into a shadow buffer, copying to the hardware buffer */
|
||||||
bool use_shadow;
|
bool use_shadow;
|
||||||
|
/** Initial framebuffer size */
|
||||||
|
struct weston_size fb_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue