Work around vc4 deficiencies

rpi-vc4-hack
Andri Yngvason 2020-06-10 21:07:56 +00:00
parent ff882b7774
commit 5c138adfe1
3 changed files with 9 additions and 8 deletions

View File

@ -61,19 +61,20 @@ bool damage_check_32_byte_block(const void* block)
return a[0] || a[1] || a[2] || a[3]; return a[0] || a[1] || a[2] || a[3];
} }
void damage_check_row(uint8_t* dst, const uint8_t* src, uint32_t width) void damage_check_row(uint8_t* dst, const uint16_t* src, uint32_t width)
{ {
uint32_t aligned_width = (width / 32) * 32; uint32_t aligned_width = (width / 32) * 32;
for (uint32_t x = 0; x < aligned_width; x += 32) for (uint32_t x = 0; x < aligned_width; x += 32)
dst[x / 32] |= damage_check_32_byte_block(&src[x]); dst[x / 32] |= damage_check_32_byte_block(&src[x])
| damage_check_32_byte_block(&src[x + 1]);
for (uint32_t x = aligned_width; x < width; ++x) for (uint32_t x = aligned_width; x < width; ++x)
dst[x / 32] |= src[x]; dst[x / 32] |= src[x] | src[x + 1];
} }
void damage_check_tile_row(struct pixman_region16* damage, void damage_check_tile_row(struct pixman_region16* damage,
uint8_t* row_buffer, const uint8_t* buffer, uint8_t* row_buffer, const uint16_t* buffer,
uint32_t y_start, uint32_t width, uint32_t height) uint32_t y_start, uint32_t width, uint32_t height)
{ {
uint32_t tiled_width = UDIV_UP(width, 32); uint32_t tiled_width = UDIV_UP(width, 32);
@ -89,7 +90,7 @@ void damage_check_tile_row(struct pixman_region16* damage,
x * 32, y_start, 32, 32); x * 32, y_start, 32, 32);
} }
void damage_check(struct pixman_region16* damage, const uint8_t* buffer, void damage_check(struct pixman_region16* damage, const uint16_t* buffer,
uint32_t width, uint32_t height, struct pixman_box16* hint) uint32_t width, uint32_t height, struct pixman_box16* hint)
{ {
uint32_t tiled_width = UDIV_UP(width, 32); uint32_t tiled_width = UDIV_UP(width, 32);

View File

@ -556,8 +556,8 @@ void wayvnc_process_frame(struct wayvnc* self)
}; };
size_t alignment = MAX(4, sizeof(void*)); size_t alignment = MAX(4, sizeof(void*));
size_t damage_buffer_size = ALIGN_UP(width * height, alignment); size_t damage_buffer_size = ALIGN_UP(width * height * 2, alignment);
uint8_t* damage_buffer = uint16_t* damage_buffer =
aligned_alloc(alignment, damage_buffer_size); aligned_alloc(alignment, damage_buffer_size);
render_damage(&self->renderer); render_damage(&self->renderer);
renderer_read_damage(&self->renderer, damage_buffer, 0, height); renderer_read_damage(&self->renderer, damage_buffer, 0, height);

View File

@ -572,7 +572,7 @@ int renderer_init(struct renderer* self, const struct output* output,
if (create_textured_fbo(&self->frame_fbo[1], GL_RGBA, tf_width, tf_height) < 0) if (create_textured_fbo(&self->frame_fbo[1], GL_RGBA, tf_width, tf_height) < 0)
goto frame_fbo_failure_1; goto frame_fbo_failure_1;
if (create_fbo(&self->damage_fbo, GL_R8_EXT, tf_width, tf_height) < 0) if (create_fbo(&self->damage_fbo, GL_RGB565, tf_width, tf_height) < 0)
goto damage_fbo_failure; goto damage_fbo_failure;
glBindFramebuffer(GL_FRAMEBUFFER, self->frame_fbo[0].fbo); glBindFramebuffer(GL_FRAMEBUFFER, self->frame_fbo[0].fbo);