mmap with PROT_WRITE of dma-buf FD coming from eglExportDMABUFImageMESA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm currently trying to mmap the memory of an OpenGL texture I've created by
doing the following:

std::vector<EGLint> image_attribs = {
        EGL_WIDTH,              static_cast<int>(m_texWidth & 0x7FFFFFFF),
        EGL_HEIGHT,             static_cast<int>(m_texHeight & 0x7FFFFFFF),
        EGL_DRM_BUFFER_USE_MESA, EGL_DRM_BUFFER_USE_SCANOUT_MESA,
        EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA
        EGL_NONE
    };
glGenTextures( 1, &texID );
glBindTexture( GL_TEXTURE_2D, texID );
eglImage = eglCreateDRMImageMESA( eglGetCurrentDisplay(), &image_attribs[0] );
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglmage);
eglExportDMABUFImageQueryMESA(eglGetCurrentDisplay(), eglImage, &fourcc, &nplanes, &modifiers) eglExportDMABUFImageMESA(eglGetCurrentDisplay(), eglImage, &fd, strides, offsets)

struct dma_buf_sync sync_args = { .flags = DMA_BUF_SYNC_START };
ioctl( fd, DMA_BUF_IOCTL_SYNC, sync_args);
mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );

For some reason mmap returns MAP_FAILED when using the PROT_WRITE flag, while using only PROT_READ seems to be fine. I'm currently using kernel 4.9.6 on an Intel CherryTrail (i915).

Is there an obvious reason why I'm not able to mmap the texture FD with PROT_WRITE flags? Reading https://01.org/blogs/2016/sharing-cpu-and-gpu-buffers-linux I would have guessed that this should be possible. Or is it only true for specific GEM buffers not textures created using
eglCreateDRMImageMESA?

Regards,
    Volker

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux