mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
dmabuf: fix mmap() calls
* We cannot map with offset, because offsets need to be page-size aligned. And our code doesn't expect an offset anyway. * The error return value from mmap() is MAP_FAILED aka -1, not NULL aka 0.
This commit is contained in:
parent
1afb832ff0
commit
619926ec83
@ -2134,8 +2134,8 @@ gdk_dmabuf_do_download_mmap (GdkTexture *texture,
|
||||
if (gdk_dmabuf_ioctl (dmabuf->planes[i].fd, DMA_BUF_IOCTL_SYNC, &(struct dma_buf_sync) { DMA_BUF_SYNC_START|DMA_BUF_SYNC_READ }) < 0)
|
||||
g_warning ("Failed to sync dmabuf: %s", g_strerror (errno));
|
||||
|
||||
src_data[i] = mmap (NULL, sizes[i], PROT_READ, MAP_SHARED, dmabuf->planes[i].fd, dmabuf->planes[i].offset);
|
||||
if (src_data[i] == NULL)
|
||||
src_data[i] = mmap (NULL, sizes[i], PROT_READ, MAP_SHARED, dmabuf->planes[i].fd, 0);
|
||||
if (src_data[i] == NULL || src_data[i] == MAP_FAILED)
|
||||
{
|
||||
g_warning ("Failed to mmap dmabuf: %s", g_strerror (errno));
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user