mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-15 22:47:25 +00:00
backend-rdp: add pixel format info array
Store pixel formats on the backend and stop open coding Pixman format codes. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
17d7353b36
commit
dbe5b53766
|
@ -24,6 +24,7 @@ deps_rdp = [
|
||||||
dep_frdp,
|
dep_frdp,
|
||||||
dep_frdp_server,
|
dep_frdp_server,
|
||||||
dep_wpr,
|
dep_wpr,
|
||||||
|
dep_libdrm_headers,
|
||||||
]
|
]
|
||||||
srcs_rdp = [
|
srcs_rdp = [
|
||||||
'rdp.c',
|
'rdp.c',
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <drm_fourcc.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -401,15 +402,13 @@ rdp_output_set_mode(struct weston_output *base, struct weston_mode *mode)
|
||||||
base->native_mode = cur;
|
base->native_mode = cur;
|
||||||
if (base->enabled) {
|
if (base->enabled) {
|
||||||
const struct weston_renderer *renderer;
|
const struct weston_renderer *renderer;
|
||||||
const struct pixel_format_info *pfmt;
|
|
||||||
pixman_image_t *new_image;
|
pixman_image_t *new_image;
|
||||||
|
|
||||||
weston_renderer_resize_output(output, &(struct weston_size){
|
weston_renderer_resize_output(output, &(struct weston_size){
|
||||||
.width = output->current_mode->width,
|
.width = output->current_mode->width,
|
||||||
.height = output->current_mode->height }, NULL);
|
.height = output->current_mode->height }, NULL);
|
||||||
|
|
||||||
pfmt = pixel_format_get_info_by_pixman(PIXMAN_x8r8g8b8);
|
new_image = pixman_image_create_bits(b->formats[0]->pixman_format,
|
||||||
new_image = pixman_image_create_bits(pfmt->pixman_format,
|
|
||||||
mode->width, mode->height,
|
mode->width, mode->height,
|
||||||
NULL, mode->width * 4);
|
NULL, mode->width * 4);
|
||||||
renderer = b->compositor->renderer;
|
renderer = b->compositor->renderer;
|
||||||
|
@ -419,7 +418,7 @@ rdp_output_set_mode(struct weston_output *base, struct weston_mode *mode)
|
||||||
|
|
||||||
pixman = renderer->pixman;
|
pixman = renderer->pixman;
|
||||||
new_renderbuffer =
|
new_renderbuffer =
|
||||||
pixman->create_image_from_ptr(output, pfmt,
|
pixman->create_image_from_ptr(output, b->formats[0],
|
||||||
mode->width, mode->height,
|
mode->width, mode->height,
|
||||||
pixman_image_get_data(new_image),
|
pixman_image_get_data(new_image),
|
||||||
mode->width * 4);
|
mode->width * 4);
|
||||||
|
@ -493,7 +492,7 @@ rdp_output_enable(struct weston_output *base)
|
||||||
|
|
||||||
b = output->backend;
|
b = output->backend;
|
||||||
|
|
||||||
output->shadow_surface = pixman_image_create_bits(PIXMAN_x8r8g8b8,
|
output->shadow_surface = pixman_image_create_bits(b->formats[0]->pixman_format,
|
||||||
output->base.current_mode->width,
|
output->base.current_mode->width,
|
||||||
output->base.current_mode->height,
|
output->base.current_mode->height,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -506,7 +505,7 @@ rdp_output_enable(struct weston_output *base)
|
||||||
.width = output->base.current_mode->width,
|
.width = output->base.current_mode->width,
|
||||||
.height = output->base.current_mode->height
|
.height = output->base.current_mode->height
|
||||||
},
|
},
|
||||||
.format = pixel_format_get_info_by_pixman(PIXMAN_x8r8g8b8)
|
.format = b->formats[0],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (renderer->pixman->output_create(&output->base, &options) < 0) {
|
if (renderer->pixman->output_create(&output->base, &options) < 0) {
|
||||||
|
@ -1822,6 +1821,11 @@ static const struct weston_rdp_output_api api = {
|
||||||
rdp_output_set_mode,
|
rdp_output_set_mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint32_t rdp_formats[] = {
|
||||||
|
DRM_FORMAT_XRGB8888,
|
||||||
|
DRM_FORMAT_ARGB8888,
|
||||||
|
};
|
||||||
|
|
||||||
static struct rdp_backend *
|
static struct rdp_backend *
|
||||||
rdp_backend_create(struct weston_compositor *compositor,
|
rdp_backend_create(struct weston_compositor *compositor,
|
||||||
struct weston_rdp_backend_config *config)
|
struct weston_rdp_backend_config *config)
|
||||||
|
@ -1900,6 +1904,9 @@ rdp_backend_create(struct weston_compositor *compositor,
|
||||||
if (weston_compositor_set_presentation_clock_software(compositor) < 0)
|
if (weston_compositor_set_presentation_clock_software(compositor) < 0)
|
||||||
goto err_compositor;
|
goto err_compositor;
|
||||||
|
|
||||||
|
b->formats_count = ARRAY_LENGTH(rdp_formats);
|
||||||
|
b->formats = pixel_format_get_array(rdp_formats, b->formats_count);
|
||||||
|
|
||||||
switch (config->renderer) {
|
switch (config->renderer) {
|
||||||
case WESTON_RENDERER_PIXMAN:
|
case WESTON_RENDERER_PIXMAN:
|
||||||
case WESTON_RENDERER_AUTO:
|
case WESTON_RENDERER_AUTO:
|
||||||
|
|
|
@ -99,6 +99,9 @@ struct rdp_backend {
|
||||||
rdp_audio_out_teardown audio_out_teardown;
|
rdp_audio_out_teardown audio_out_teardown;
|
||||||
|
|
||||||
uint32_t head_index;
|
uint32_t head_index;
|
||||||
|
|
||||||
|
const struct pixel_format_info **formats;
|
||||||
|
unsigned int formats_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum peer_item_flags {
|
enum peer_item_flags {
|
||||||
|
|
Loading…
Reference in a new issue