Back to index

libdrm  2.4.37
omap_drm.h
Go to the documentation of this file.
00001 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
00002 
00003 /*
00004  * Copyright (C) 2011 Texas Instruments, Inc
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the "Software"),
00008  * to deal in the Software without restriction, including without limitation
00009  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00010  * and/or sell copies of the Software, and to permit persons to whom the
00011  * Software is furnished to do so, subject to the following conditions:
00012  *
00013  * The above copyright notice and this permission notice (including the next
00014  * paragraph) shall be included in all copies or substantial portions of the
00015  * Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00022  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00023  * SOFTWARE.
00024  *
00025  * Authors:
00026  *    Rob Clark <rob@ti.com>
00027  */
00028 
00029 #ifndef __OMAP_DRM_H__
00030 #define __OMAP_DRM_H__
00031 
00032 #include "drm.h"
00033 
00034 /* Please note that modifications to all structs defined here are
00035  * subject to backwards-compatibility constraints.
00036  */
00037 
00038 #define OMAP_PARAM_CHIPSET_ID      1      /* ie. 0x3430, 0x4430, etc */
00039 
00040 struct drm_omap_param {
00041        uint64_t param;                    /* in */
00042        uint64_t value;                    /* in (set_param), out (get_param) */
00043 };
00044 
00045 struct drm_omap_get_base {
00046        char plugin_name[64];              /* in */
00047        uint32_t ioctl_base;        /* out */
00048        uint32_t __pad;
00049 };
00050 
00051 #define OMAP_BO_SCANOUT            0x00000001    /* scanout capable (phys contiguous) */
00052 #define OMAP_BO_CACHE_MASK  0x00000006    /* cache type mask, see cache modes */
00053 #define OMAP_BO_TILED_MASK  0x00000f00    /* tiled mapping mask, see tiled modes */
00054 
00055 /* cache modes */
00056 #define OMAP_BO_CACHED             0x00000000    /* default */
00057 #define OMAP_BO_WC          0x00000002    /* write-combine */
00058 #define OMAP_BO_UNCACHED    0x00000004    /* strongly-ordered (uncached) */
00059 
00060 /* tiled modes */
00061 #define OMAP_BO_TILED_8            0x00000100
00062 #define OMAP_BO_TILED_16    0x00000200
00063 #define OMAP_BO_TILED_32    0x00000300
00064 #define OMAP_BO_TILED              (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32)
00065 
00066 union omap_gem_size {
00067        uint32_t bytes;             /* (for non-tiled formats) */
00068        struct {
00069               uint16_t width;
00070               uint16_t height;
00071        } tiled;             /* (for tiled formats) */
00072 };
00073 
00074 struct drm_omap_gem_new {
00075        union omap_gem_size size;   /* in */
00076        uint32_t flags;                    /* in */
00077        uint32_t handle;            /* out */
00078        uint32_t __pad;
00079 };
00080 
00081 /* mask of operations: */
00082 enum omap_gem_op {
00083        OMAP_GEM_READ = 0x01,
00084        OMAP_GEM_WRITE = 0x02,
00085 };
00086 
00087 struct drm_omap_gem_cpu_prep {
00088        uint32_t handle;            /* buffer handle (in) */
00089        uint32_t op;                /* mask of omap_gem_op (in) */
00090 };
00091 
00092 struct drm_omap_gem_cpu_fini {
00093        uint32_t handle;            /* buffer handle (in) */
00094        uint32_t op;                /* mask of omap_gem_op (in) */
00095        /* TODO maybe here we pass down info about what regions are touched
00096         * by sw so we can be clever about cache ops?  For now a placeholder,
00097         * set to zero and we just do full buffer flush..
00098         */
00099        uint32_t nregions;
00100        uint32_t __pad;
00101 };
00102 
00103 struct drm_omap_gem_info {
00104        uint32_t handle;            /* buffer handle (in) */
00105        uint32_t pad;
00106        uint64_t offset;            /* mmap offset (out) */
00107        /* note: in case of tiled buffers, the user virtual size can be
00108         * different from the physical size (ie. how many pages are needed
00109         * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
00110         * This size here is the one that should be used if you want to
00111         * mmap() the buffer:
00112         */
00113        uint32_t size;                     /* virtual size for mmap'ing (out) */
00114        uint32_t __pad;
00115 };
00116 
00117 #define DRM_OMAP_GET_PARAM         0x00
00118 #define DRM_OMAP_SET_PARAM         0x01
00119 #define DRM_OMAP_GET_BASE          0x02
00120 #define DRM_OMAP_GEM_NEW           0x03
00121 #define DRM_OMAP_GEM_CPU_PREP             0x04
00122 #define DRM_OMAP_GEM_CPU_FINI             0x05
00123 #define DRM_OMAP_GEM_INFO          0x06
00124 #define DRM_OMAP_NUM_IOCTLS        0x07
00125 
00126 #define DRM_IOCTL_OMAP_GET_PARAM   DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
00127 #define DRM_IOCTL_OMAP_SET_PARAM   DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
00128 #define DRM_IOCTL_OMAP_GET_BASE           DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_BASE, struct drm_omap_get_base)
00129 #define DRM_IOCTL_OMAP_GEM_NEW            DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
00130 #define DRM_IOCTL_OMAP_GEM_CPU_PREP       DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
00131 #define DRM_IOCTL_OMAP_GEM_CPU_FINI       DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
00132 #define DRM_IOCTL_OMAP_GEM_INFO           DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
00133 
00134 #endif /* __OMAP_DRM_H__ */