diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-06-19 00:05:23 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-06-19 00:05:23 +0200 |
commit | b3acabbf34aa3638def53abc30bff3ef646cd60a (patch) | |
tree | 5320c4e8a9dca0e33292afb87e56423f606b8a2a | |
parent | 3e2e2444d9fa65ae404604542689cf7829c99cfa (diff) |
AMD: align av1 to extra padding because of hardware bug
-rw-r--r-- | src/capture/kms.c | 11 | ||||
-rw-r--r-- | src/capture/xcomposite.c | 10 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/capture/kms.c b/src/capture/kms.c index 2d1cea3..ec83cab 100644 --- a/src/capture/kms.c +++ b/src/capture/kms.c @@ -77,10 +77,21 @@ int gsr_capture_kms_start(gsr_capture_kms *self, const char *display_to_capture, /* Disable vsync */ egl->eglSwapInterval(egl->egl_display, 0); + // TODO: Move this and xcomposite equivalent to a common section unrelated to capture method if(egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD && video_codec_context->codec_id == AV_CODEC_ID_HEVC) { // TODO: dont do this if using ffmpeg reports that this is not needed (AMD driver bug that was fixed recently) self->base.video_codec_context->width = FFALIGN(self->capture_size.x, 64); self->base.video_codec_context->height = FFALIGN(self->capture_size.y, 16); + } else if(egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD && video_codec_context->codec_id == AV_CODEC_ID_AV1) { + // TODO: Dont do this for VCN 5 and forward which should fix this hardware bug + self->base.video_codec_context->width = FFALIGN(self->capture_size.x, 64); + // AMD driver has special case handling for 1080 height to set it to 1082 instead of 1088 (1080 aligned to 16). + // TODO: Set height to 1082 in this case, but it wont work because it will be aligned to 1088. + if(self->capture_size.y == 1080) { + self->base.video_codec_context->height = 1080; + } else { + self->base.video_codec_context->height = FFALIGN(self->capture_size.y, 16); + } } else { self->base.video_codec_context->width = FFALIGN(self->capture_size.x, 2); self->base.video_codec_context->height = FFALIGN(self->capture_size.y, 2); diff --git a/src/capture/xcomposite.c b/src/capture/xcomposite.c index 236cfc0..59df070 100644 --- a/src/capture/xcomposite.c +++ b/src/capture/xcomposite.c @@ -107,6 +107,16 @@ int gsr_capture_xcomposite_start(gsr_capture_xcomposite *self, AVCodecContext *v // TODO: dont do this if using ffmpeg reports that this is not needed (AMD driver bug that was fixed recently) video_codec_context->width = FFALIGN(video_size.x, 64); video_codec_context->height = FFALIGN(video_size.y, 16); + } else if(self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD && video_codec_context->codec_id == AV_CODEC_ID_AV1) { + // TODO: Dont do this for VCN 5 and forward which should fix this hardware bug + video_codec_context->width = FFALIGN(video_size.x, 64); + // AMD driver has special case handling for 1080 height to set it to 1082 instead of 1088 (1080 aligned to 16). + // TODO: Set height to 1082 in this case, but it wont work because it will be aligned to 1088. + if(video_size.y == 1080) { + video_codec_context->height = 1080; + } else { + video_codec_context->height = FFALIGN(video_size.y, 16); + } } else { video_codec_context->width = FFALIGN(video_size.x, 2); video_codec_context->height = FFALIGN(video_size.y, 2); |