Move damage hints into buffer abstraction

pixman-rendering
Andri Yngvason 2020-06-26 18:05:54 +00:00
parent f14eb5a813
commit 023333a4d1
3 changed files with 7 additions and 32 deletions

View File

@ -51,13 +51,6 @@ struct frame_capture {
uint32_t stride; uint32_t stride;
} frame_info; } frame_info;
struct {
uint32_t x;
uint32_t y;
uint32_t width;
uint32_t height;
} damage_hint;
struct { struct {
void (*render)(struct frame_capture*, struct renderer*, void (*render)(struct frame_capture*, struct renderer*,
struct nvnc_fb* fb); struct nvnc_fb* fb);

View File

@ -58,9 +58,6 @@
#define DEFAULT_ADDRESS "127.0.0.1" #define DEFAULT_ADDRESS "127.0.0.1"
#define DEFAULT_PORT 5900 #define DEFAULT_PORT 5900
#define UDIV_UP(a, b) (((a) + (b) - 1) / (b))
#define ALIGN_UP(n, a) (UDIV_UP(n, a) * a)
struct wayvnc { struct wayvnc {
bool do_exit; bool do_exit;
@ -501,16 +498,11 @@ void wayvnc_process_frame(struct wayvnc* self)
assert(height == nvnc_fb_get_height(self->buffer)); assert(height == nvnc_fb_get_height(self->buffer));
} }
int damx = self->capture_backend->damage_hint.x; struct pixman_region16 txdamage, refined;
int damy = self->capture_backend->damage_hint.y;
int damw = self->capture_backend->damage_hint.width;
int damh = self->capture_backend->damage_hint.height;
struct pixman_region16 hint, txdamage, refined;
pixman_region_init_rect(&hint, damx, damy, damw, damh);
pixman_region_init(&txdamage); pixman_region_init(&txdamage);
pixman_region_init(&refined); pixman_region_init(&refined);
damage_refine(&self->damage_refinery, &refined, &hint, damage_refine(&self->damage_refinery, &refined,
&self->screencopy_backend.back->damage,
self->screencopy_backend.back); self->screencopy_backend.back);
wv_region_transform(&txdamage, &refined, wv_region_transform(&txdamage, &refined,
self->selected_output->transform, self->selected_output->transform,
@ -520,7 +512,6 @@ void wayvnc_process_frame(struct wayvnc* self)
wayvnc_damage_region(self, &txdamage); wayvnc_damage_region(self, &txdamage);
pixman_region_fini(&refined); pixman_region_fini(&refined);
pixman_region_fini(&txdamage); pixman_region_fini(&txdamage);
pixman_region_fini(&hint);
if (wayvnc_start_capture(self, 0) < 0) { if (wayvnc_start_capture(self, 0) < 0) {
log_error("Failed to start capture. Exiting...\n"); log_error("Failed to start capture. Exiting...\n");
@ -621,7 +612,7 @@ int main(int argc, char* argv[])
bool overlay_cursor = false; bool overlay_cursor = false;
static const char* shortopts = "C:c:o:k:s:rh"; static const char* shortopts = "C:o:k:s:rh";
int drm_fd = -1; int drm_fd = -1;
static const struct option longopts[] = { static const struct option longopts[] = {

View File

@ -157,14 +157,8 @@ static void screencopy_ready(void* data,
double delay = (self->last_time - self->start_time) * 1.0e-6; double delay = (self->last_time - self->start_time) * 1.0e-6;
self->delay = smooth(&self->delay_smoother, delay); self->delay = smooth(&self->delay_smoother, delay);
if (self->is_immediate_copy) { if (self->is_immediate_copy)
self->frame_capture.damage_hint.x = 0; wv_buffer_damage_whole(self->front);
self->frame_capture.damage_hint.y = 0;
self->frame_capture.damage_hint.width =
self->frame_capture.frame_info.width;
self->frame_capture.damage_hint.height =
self->frame_capture.frame_info.height;
}
if (self->back) if (self->back)
wv_buffer_pool_release(self->pool, self->back); wv_buffer_pool_release(self->pool, self->back);
@ -198,10 +192,7 @@ static void screencopy_damage(void* data,
DTRACE_PROBE1(wayvnc, screencopy_damage, self); DTRACE_PROBE1(wayvnc, screencopy_damage, self);
self->frame_capture.damage_hint.x = x; wv_buffer_damage_rect(self->front, x, y, width, height);
self->frame_capture.damage_hint.y = y;
self->frame_capture.damage_hint.width = width;
self->frame_capture.damage_hint.height = height;
} }
static int screencopy__start_capture(struct frame_capture* fc) static int screencopy__start_capture(struct frame_capture* fc)