mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
gbm: Implement dmabuf export for dumb buffers
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
parent
d99a3d9b58
commit
dbe71918aa
1 changed files with 13 additions and 1 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h> /* for O_RDWR, which DRM_RDWR is defined as */
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -446,8 +447,19 @@ gbm_dri_bo_get_fd(struct gbm_bo *_bo)
|
|||
struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
|
||||
int fd;
|
||||
|
||||
if (bo->image == NULL)
|
||||
if (bo->image == NULL) {
|
||||
#ifdef HAVE_LIBDRM
|
||||
struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm);
|
||||
if (dri->has_dmabuf_export) {
|
||||
int ret;
|
||||
int prime_fd = -1;
|
||||
ret = drmPrimeHandleToFD(dri->base.v0.fd, bo->handle, DRM_RDWR, &prime_fd);
|
||||
if (!ret)
|
||||
return prime_fd;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!dri2_query_image(bo->image, __DRI_IMAGE_ATTRIB_FD, &fd))
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue