[PATCH libdrm] omap: add omapdrm support

Rob Clark rob.clark at linaro.org
Wed Mar 28 12:35:26 PDT 2012


On Wed, Mar 28, 2012 at 2:24 PM, Alex Deucher <alexdeucher at gmail.com> wrote:
> On Wed, Mar 28, 2012 at 12:54 PM, Rob Clark <rob.clark at linaro.org> wrote:
>> From: Rob Clark <rob at ti.com>
>>
>> This adds libdrm_omap helper layer (as used by xf86-video-omap,
>> omapdrmtest, etc).
>>
>> Signed-off-by: Rob Clark <rob at ti.com>
>
> A couple of comments below, other than that,
>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
>
>> ---
>> v1: original
>> v2: address comments from Luca Tettamanti
>>
>>  Makefile.am               |    6 +-
>>  configure.ac              |   12 ++
>>  omap/Makefile.am          |   22 +++
>>  omap/libdrm_omap.pc.in    |   11 ++
>>  omap/omap_drm.c           |  310 +++++++++++++++++++++++++++++++++++++++++++++
>>  omap/omap_drm.h           |  125 ++++++++++++++++++
>>  omap/omap_drmif.h         |   61 +++++++++
>>  tests/modetest/modetest.c |    2 +-
>>  8 files changed, 547 insertions(+), 2 deletions(-)
>>  create mode 100644 omap/Makefile.am
>>  create mode 100644 omap/libdrm_omap.pc.in
>>  create mode 100644 omap/omap_drm.c
>>  create mode 100644 omap/omap_drm.h
>>  create mode 100644 omap/omap_drmif.h
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index a4d07f4..4f625a1 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -41,7 +41,11 @@ if HAVE_RADEON
>>  RADEON_SUBDIR = radeon
>>  endif
>>
>> -SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) tests include
>> +if HAVE_OMAP
>> +OMAP_SUBDIR = omap
>> +endif
>> +
>> +SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) tests include
>>
>>  libdrm_la_LTLIBRARIES = libdrm.la
>>  libdrm_ladir = $(libdir)
>> diff --git a/configure.ac b/configure.ac
>> index ff2c840..921dcbd 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -83,6 +83,10 @@ AC_ARG_ENABLE(nouveau-experimental-api,
>>              [Enable support for nouveau's experimental API (default: disabled)]),
>>              [NOUVEAU=$enableval], [NOUVEAU=no])
>>
>> +AC_ARG_ENABLE(omap-experimental-api,
>> +             AS_HELP_STRING([--enable-omap-experimental-api],
>> +             [Enable support for OMAP's experimental API (default: disabled)]),
>> +             [OMAP=$enableval], [OMAP=no])
>>
>>  dnl ===========================================================================
>>  dnl check compiler flags
>> @@ -182,6 +186,11 @@ if test "x$NOUVEAU" = xyes; then
>>        AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau (nvidia) support])
>>  fi
>>
>> +AM_CONDITIONAL(HAVE_OMAP, [test "x$OMAP" = xyes])
>> +if test "x$OMAP" = xyes; then
>> +       AC_DEFINE(HAVE_OMAP, 1, [Have OMAP support])
>> +fi
>> +
>>  PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no])
>>  if test "x$HAVE_CAIRO" = xyes; then
>>        AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support])
>> @@ -291,6 +300,8 @@ AC_CONFIG_FILES([
>>        radeon/libdrm_radeon.pc
>>        nouveau/Makefile
>>        nouveau/libdrm_nouveau.pc
>> +       omap/Makefile
>> +       omap/libdrm_omap.pc
>>        tests/Makefile
>>        tests/modeprint/Makefile
>>        tests/modetest/Makefile
>> @@ -310,4 +321,5 @@ echo "  Intel API      $INTEL"
>>  echo "  vmwgfx API     $VMWGFX"
>>  echo "  Radeon API     $RADEON"
>>  echo "  Nouveau API    $NOUVEAU"
>> +echo "  OMAP API       $OMAP"
>>  echo ""
>> diff --git a/omap/Makefile.am b/omap/Makefile.am
>> new file mode 100644
>> index 0000000..c77520b
>> --- /dev/null
>> +++ b/omap/Makefile.am
>> @@ -0,0 +1,22 @@
>> +AM_CFLAGS = \
>> +       $(WARN_CFLAGS) \
>> +       -I$(top_srcdir) \
>> +       -I$(top_srcdir)/omap \
>> +       $(PTHREADSTUBS_CFLAGS) \
>> +       -I$(top_srcdir)/include/drm
>> +
>> +libdrm_omap_la_LTLIBRARIES = libdrm_omap.la
>> +libdrm_omap_ladir = $(libdir)
>> +libdrm_omap_la_LDFLAGS = -version-number 1:0:0 -no-undefined
>> +libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
>> +
>> +libdrm_omap_la_SOURCES = omap_drm.c
>> +
>> +libdrm_omapcommonincludedir = ${includedir}/omap
>> +libdrm_omapcommoninclude_HEADERS = omap_drm.h
>> +
>> +libdrm_omapincludedir = ${includedir}/libdrm
>> +libdrm_omapinclude_HEADERS = omap_drmif.h
>> +
>> +pkgconfigdir = @pkgconfigdir@
>> +pkgconfig_DATA = libdrm_omap.pc
>> diff --git a/omap/libdrm_omap.pc.in b/omap/libdrm_omap.pc.in
>> new file mode 100644
>> index 0000000..024533b
>> --- /dev/null
>> +++ b/omap/libdrm_omap.pc.in
>> @@ -0,0 +1,11 @@
>> +prefix=@prefix@
>> +exec_prefix=@exec_prefix@
>> +libdir=@libdir@
>> +includedir=@includedir@
>> +
>> +Name: libdrm_omap
>> +Description: Userspace interface to omap kernel DRM services
>> +Version: 0.6
>> +Libs: -L${libdir} -ldrm_omap
>> +Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/omap
>> +Requires.private: libdrm
>> diff --git a/omap/omap_drm.c b/omap/omap_drm.c
>> new file mode 100644
>> index 0000000..f86e0c7
>> --- /dev/null
>> +++ b/omap/omap_drm.c
>> @@ -0,0 +1,310 @@
>> +/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
>> +
>> +/*
>> + * Copyright (C) 2011 Texas Instruments, Inc
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the next
>> + * paragraph) shall be included in all copies or substantial portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> + * SOFTWARE.
>> + *
>> + * Authors:
>> + *    Rob Clark <rob at ti.com>
>> + */
>> +
>> +#ifdef HAVE_CONFIG_H
>> +#include "config.h"
>> +#endif
>> +
>> +#include <stdlib.h>
>> +#include <linux/stddef.h>
>> +#include <errno.h>
>> +#include <sys/mman.h>
>> +
>> +#include <xf86drm.h>
>> +
>> +#include "omap_drm.h"
>> +#include "omap_drmif.h"
>> +
>> +#define __round_mask(x, y) ((__typeof__(x))((y)-1))
>> +#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
>> +#define PAGE_SIZE 4096
>> +
>> +struct omap_device {
>> +       int fd;
>> +};
>> +
>> +/* a GEM buffer object allocated from the DRM device */
>> +struct omap_bo {
>> +       struct omap_device      *dev;
>> +       void            *map;           /* userspace mmap'ing (if there is one) */
>> +       uint32_t        size;
>> +       uint32_t        handle;
>> +       uint32_t        name;           /* flink global handle (DRI2 name) */
>> +       uint64_t        offset;         /* offset to mmap() */
>> +};
>> +
>> +struct omap_device * omap_device_new(int fd)
>> +{
>> +       struct omap_device *dev = calloc(sizeof(*dev), 1);
>> +       if (!dev)
>> +               return NULL;
>> +       dev->fd = fd;
>> +       return dev;
>> +}
>> +
>> +void omap_device_del(struct omap_device *dev)
>> +{
>> +       free(dev);
>> +}
>> +
>> +int omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
>> +{
>> +       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;
>> +}
>> +
>> +int omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value)
>> +{
>> +       struct drm_omap_param req = {
>> +                       .param = param,
>> +                       .value = value,
>> +       };
>> +       return drmCommandWrite(dev->fd, DRM_OMAP_GET_PARAM, &req, sizeof(req));
>
>         ^^^^^^^^^^^^^^
>
> Shouldn't that be DRM_OMAP_SET_PARAM?

oh, doh!  Yes, you are correct.  The params so far are all read-only
so I didn't catch this typo.

I'll send one more (hopefully last) update

>
>> +}
>> +
>> +/* allocate a new buffer object */
>> +static struct omap_bo * omap_bo_new_impl(struct omap_device *dev,
>> +               union omap_gem_size size, uint32_t flags)
>> +{
>> +       struct omap_bo *bo;
>> +       struct drm_omap_gem_new req = {
>> +                       .size = size,
>> +                       .flags = flags,
>> +       };
>> +
>> +       if (size.bytes == 0) {
>> +               goto fail;
>> +       }
>> +
>> +       bo = calloc(sizeof(*bo), 1);
>> +       if (!bo) {
>> +               goto fail;
>> +       }
>> +
>> +       bo->dev = dev;
>> +
>> +       if (flags & OMAP_BO_TILED) {
>> +               bo->size = round_up(size.tiled.width, PAGE_SIZE) * size.tiled.height;
>> +       } else {
>> +               bo->size = size.bytes;
>> +       }
>> +
>> +       if (drmCommandWriteRead(dev->fd, DRM_OMAP_GEM_NEW, &req, sizeof(req))) {
>> +               goto fail;
>> +       }
>> +
>> +       bo->handle = req.handle;
>> +
>> +       return bo;
>> +
>> +fail:
>> +       free(bo);
>> +       return NULL;
>> +}
>> +
>> +
>> +/* allocate a new (un-tiled) buffer object */
>> +struct omap_bo * omap_bo_new(struct omap_device *dev,
>> +               uint32_t size, uint32_t flags)
>> +{
>> +       union omap_gem_size gsize = {
>> +                       .bytes = size,
>> +       };
>> +       if (flags & OMAP_BO_TILED) {
>> +               return NULL;
>> +       }
>> +       return omap_bo_new_impl(dev, gsize, flags);
>> +}
>> +
>> +/* allocate a new buffer object */
>> +struct omap_bo * omap_bo_new_tiled(struct omap_device *dev,
>> +               uint32_t width, uint32_t height, uint32_t flags)
>> +{
>> +       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);
>> +}
>> +
>> +/* get buffer info */
>> +static int get_buffer_info(struct omap_bo *bo)
>> +{
>> +       struct drm_omap_gem_info req = {
>> +                       .handle = bo->handle,
>> +       };
>> +       int ret = drmCommandWriteRead(bo->dev->fd, DRM_OMAP_GEM_INFO,
>> +                       &req, sizeof(req));
>> +       if (ret) {
>> +               return ret;
>> +       }
>> +
>> +       /* really all we need for now is mmap offset */
>> +       bo->offset = req.offset;
>> +       bo->size = req.size;
>> +
>> +       return 0;
>> +}
>> +
>> +/* import a buffer object from DRI2 name */
>> +struct omap_bo * omap_bo_from_name(struct omap_device *dev, uint32_t name)
>> +{
>> +       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;
>> +}
>> +
>> +/* destroy a buffer object */
>> +void omap_bo_del(struct omap_bo *bo)
>> +{
>> +       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);
>> +}
>> +
>> +/* get the global flink/DRI2 buffer name */
>> +int omap_bo_get_name(struct omap_bo *bo, uint32_t *name)
>> +{
>> +       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;
>> +}
>> +
>> +uint32_t omap_bo_handle(struct omap_bo *bo)
>> +{
>> +       return bo->handle;
>> +}
>> +
>> +uint32_t omap_bo_size(struct omap_bo *bo)
>> +{
>> +       if (!bo->size) {
>> +               get_buffer_info(bo);
>> +       }
>> +       return bo->size;
>> +}
>> +
>> +void * omap_bo_map(struct omap_bo *bo)
>> +{
>> +       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;
>> +}
>> +
>> +int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op)
>> +{
>> +       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));
>> +}
>> +
>> +int omap_bo_cpu_fini(struct omap_bo *bo, enum omap_gem_op op)
>> +{
>> +       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));
>> +}
>> diff --git a/omap/omap_drm.h b/omap/omap_drm.h
>> new file mode 100644
>> index 0000000..f277cea
>> --- /dev/null
>> +++ b/omap/omap_drm.h
>> @@ -0,0 +1,125 @@
>> +/*
>> + * include/drm/omap_drm.h
>> + *
>> + * Copyright (C) 2011 Texas Instruments
>> + * Author: Rob Clark <rob at ti.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License version 2 as published by
>> + * the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful, but WITHOUT
>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>> + * more details.
>> + *
>> + * You should have received a copy of the GNU General Public License along with
>> + * this program.  If not, see <http://www.gnu.org/licenses/>.
>> + */
>> +
>> +#ifndef __OMAP_DRM_H__
>> +#define __OMAP_DRM_H__
>> +
>> +#include "drm.h"
>> +
>> +/* Please note that modifications to all structs defined here are
>> + * subject to backwards-compatibility constraints.
>> + */
>> +
>> +#define OMAP_PARAM_CHIPSET_ID  1       /* ie. 0x3430, 0x4430, etc */
>> +
>> +struct drm_omap_param {
>> +       uint64_t param;                 /* in */
>> +       uint64_t value;                 /* in (set_param), out (get_param) */
>> +};
>> +
>> +struct drm_omap_get_base {
>> +       char plugin_name[64];           /* in */
>> +       uint32_t ioctl_base;            /* out */
>> +       uint32_t __pad;
>> +};
>> +
>> +#define OMAP_BO_SCANOUT                0x00000001      /* scanout capable (phys contiguous) */
>> +#define OMAP_BO_CACHE_MASK     0x00000006      /* cache type mask, see cache modes */
>> +#define OMAP_BO_TILED_MASK     0x00000f00      /* tiled mapping mask, see tiled modes */
>> +
>> +/* cache modes */
>> +#define OMAP_BO_CACHED         0x00000000      /* default */
>> +#define OMAP_BO_WC             0x00000002      /* write-combine */
>> +#define OMAP_BO_UNCACHED       0x00000004      /* strongly-ordered (uncached) */
>> +
>> +/* tiled modes */
>> +#define OMAP_BO_TILED_8                0x00000100
>> +#define OMAP_BO_TILED_16       0x00000200
>> +#define OMAP_BO_TILED_32       0x00000300
>> +#define OMAP_BO_TILED          (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32)
>
> These TILED defines look fishy.

the 8/16/32b tiled modes are mutually exclusive.. so I set it up as a
bitfield, rather than individual flags.  Maybe OMAP_BO_TILED should be
the same as OMAP_BO_TILED_MASK?  I guess for now I should keep this
header in sync w/ it's kernel counterpart, although this wouldn't be
an incompatible change to make.  (OMAP_BO_TILED_MASK just leave some
extra bits free to add more tiled modes later as the hw designers
dream up new kinds of crazy.)

BR,
-R

>> +
>> +union omap_gem_size {
>> +       uint32_t bytes;         /* (for non-tiled formats) */
>> +       struct {
>> +               uint16_t width;
>> +               uint16_t height;
>> +       } tiled;                /* (for tiled formats) */
>> +};
>> +
>> +struct drm_omap_gem_new {
>> +       union omap_gem_size size;       /* in */
>> +       uint32_t flags;                 /* in */
>> +       uint32_t handle;                /* out */
>> +       uint32_t __pad;
>> +};
>> +
>> +/* mask of operations: */
>> +enum omap_gem_op {
>> +       OMAP_GEM_READ = 0x01,
>> +       OMAP_GEM_WRITE = 0x02,
>> +};
>> +
>> +struct drm_omap_gem_cpu_prep {
>> +       uint32_t handle;                /* buffer handle (in) */
>> +       uint32_t op;                    /* mask of omap_gem_op (in) */
>> +};
>> +
>> +struct drm_omap_gem_cpu_fini {
>> +       uint32_t handle;                /* buffer handle (in) */
>> +       uint32_t op;                    /* mask of omap_gem_op (in) */
>> +       /* TODO maybe here we pass down info about what regions are touched
>> +        * by sw so we can be clever about cache ops?  For now a placeholder,
>> +        * set to zero and we just do full buffer flush..
>> +        */
>> +       uint32_t nregions;
>> +       uint32_t __pad;
>> +};
>> +
>> +struct drm_omap_gem_info {
>> +       uint32_t handle;                /* buffer handle (in) */
>> +       uint32_t pad;
>> +       uint64_t offset;                /* mmap offset (out) */
>> +       /* note: in case of tiled buffers, the user virtual size can be
>> +        * different from the physical size (ie. how many pages are needed
>> +        * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
>> +        * This size here is the one that should be used if you want to
>> +        * mmap() the buffer:
>> +        */
>> +       uint32_t size;                  /* virtual size for mmap'ing (out) */
>> +       uint32_t __pad;
>> +};
>> +
>> +#define DRM_OMAP_GET_PARAM             0x00
>> +#define DRM_OMAP_SET_PARAM             0x01
>> +#define DRM_OMAP_GET_BASE              0x02
>> +#define DRM_OMAP_GEM_NEW               0x03
>> +#define DRM_OMAP_GEM_CPU_PREP          0x04
>> +#define DRM_OMAP_GEM_CPU_FINI          0x05
>> +#define DRM_OMAP_GEM_INFO              0x06
>> +#define DRM_OMAP_NUM_IOCTLS            0x07
>> +
>> +#define DRM_IOCTL_OMAP_GET_PARAM       DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
>> +#define DRM_IOCTL_OMAP_SET_PARAM       DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
>> +#define DRM_IOCTL_OMAP_GET_BASE                DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_BASE, struct drm_omap_get_base)
>> +#define DRM_IOCTL_OMAP_GEM_NEW         DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
>> +#define DRM_IOCTL_OMAP_GEM_CPU_PREP    DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
>> +#define DRM_IOCTL_OMAP_GEM_CPU_FINI    DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
>> +#define DRM_IOCTL_OMAP_GEM_INFO                DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
>> +
>> +#endif /* __OMAP_DRM_H__ */
>> diff --git a/omap/omap_drmif.h b/omap/omap_drmif.h
>> new file mode 100644
>> index 0000000..eb75a80
>> --- /dev/null
>> +++ b/omap/omap_drmif.h
>> @@ -0,0 +1,61 @@
>> +/*
>> + * Copyright (C) 2011 Texas Instruments, Inc
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the next
>> + * paragraph) shall be included in all copies or substantial portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> + * SOFTWARE.
>> + *
>> + * Authors:
>> + *    Rob Clark <rob at ti.com>
>> + */
>> +
>> +#ifndef OMAP_DRMIF_H_
>> +#define OMAP_DRMIF_H_
>> +
>> +#include <xf86drm.h>
>> +#include <stdint.h>
>> +#include <omap_drm.h>
>> +
>> +struct omap_bo;
>> +struct omap_device;
>> +
>> +/* device related functions:
>> + */
>> +
>> +struct omap_device * omap_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);
>> +
>> +/* buffer-object related functions:
>> + */
>> +
>> +struct omap_bo * omap_bo_new(struct omap_device *dev,
>> +               uint32_t size, uint32_t flags);
>> +struct omap_bo * omap_bo_new_tiled(struct omap_device *dev,
>> +               uint32_t width, uint32_t height, uint32_t flags);
>> +struct omap_bo * omap_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);
>> +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);
>> +
>> +#endif /* OMAP_DRMIF_H_ */
>> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
>> index 229ab8a..1e4ec91 100644
>> --- a/tests/modetest/modetest.c
>> +++ b/tests/modetest/modetest.c
>> @@ -721,7 +721,7 @@ int main(int argc, char **argv)
>>        int c;
>>        int encoders = 0, connectors = 0, crtcs = 0, framebuffers = 0;
>>        int test_vsync = 0;
>> -       char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" };
>> +       char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm" };
>>        char *modeset = NULL;
>>        int i, count = 0;
>>        struct connector con_args[2];
>> --
>> 1.7.9.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list