Back to index

libdrm  2.4.37
Classes | Functions
exynos_drmif.h File Reference
#include <xf86drm.h>
#include <stdint.h>
#include "exynos_drm.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  exynos_device
struct  exynos_bo

Functions

struct exynos_deviceexynos_device_create (int fd)
void exynos_device_destroy (struct exynos_device *dev)
struct exynos_boexynos_bo_create (struct exynos_device *dev, size_t size, uint32_t flags)
int exynos_bo_get_info (struct exynos_device *dev, uint32_t handle, size_t *size, uint32_t *flags)
void exynos_bo_destroy (struct exynos_bo *bo)
struct exynos_boexynos_bo_from_name (struct exynos_device *dev, uint32_t name)
int exynos_bo_get_name (struct exynos_bo *bo, uint32_t *name)
uint32_t exynos_bo_handle (struct exynos_bo *bo)
void * exynos_bo_map (struct exynos_bo *bo)
int exynos_prime_handle_to_fd (struct exynos_device *dev, uint32_t handle, int *fd)
int exynos_prime_fd_to_handle (struct exynos_device *dev, int fd, uint32_t *handle)
int exynos_vidi_connection (struct exynos_device *dev, uint32_t connect, uint32_t ext, void *edid)

Class Documentation

struct exynos_device

Definition at line 34 of file exynos_drmif.h.

Class Members
int fd
struct exynos_bo

Definition at line 49 of file exynos_drmif.h.

Collaboration diagram for exynos_bo:
Class Members
struct exynos_device * dev
int fd
uint32_t flags
uint32_t handle
uint32_t name
size_t size
void * vaddr

Function Documentation

struct exynos_bo* exynos_bo_create ( struct exynos_device dev,
size_t  size,
uint32_t  flags 
) [read]

Definition at line 90 of file exynos_drm.c.

{
       struct exynos_bo *bo;
       struct drm_exynos_gem_create req = {
              .size = size,
              .flags = flags,
       };

       if (size == 0) {
              fprintf(stderr, "invalid size.\n");
              goto fail;
       }

       bo = calloc(sizeof(*bo), 1);
       if (!bo) {
              fprintf(stderr, "failed to create bo[%s].\n",
                            strerror(errno));
              goto err_free_bo;
       }

       bo->dev = dev;

       if (drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_GEM_CREATE, &req)){
              fprintf(stderr, "failed to create gem object[%s].\n",
                            strerror(errno));
              goto err_free_bo;
       }

       bo->handle = req.handle;
       bo->size = size;
       bo->flags = flags;

       return bo;

err_free_bo:
       free(bo);
fail:
       return NULL;
}

Here is the call graph for this function:

void exynos_bo_destroy ( struct exynos_bo bo)

Definition at line 170 of file exynos_drm.c.

{
       if (!bo)
              return;

       if (bo->vaddr)
              munmap(bo->vaddr, bo->size);

       if (bo->handle) {
              struct drm_gem_close req = {
                     .handle = bo->handle,
              };

              drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_CLOSE, &req);
       }

       free(bo);
}

Here is the call graph for this function:

struct exynos_bo* exynos_bo_from_name ( struct exynos_device dev,
uint32_t  name 
) [read]

Definition at line 202 of file exynos_drm.c.

{
       struct exynos_bo *bo;
       struct drm_gem_open req = {
              .name = name,
       };

       bo = calloc(sizeof(*bo), 1);
       if (!bo) {
              fprintf(stderr, "failed to allocate bo[%s].\n",
                            strerror(errno));
              return NULL;
       }

       if (drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req)) {
              fprintf(stderr, "failed to open gem object[%s].\n",
                            strerror(errno));
              goto err_free_bo;
       }

       bo->dev = dev;
       bo->name = name;
       bo->handle = req.handle;

       return bo;

err_free_bo:
       free(bo);
       return NULL;
}

Here is the call graph for this function:

int exynos_bo_get_info ( struct exynos_device dev,
uint32_t  handle,
size_t *  size,
uint32_t *  flags 
)

Definition at line 144 of file exynos_drm.c.

{
       int ret;
       struct drm_exynos_gem_info req = {
              .handle = handle,
       };

       ret = drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_GEM_GET, &req);
       if (ret < 0) {
              fprintf(stderr, "failed to get gem object information[%s].\n",
                            strerror(errno));
              return ret;
       }

       *size = req.size;
       *flags = req.flags;

       return 0;
}

Here is the call graph for this function:

int exynos_bo_get_name ( struct exynos_bo bo,
uint32_t *  name 
)

Definition at line 244 of file exynos_drm.c.

{
       if (!bo->name) {
              struct drm_gem_flink req = {
                     .handle = bo->handle,
              };
              int ret;

              ret = drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_FLINK, &req);
              if (ret) {
                     fprintf(stderr, "failed to get gem global name[%s].\n",
                                   strerror(errno));
                     return ret;
              }

              bo->name = req.name;
       }

       *name = bo->name;

       return 0;
}

Here is the call graph for this function:

uint32_t exynos_bo_handle ( struct exynos_bo bo)

Definition at line 267 of file exynos_drm.c.

{
       return bo->handle;
}
void* exynos_bo_map ( struct exynos_bo bo)

Definition at line 280 of file exynos_drm.c.

{
       if (!bo->vaddr) {
              struct exynos_device *dev = bo->dev;
              struct drm_exynos_gem_mmap req = {
                     .handle = bo->handle,
                     .size  = bo->size,
              };
              int ret;

              ret = drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_GEM_MMAP, &req);
              if (ret) {
                     fprintf(stderr, "failed to mmap[%s].\n",
                            strerror(errno));
                     return NULL;
              }

              bo->vaddr = req.mapped;
       }

       return bo->vaddr;
}

Here is the call graph for this function:

struct exynos_device* exynos_device_create ( int  fd) [read]

Definition at line 51 of file exynos_drm.c.

{
       struct exynos_device *dev;

       dev = calloc(sizeof(*dev), 1);
       if (!dev) {
              fprintf(stderr, "failed to create device[%s].\n",
                            strerror(errno));
              return NULL;
       }

       dev->fd = fd;

       return dev;
}
void exynos_device_destroy ( struct exynos_device dev)

Definition at line 72 of file exynos_drm.c.

{
       free(dev);
}
int exynos_prime_fd_to_handle ( struct exynos_device dev,
int  fd,
uint32_t *  handle 
)

Definition at line 342 of file exynos_drm.c.

{
       int ret;
       struct drm_prime_handle req = {
              .fd    = fd,
       };

       ret = drmIoctl(dev->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &req);
       if (ret) {
              fprintf(stderr, "failed to mmap[%s].\n",
                     strerror(errno));
              return ret;
       }

       *handle = req.handle;
       return 0;
}

Here is the call graph for this function:

int exynos_prime_handle_to_fd ( struct exynos_device dev,
uint32_t  handle,
int *  fd 
)

Definition at line 313 of file exynos_drm.c.

{
       int ret;
       struct drm_prime_handle req = {
              .handle       = handle,
       };

       ret = drmIoctl(dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &req);
       if (ret) {
              fprintf(stderr, "failed to mmap[%s].\n",
                     strerror(errno));
              return ret;
       }

       *fd = req.fd;
       return 0;
}

Here is the call graph for this function:

int exynos_vidi_connection ( struct exynos_device dev,
uint32_t  connect,
uint32_t  ext,
void *  edid 
)

Definition at line 378 of file exynos_drm.c.

{
       struct drm_exynos_vidi_connection req = {
              .connection   = connect,
              .extensions   = ext,
              .edid         = edid,
       };
       int ret;

       ret = drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_VIDI_CONNECTION, &req);
       if (ret) {
              fprintf(stderr, "failed to request vidi connection[%s].\n",
                            strerror(errno));
              return ret;
       }

       return 0;
}

Here is the call graph for this function: