Fix open-h264 encoding for AMD GPU

master
Jonas Letzbor 2024-06-12 00:03:21 +02:00
parent ffa0a56335
commit 6dca473059
Signed by: RPJosh
GPG Key ID: 43ACB900522EA740
1 changed files with 9 additions and 7 deletions

View File

@ -38,12 +38,12 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_LINUX_DMA_HEAP // #ifdef HAVE_LINUX_DMA_HEAP
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <linux/dma-heap.h> #include <linux/dma-heap.h>
#define LINUX_CMA_PATH "/dev/dma_heap/linux,cma" #define LINUX_CMA_PATH "/dev/dma_heap/linux,cma"
#endif // HAVE_LINUX_DMA_HEAP //#endif // HAVE_LINUX_DMA_HEAP
#endif // ENABLE_SCREENCOPY_DMABUF #endif // ENABLE_SCREENCOPY_DMABUF
extern struct wl_shm* wl_shm; extern struct wl_shm* wl_shm;
@ -218,14 +218,16 @@ static struct wv_buffer* wv_buffer_create_dmabuf(int width, int height,
self->height = height; self->height = height;
self->format = fourcc; self->format = fourcc;
#ifdef HAVE_LINUX_DMA_HEAP // Checks not needed anymore. Fixed with SCANOUT and within neatvnc for most GPUs.
// But this could still fail!
//#ifdef HAVE_LINUX_DMA_HEAP
self->bo = have_linux_cma() ? self->bo = have_linux_cma() ?
create_cma_gbm_bo(width, height, fourcc) : create_cma_gbm_bo(width, height, fourcc) :
gbm_bo_create(gbm_device, width, height, fourcc, gbm_bo_create(gbm_device, width, height, fourcc,
GBM_BO_USE_RENDERING); GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
#endif //#endif
self->bo = gbm_bo_create(gbm_device, width, height, fourcc, // self->bo = gbm_bo_create(gbm_device, width, height, fourcc,
GBM_BO_USE_RENDERING); // GBM_BO_USE_RENDERING);
if (!self->bo) if (!self->bo)
goto bo_failure; goto bo_failure;