Back to index

libdrm  2.4.37
Functions
omap_drmif.h File Reference
#include <xf86drm.h>
#include <stdint.h>
#include <omap_drm.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct omap_deviceomap_device_new (int fd)
void omap_device_del (struct omap_device *dev)
int omap_get_param (struct omap_device *dev, uint64_t param, uint64_t *value)
int omap_set_param (struct omap_device *dev, uint64_t param, uint64_t value)
struct omap_boomap_bo_new (struct omap_device *dev, uint32_t size, uint32_t flags)
struct omap_boomap_bo_new_tiled (struct omap_device *dev, uint32_t width, uint32_t height, uint32_t flags)
struct omap_boomap_bo_from_name (struct omap_device *dev, uint32_t name)
void omap_bo_del (struct omap_bo *bo)
int omap_bo_get_name (struct omap_bo *bo, uint32_t *name)
uint32_t omap_bo_handle (struct omap_bo *bo)
int omap_bo_dmabuf (struct omap_bo *bo)
uint32_t omap_bo_size (struct omap_bo *bo)
void * omap_bo_map (struct omap_bo *bo)
int omap_bo_cpu_prep (struct omap_bo *bo, enum omap_gem_op op)
int omap_bo_cpu_fini (struct omap_bo *bo, enum omap_gem_op op)

Function Documentation

int omap_bo_cpu_fini ( struct omap_bo bo,
enum omap_gem_op  op 
)

Definition at line 322 of file omap_drm.c.

{
       struct drm_omap_gem_cpu_fini req = {
                     .handle = bo->handle,
                     .op = op,
                     .nregions = 0,
       };
       return drmCommandWrite(bo->dev->fd,
                     DRM_OMAP_GEM_CPU_FINI, &req, sizeof(req));
}

Here is the call graph for this function:

int omap_bo_cpu_prep ( struct omap_bo bo,
enum omap_gem_op  op 
)

Definition at line 312 of file omap_drm.c.

{
       struct drm_omap_gem_cpu_prep req = {
                     .handle = bo->handle,
                     .op = op,
       };
       return drmCommandWrite(bo->dev->fd,
                     DRM_OMAP_GEM_CPU_PREP, &req, sizeof(req));
}

Here is the call graph for this function:

void omap_bo_del ( struct omap_bo bo)

Definition at line 221 of file omap_drm.c.

{
       if (!bo) {
              return;
       }

       if (bo->map) {
              munmap(bo->map, 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:

int omap_bo_dmabuf ( struct omap_bo bo)

Definition at line 269 of file omap_drm.c.

{
       if (!bo->fd) {
              struct drm_prime_handle req = {
                            .handle = bo->handle,
                            .flags = DRM_CLOEXEC,
              };
              int ret;

              ret = drmIoctl(bo->dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &req);
              if (ret) {
                     return ret;
              }

              bo->fd = req.fd;
       }
       return bo->fd;
}

Here is the call graph for this function:

struct omap_bo* omap_bo_from_name ( struct omap_device dev,
uint32_t  name 
) [read]

Definition at line 193 of file omap_drm.c.

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

       bo = calloc(sizeof(*bo), 1);
       if (!bo) {
              goto fail;
       }

       if (drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req)) {
              goto fail;
       }

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

       return bo;

fail:
       free(bo);
       return NULL;
}

Here is the call graph for this function:

int omap_bo_get_name ( struct omap_bo bo,
uint32_t *  name 
)

Definition at line 243 of file omap_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) {
                     return ret;
              }

              bo->name = req.name;
       }

       *name = bo->name;

       return 0;
}

Here is the call graph for this function:

uint32_t omap_bo_handle ( struct omap_bo bo)

Definition at line 264 of file omap_drm.c.

{
       return bo->handle;
}
void* omap_bo_map ( struct omap_bo bo)

Definition at line 296 of file omap_drm.c.

{
       if (!bo->map) {
              if (!bo->offset) {
                     get_buffer_info(bo);
              }

              bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE,
                            MAP_SHARED, bo->dev->fd, bo->offset);
              if (bo->map == MAP_FAILED) {
                     bo->map = NULL;
              }
       }
       return bo->map;
}

Here is the call graph for this function:

struct omap_bo* omap_bo_new ( struct omap_device dev,
uint32_t  size,
uint32_t  flags 
) [read]

Definition at line 145 of file omap_drm.c.

{
       union omap_gem_size gsize = {
                     .bytes = size,
       };
       if (flags & OMAP_BO_TILED) {
              return NULL;
       }
       return omap_bo_new_impl(dev, gsize, flags);
}

Here is the call graph for this function:

struct omap_bo* omap_bo_new_tiled ( struct omap_device dev,
uint32_t  width,
uint32_t  height,
uint32_t  flags 
) [read]

Definition at line 158 of file omap_drm.c.

{
       union omap_gem_size gsize = {
                     .tiled = {
                            .width = width,
                            .height = height,
                     },
       };
       if (!(flags & OMAP_BO_TILED)) {
              return NULL;
       }
       return omap_bo_new_impl(dev, gsize, flags);
}

Here is the call graph for this function:

uint32_t omap_bo_size ( struct omap_bo bo)

Definition at line 288 of file omap_drm.c.

{
       if (!bo->size) {
              get_buffer_info(bo);
       }
       return bo->size;
}

Here is the call graph for this function:

void omap_device_del ( struct omap_device dev)

Definition at line 72 of file omap_drm.c.

{
       free(dev);
}
struct omap_device* omap_device_new ( int  fd) [read]

Definition at line 63 of file omap_drm.c.

{
       struct omap_device *dev = calloc(sizeof(*dev), 1);
       if (!dev)
              return NULL;
       dev->fd = fd;
       return dev;
}
int omap_get_param ( struct omap_device dev,
uint64_t  param,
uint64_t *  value 
)

Definition at line 77 of file omap_drm.c.

{
       struct drm_omap_param req = {
                     .param = param,
       };
       int ret;

       ret = drmCommandWriteRead(dev->fd, DRM_OMAP_GET_PARAM, &req, sizeof(req));
       if (ret) {
              return ret;
       }

       *value = req.value;

       return 0;
}

Here is the call graph for this function:

int omap_set_param ( struct omap_device dev,
uint64_t  param,
uint64_t  value 
)

Definition at line 94 of file omap_drm.c.

{
       struct drm_omap_param req = {
                     .param = param,
                     .value = value,
       };
       return drmCommandWrite(dev->fd, DRM_OMAP_SET_PARAM, &req, sizeof(req));
}

Here is the call graph for this function: