Use drmIoctl() instead of bare ioctl() to handle EINTR/EAGAIN

This commit is contained in:
Cameron Gutman 2024-01-05 18:33:17 -06:00
parent e20d56041e
commit c3e886fbcc

View file

@ -11,7 +11,6 @@ extern "C" {
#include <libdrm/drm_fourcc.h>
#include <linux/dma-buf.h>
#include <sys/ioctl.h>
// Special Rockchip type
#ifndef DRM_FORMAT_NA12
@ -844,7 +843,7 @@ bool DrmRenderer::mapSoftwareFrame(AVFrame *frame, AVDRMFrameDescriptor *mappedF
// Prepare to write to the dumb buffer from the CPU
struct dma_buf_sync sync;
sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_WRITE;
ioctl(drmFrame->primeFd, DMA_BUF_IOCTL_SYNC, &sync);
drmIoctl(drmFrame->primeFd, DMA_BUF_IOCTL_SYNC, &sync);
int lastPlaneSize = 0;
for (int i = 0; i < 4; i++) {
@ -898,7 +897,7 @@ bool DrmRenderer::mapSoftwareFrame(AVFrame *frame, AVDRMFrameDescriptor *mappedF
// End the CPU write to the dumb buffer
sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_WRITE;
ioctl(drmFrame->primeFd, DMA_BUF_IOCTL_SYNC, &sync);
drmIoctl(drmFrame->primeFd, DMA_BUF_IOCTL_SYNC, &sync);
}
ret = true;