Remove unecessary vaCreatebuffer every frame
This commit is contained in:
parent
4996266f28
commit
59046178c4
4
TODO
4
TODO
@ -43,4 +43,6 @@ Better configure vaapi. The file size is too large.
|
|||||||
Better colors for vaapi. It looks a bit off when recording vscode for example.
|
Better colors for vaapi. It looks a bit off when recording vscode for example.
|
||||||
|
|
||||||
Clear vaapi surface (for focused window).
|
Clear vaapi surface (for focused window).
|
||||||
Support -h and --help. -h should only show the first line and --help the full help. On error, only show that -h.
|
Support -h and --help. -h should only show the first line and --help the full help. On error, only show that -h.
|
||||||
|
|
||||||
|
Rotated display on amd doesn't work correctly (if you only have 1 monitor connected and it's rotated), even with ffmpeg kmsgrab. The drmfd is rotated as well so it needs to be rotated in the surface copy.
|
@ -148,6 +148,7 @@ static void gsr_capture_kms_vaapi_tick(gsr_capture *cap, AVCodecContext *video_c
|
|||||||
//const double window_resize_timeout = 1.0; // 1 second
|
//const double window_resize_timeout = 1.0; // 1 second
|
||||||
if(!cap_kms->created_hw_frame) {
|
if(!cap_kms->created_hw_frame) {
|
||||||
cap_kms->created_hw_frame = true;
|
cap_kms->created_hw_frame = true;
|
||||||
|
|
||||||
av_frame_free(frame);
|
av_frame_free(frame);
|
||||||
*frame = av_frame_alloc();
|
*frame = av_frame_alloc();
|
||||||
if(!frame) {
|
if(!frame) {
|
||||||
@ -173,6 +174,8 @@ static void gsr_capture_kms_vaapi_tick(gsr_capture *cap, AVCodecContext *video_c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VASurfaceID target_surface_id = (uintptr_t)(*frame)->data[3];
|
||||||
|
|
||||||
VAStatus va_status = vaCreateConfig(cap_kms->va_dpy, VAProfileNone, VAEntrypointVideoProc, NULL, 0, &cap_kms->config_id);
|
VAStatus va_status = vaCreateConfig(cap_kms->va_dpy, VAProfileNone, VAEntrypointVideoProc, NULL, 0, &cap_kms->config_id);
|
||||||
if(va_status != VA_STATUS_SUCCESS) {
|
if(va_status != VA_STATUS_SUCCESS) {
|
||||||
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_tick: vaCreateConfig failed: %d\n", va_status);
|
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_tick: vaCreateConfig failed: %d\n", va_status);
|
||||||
@ -180,6 +183,14 @@ static void gsr_capture_kms_vaapi_tick(gsr_capture *cap, AVCodecContext *video_c
|
|||||||
cap_kms->stop_is_error = true;
|
cap_kms->stop_is_error = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
va_status = vaCreateContext(cap_kms->va_dpy, cap_kms->config_id, cap_kms->kms_size.x, cap_kms->kms_size.y, VA_PROGRESSIVE, &target_surface_id, 1, &cap_kms->context_id);
|
||||||
|
if(va_status != VA_STATUS_SUCCESS) {
|
||||||
|
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_tick: vaCreateContext failed: %d\n", va_status);
|
||||||
|
cap_kms->should_stop = true;
|
||||||
|
cap_kms->stop_is_error = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,11 +234,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
|||||||
cap_kms->buffer_id = 0;
|
cap_kms->buffer_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cap_kms->context_id) {
|
|
||||||
vaDestroyContext(cap_kms->va_dpy, cap_kms->context_id);
|
|
||||||
cap_kms->context_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cap_kms->input_surface) {
|
if(cap_kms->input_surface) {
|
||||||
vaDestroySurfaces(cap_kms->va_dpy, &cap_kms->input_surface, 1);
|
vaDestroySurfaces(cap_kms->va_dpy, &cap_kms->input_surface, 1);
|
||||||
cap_kms->input_surface = 0;
|
cap_kms->input_surface = 0;
|
||||||
@ -272,14 +278,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_status = vaCreateContext(cap_kms->va_dpy, cap_kms->config_id, cap_kms->kms_size.x, cap_kms->kms_size.y, VA_PROGRESSIVE, &target_surface_id, 1, &cap_kms->context_id);
|
|
||||||
if(va_status != VA_STATUS_SUCCESS) {
|
|
||||||
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_capture: vaCreateContext failed: %d\n", va_status);
|
|
||||||
cap_kms->should_stop = true;
|
|
||||||
cap_kms->stop_is_error = true;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cap_kms->input_region = (VARectangle) {
|
cap_kms->input_region = (VARectangle) {
|
||||||
.x = cap_kms->capture_pos.x,
|
.x = cap_kms->capture_pos.x,
|
||||||
.y = cap_kms->capture_pos.y,
|
.y = cap_kms->capture_pos.y,
|
||||||
|
Loading…
Reference in New Issue
Block a user