Use native pixel format

pull/55/head
Andri Yngvason 2020-07-07 11:53:19 +00:00
parent c0f1036f97
commit 0268b52c53
2 changed files with 12 additions and 3 deletions

View File

@ -487,9 +487,10 @@ void wayvnc_process_frame(struct wayvnc* self)
{
uint32_t width = output_get_transformed_width(self->selected_output);
uint32_t height = output_get_transformed_height(self->selected_output);
uint32_t format = self->screencopy.back->format;
if (!self->buffer) {
self->buffer = nvnc_fb_new(width, height, DRM_FORMAT_XBGR8888);
self->buffer = nvnc_fb_new(width, height, format);
nvnc_display_set_buffer(self->nvnc_display, self->buffer);
damage_refinery_init(&self->damage_refinery,

View File

@ -18,6 +18,7 @@
#include <pixman.h>
#include <wayland-client.h>
#include <neatvnc.h>
#include <assert.h>
#include "buffer.h"
#include "pixels.h"
@ -30,12 +31,17 @@ void wv_pixman_render(struct nvnc_fb* dst, const struct wv_buffer* src,
uint32_t* dst_pixels = nvnc_fb_get_addr(dst);
uint32_t dst_width = nvnc_fb_get_width(dst);
uint32_t dst_height = nvnc_fb_get_height(dst);
bool ok __attribute__((unused));
// TODO: Check that both buffers have the same dimensions after applying
// transform
pixman_format_code_t dst_fmt = 0;
ok = fourcc_to_pixman_fmt(&dst_fmt, nvnc_fb_get_fourcc_format(dst));
assert(ok);
pixman_image_t* dstimg = pixman_image_create_bits_no_clear(
PIXMAN_x8b8g8r8, dst_width, dst_height, dst_pixels,
dst_fmt, dst_width, dst_height, dst_pixels,
4 * dst_width);
intptr_t src_offset = src->y_inverted ?
@ -44,7 +50,9 @@ void wv_pixman_render(struct nvnc_fb* dst, const struct wv_buffer* src,
int src_stride = src->y_inverted ? -src->stride : src->stride;
pixman_format_code_t src_fmt = 0;
fourcc_to_pixman_fmt(&src_fmt, src->format);
ok = fourcc_to_pixman_fmt(&src_fmt, src->format);
assert(ok);
pixman_image_t* srcimg = pixman_image_create_bits_no_clear(
src_fmt, src->width, src->height, src_pixels,
src_stride);