From 905fea57f04efb5515eff2bcd7076b00d2b81958 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 8 Nov 2023 21:54:47 +1100 Subject: [PATCH] [host] nvfbc: fix stride for odd resolutions in 24-bit mode --- host/platform/Windows/capture/NVFBC/src/nvfbc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index 2b148e5c..4f68d374 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -663,7 +663,15 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame, this->isHDR = this->grabInfo.bIsHDR; // Round up stride in IVSHMEM to avoid issues with dmabuf import. - this->shmStride = ALIGN_PAD(this->grabStride, 32); + if (this->format == CAPTURE_FMT_RGB_24) + { + // EGLImage via DMABUF does not support 24-bit images, the client will + // stuff this into a 32-bit texture so we need to ensure the padding is + // wide enough to keep things aligned. + this->shmStride = ALIGN_PAD(this->grabStride / 4, 64) * 4; + } + else + this->shmStride = ALIGN_PAD(this->grabStride, 64); this->resChanged = false; ++this->formatVer;