From 3aa8ec295d6e8846977bed3bf268467a28e3afef Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 1 Sep 2015 15:42:54 -0400 Subject: WIP: dup returned fd This will be passed in to driver, who expects to take ownership of the fd.. so don't hand out our internal fd without dup()'ing it. TODO: double check this.. EGL_EXT_image_dma_buf_import says driver does not take ownership of the fd, and I think platform_android is using almost the same code-paths.. so possibly the dup() should be in the driver. (but dri3 doesn't appear to explode.. root question is whether screen->resource_from_handle() takes ownership of the fd or not, so not sure if there is already a dup() somewhere in the dma_buf_import path.) --- gralloc_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gralloc_drm.c b/gralloc_drm.c index 0b2d20d..3f3f529 100644 --- a/gralloc_drm.c +++ b/gralloc_drm.c @@ -385,7 +385,7 @@ int gralloc_drm_get_prime_fd(buffer_handle_t _handle) { struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle); LOGHDL(handle); - return (handle) ? handle->prime_fd : -1; + return (handle) ? dup(handle->prime_fd) : -1; } int gralloc_drm_get_gem_handle(buffer_handle_t _handle) -- cgit v1.2.3