Remove extra swapBuffer in kms capture

This commit is contained in:
dec05eba 2023-04-15 20:39:02 +02:00
parent c9c615d4c7
commit c510bc5ae5
4 changed files with 11 additions and 4 deletions

2
TODO
View File

@ -53,7 +53,7 @@ Monitor capture on steam deck is slightly below the game fps, but only when capt
Is this related to the dma buf rotation issue? different modifier being slow? does this always happen? Is this related to the dma buf rotation issue? different modifier being slow? does this always happen?
Make sure rgb to yuv color conversion is 100% correct. Make sure rgb to yuv color conversion is 100% correct.
Fallback to vaapi copy in kms if opengl version fails. This can happen on steam deck for some reason (driver bug?). Fallback to vaapi copy in kms if opengl version fails. This can happen on steam deck for some reason (driver bug?). Also vaapi copy uses less gpu since it uses video codec unit to copy.
Test if vaapi copy version uses less memory than opengl version. Test if vaapi copy version uses less memory than opengl version.
Intel is a bit weird with monitor capture and multiple monitors. If one of the monitors is rotated then all the kms will be rotated as well. Intel is a bit weird with monitor capture and multiple monitors. If one of the monitors is rotated then all the kms will be rotated as well.

View File

@ -419,9 +419,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
cap_kms->dmabuf_fd = 0; cap_kms->dmabuf_fd = 0;
} }
// TODO: Remove
cap_kms->egl.eglSwapBuffers(cap_kms->egl.egl_display, cap_kms->egl.egl_surface);
return 0; return 0;
} }

View File

@ -186,6 +186,9 @@ int gsr_color_conversion_init(gsr_color_conversion *self, const gsr_color_conver
} }
void gsr_color_conversion_deinit(gsr_color_conversion *self) { void gsr_color_conversion_deinit(gsr_color_conversion *self) {
if(!self->egl)
return;
if(self->vertex_buffer_object_id) { if(self->vertex_buffer_object_id) {
self->egl->glDeleteBuffers(1, &self->vertex_buffer_object_id); self->egl->glDeleteBuffers(1, &self->vertex_buffer_object_id);
self->vertex_buffer_object_id = 0; self->vertex_buffer_object_id = 0;
@ -204,6 +207,8 @@ void gsr_color_conversion_deinit(gsr_color_conversion *self) {
for(int i = 0; i < MAX_SHADERS; ++i) { for(int i = 0; i < MAX_SHADERS; ++i) {
gsr_shader_deinit(&self->shaders[i]); gsr_shader_deinit(&self->shaders[i]);
} }
self->egl = NULL;
} }
int gsr_color_conversion_update(gsr_color_conversion *self, int width, int height) { int gsr_color_conversion_update(gsr_color_conversion *self, int width, int height) {

View File

@ -116,10 +116,15 @@ int gsr_shader_init(gsr_shader *self, gsr_egl *egl, const char *vertex_shader, c
} }
void gsr_shader_deinit(gsr_shader *self) { void gsr_shader_deinit(gsr_shader *self) {
if(!self->egl)
return;
if(self->program_id) { if(self->program_id) {
self->egl->glDeleteProgram(self->program_id); self->egl->glDeleteProgram(self->program_id);
self->program_id = 0; self->program_id = 0;
} }
self->egl = NULL;
} }
int gsr_shader_bind_attribute_location(gsr_shader *self, const char *attribute, int location) { int gsr_shader_bind_attribute_location(gsr_shader *self, const char *attribute, int location) {