1d722e3fbSopenharmony_ci/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ 2d722e3fbSopenharmony_ci 3d722e3fbSopenharmony_ci/* 4d722e3fbSopenharmony_ci * Copyright (C) 2011 Texas Instruments, Inc 5d722e3fbSopenharmony_ci * 6d722e3fbSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7d722e3fbSopenharmony_ci * copy of this software and associated documentation files (the "Software"), 8d722e3fbSopenharmony_ci * to deal in the Software without restriction, including without limitation 9d722e3fbSopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10d722e3fbSopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 11d722e3fbSopenharmony_ci * Software is furnished to do so, subject to the following conditions: 12d722e3fbSopenharmony_ci * 13d722e3fbSopenharmony_ci * The above copyright notice and this permission notice (including the next 14d722e3fbSopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 15d722e3fbSopenharmony_ci * Software. 16d722e3fbSopenharmony_ci * 17d722e3fbSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18d722e3fbSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19d722e3fbSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20d722e3fbSopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21d722e3fbSopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22d722e3fbSopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23d722e3fbSopenharmony_ci * SOFTWARE. 24d722e3fbSopenharmony_ci * 25d722e3fbSopenharmony_ci * Authors: 26d722e3fbSopenharmony_ci * Rob Clark <rob@ti.com> 27d722e3fbSopenharmony_ci */ 28d722e3fbSopenharmony_ci 29d722e3fbSopenharmony_ci#ifndef __OMAP_DRM_H__ 30d722e3fbSopenharmony_ci#define __OMAP_DRM_H__ 31d722e3fbSopenharmony_ci 32d722e3fbSopenharmony_ci#include <stdint.h> 33d722e3fbSopenharmony_ci#include <drm.h> 34d722e3fbSopenharmony_ci 35d722e3fbSopenharmony_ci/* Please note that modifications to all structs defined here are 36d722e3fbSopenharmony_ci * subject to backwards-compatibility constraints. 37d722e3fbSopenharmony_ci */ 38d722e3fbSopenharmony_ci 39d722e3fbSopenharmony_ci#define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */ 40d722e3fbSopenharmony_ci 41d722e3fbSopenharmony_cistruct drm_omap_param { 42d722e3fbSopenharmony_ci uint64_t param; /* in */ 43d722e3fbSopenharmony_ci uint64_t value; /* in (set_param), out (get_param) */ 44d722e3fbSopenharmony_ci}; 45d722e3fbSopenharmony_ci 46d722e3fbSopenharmony_cistruct drm_omap_get_base { 47d722e3fbSopenharmony_ci char plugin_name[64]; /* in */ 48d722e3fbSopenharmony_ci uint32_t ioctl_base; /* out */ 49d722e3fbSopenharmony_ci uint32_t __pad; 50d722e3fbSopenharmony_ci}; 51d722e3fbSopenharmony_ci 52d722e3fbSopenharmony_ci#define OMAP_BO_SCANOUT 0x00000001 /* scanout capable (phys contiguous) */ 53d722e3fbSopenharmony_ci#define OMAP_BO_CACHE_MASK 0x00000006 /* cache type mask, see cache modes */ 54d722e3fbSopenharmony_ci#define OMAP_BO_TILED_MASK 0x00000f00 /* tiled mapping mask, see tiled modes */ 55d722e3fbSopenharmony_ci 56d722e3fbSopenharmony_ci/* cache modes */ 57d722e3fbSopenharmony_ci#define OMAP_BO_CACHED 0x00000000 /* default */ 58d722e3fbSopenharmony_ci#define OMAP_BO_WC 0x00000002 /* write-combine */ 59d722e3fbSopenharmony_ci#define OMAP_BO_UNCACHED 0x00000004 /* strongly-ordered (uncached) */ 60d722e3fbSopenharmony_ci 61d722e3fbSopenharmony_ci/* tiled modes */ 62d722e3fbSopenharmony_ci#define OMAP_BO_TILED_8 0x00000100 63d722e3fbSopenharmony_ci#define OMAP_BO_TILED_16 0x00000200 64d722e3fbSopenharmony_ci#define OMAP_BO_TILED_32 0x00000300 65d722e3fbSopenharmony_ci#define OMAP_BO_TILED (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32) 66d722e3fbSopenharmony_ci 67d722e3fbSopenharmony_ciunion omap_gem_size { 68d722e3fbSopenharmony_ci uint32_t bytes; /* (for non-tiled formats) */ 69d722e3fbSopenharmony_ci struct { 70d722e3fbSopenharmony_ci uint16_t width; 71d722e3fbSopenharmony_ci uint16_t height; 72d722e3fbSopenharmony_ci } tiled; /* (for tiled formats) */ 73d722e3fbSopenharmony_ci}; 74d722e3fbSopenharmony_ci 75d722e3fbSopenharmony_cistruct drm_omap_gem_new { 76d722e3fbSopenharmony_ci union omap_gem_size size; /* in */ 77d722e3fbSopenharmony_ci uint32_t flags; /* in */ 78d722e3fbSopenharmony_ci uint32_t handle; /* out */ 79d722e3fbSopenharmony_ci uint32_t __pad; 80d722e3fbSopenharmony_ci}; 81d722e3fbSopenharmony_ci 82d722e3fbSopenharmony_ci/* mask of operations: */ 83d722e3fbSopenharmony_cienum omap_gem_op { 84d722e3fbSopenharmony_ci OMAP_GEM_READ = 0x01, 85d722e3fbSopenharmony_ci OMAP_GEM_WRITE = 0x02, 86d722e3fbSopenharmony_ci}; 87d722e3fbSopenharmony_ci 88d722e3fbSopenharmony_cistruct drm_omap_gem_cpu_prep { 89d722e3fbSopenharmony_ci uint32_t handle; /* buffer handle (in) */ 90d722e3fbSopenharmony_ci uint32_t op; /* mask of omap_gem_op (in) */ 91d722e3fbSopenharmony_ci}; 92d722e3fbSopenharmony_ci 93d722e3fbSopenharmony_cistruct drm_omap_gem_cpu_fini { 94d722e3fbSopenharmony_ci uint32_t handle; /* buffer handle (in) */ 95d722e3fbSopenharmony_ci uint32_t op; /* mask of omap_gem_op (in) */ 96d722e3fbSopenharmony_ci /* TODO maybe here we pass down info about what regions are touched 97d722e3fbSopenharmony_ci * by sw so we can be clever about cache ops? For now a placeholder, 98d722e3fbSopenharmony_ci * set to zero and we just do full buffer flush.. 99d722e3fbSopenharmony_ci */ 100d722e3fbSopenharmony_ci uint32_t nregions; 101d722e3fbSopenharmony_ci uint32_t __pad; 102d722e3fbSopenharmony_ci}; 103d722e3fbSopenharmony_ci 104d722e3fbSopenharmony_cistruct drm_omap_gem_info { 105d722e3fbSopenharmony_ci uint32_t handle; /* buffer handle (in) */ 106d722e3fbSopenharmony_ci uint32_t pad; 107d722e3fbSopenharmony_ci uint64_t offset; /* mmap offset (out) */ 108d722e3fbSopenharmony_ci /* note: in case of tiled buffers, the user virtual size can be 109d722e3fbSopenharmony_ci * different from the physical size (ie. how many pages are needed 110d722e3fbSopenharmony_ci * to back the object) which is returned in DRM_IOCTL_GEM_OPEN.. 111d722e3fbSopenharmony_ci * This size here is the one that should be used if you want to 112d722e3fbSopenharmony_ci * mmap() the buffer: 113d722e3fbSopenharmony_ci */ 114d722e3fbSopenharmony_ci uint32_t size; /* virtual size for mmap'ing (out) */ 115d722e3fbSopenharmony_ci uint32_t __pad; 116d722e3fbSopenharmony_ci}; 117d722e3fbSopenharmony_ci 118d722e3fbSopenharmony_ci#define DRM_OMAP_GET_PARAM 0x00 119d722e3fbSopenharmony_ci#define DRM_OMAP_SET_PARAM 0x01 120d722e3fbSopenharmony_ci#define DRM_OMAP_GET_BASE 0x02 121d722e3fbSopenharmony_ci#define DRM_OMAP_GEM_NEW 0x03 122d722e3fbSopenharmony_ci#define DRM_OMAP_GEM_CPU_PREP 0x04 123d722e3fbSopenharmony_ci#define DRM_OMAP_GEM_CPU_FINI 0x05 124d722e3fbSopenharmony_ci#define DRM_OMAP_GEM_INFO 0x06 125d722e3fbSopenharmony_ci#define DRM_OMAP_NUM_IOCTLS 0x07 126d722e3fbSopenharmony_ci 127d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param) 128d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param) 129d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_GET_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_BASE, struct drm_omap_get_base) 130d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new) 131d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep) 132d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini) 133d722e3fbSopenharmony_ci#define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info) 134d722e3fbSopenharmony_ci 135d722e3fbSopenharmony_ci#endif /* __OMAP_DRM_H__ */ 136