Dont create va surface every frame for kms (test)

This commit is contained in:
dec05eba 2023-04-10 22:50:41 +02:00
parent 59046178c4
commit 6f9d17fad5

View File

@ -210,6 +210,12 @@ static bool gsr_capture_kms_vaapi_should_stop(gsr_capture *cap, bool *err) {
static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
gsr_capture_kms_vaapi *cap_kms = cap->priv;
VASurfaceID target_surface_id = (uintptr_t)frame->data[3];
static bool dd = false;
if(!dd) {
dd = true;
if(cap_kms->dmabuf_fd > 0) {
close(cap_kms->dmabuf_fd);
cap_kms->dmabuf_fd = 0;
@ -239,7 +245,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
cap_kms->input_surface = 0;
}
VASurfaceID target_surface_id = (uintptr_t)frame->data[3];
uintptr_t dmabuf = cap_kms->dmabuf_fd;
VASurfaceAttribExternalBuffers buf = {0};
@ -306,13 +311,14 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
cap_kms->stop_is_error = true;
return -1;
}
}
// Clear texture with black background because the source texture (window_texture_get_opengl_texture_id(&cap_kms->window_texture))
// might be smaller than cap_kms->target_texture_id
// TODO:
//cap_kms->egl.glClearTexImage(cap_kms->target_texture_id, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
va_status = vaBeginPicture(cap_kms->va_dpy, cap_kms->context_id, target_surface_id);
VAStatus va_status = vaBeginPicture(cap_kms->va_dpy, cap_kms->context_id, target_surface_id);
if(va_status != VA_STATUS_SUCCESS) {
static bool error_printed = false;
if(!error_printed) {