18bb0daffSRob Clark /* 28bb0daffSRob Clark * include/uapi/drm/omap_drm.h 38bb0daffSRob Clark * 48bb0daffSRob Clark * Copyright (C) 2011 Texas Instruments 58bb0daffSRob Clark * Author: Rob Clark <rob@ti.com> 68bb0daffSRob Clark * 78bb0daffSRob Clark * This program is free software; you can redistribute it and/or modify it 88bb0daffSRob Clark * under the terms of the GNU General Public License version 2 as published by 98bb0daffSRob Clark * the Free Software Foundation. 108bb0daffSRob Clark * 118bb0daffSRob Clark * This program is distributed in the hope that it will be useful, but WITHOUT 128bb0daffSRob Clark * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 138bb0daffSRob Clark * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 148bb0daffSRob Clark * more details. 158bb0daffSRob Clark * 168bb0daffSRob Clark * You should have received a copy of the GNU General Public License along with 178bb0daffSRob Clark * this program. If not, see <http://www.gnu.org/licenses/>. 188bb0daffSRob Clark */ 198bb0daffSRob Clark 208bb0daffSRob Clark #ifndef __OMAP_DRM_H__ 218bb0daffSRob Clark #define __OMAP_DRM_H__ 228bb0daffSRob Clark 237ef500e4SGabriel Laskar #include "drm.h" 248bb0daffSRob Clark 25c92378a0SEmil Velikov #if defined(__cplusplus) 26c92378a0SEmil Velikov extern "C" { 27c92378a0SEmil Velikov #endif 28c92378a0SEmil Velikov 298bb0daffSRob Clark /* Please note that modifications to all structs defined here are 308bb0daffSRob Clark * subject to backwards-compatibility constraints. 318bb0daffSRob Clark */ 328bb0daffSRob Clark 338bb0daffSRob Clark #define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */ 348bb0daffSRob Clark 358bb0daffSRob Clark struct drm_omap_param { 36337ba7fbSDmitry V. Levin __u64 param; /* in */ 37337ba7fbSDmitry V. Levin __u64 value; /* in (set_param), out (get_param) */ 388bb0daffSRob Clark }; 398bb0daffSRob Clark 408bb0daffSRob Clark #define OMAP_BO_SCANOUT 0x00000001 /* scanout capable (phys contiguous) */ 418bb0daffSRob Clark #define OMAP_BO_CACHE_MASK 0x00000006 /* cache type mask, see cache modes */ 428bb0daffSRob Clark #define OMAP_BO_TILED_MASK 0x00000f00 /* tiled mapping mask, see tiled modes */ 438bb0daffSRob Clark 448bb0daffSRob Clark /* cache modes */ 458bb0daffSRob Clark #define OMAP_BO_CACHED 0x00000000 /* default */ 468bb0daffSRob Clark #define OMAP_BO_WC 0x00000002 /* write-combine */ 478bb0daffSRob Clark #define OMAP_BO_UNCACHED 0x00000004 /* strongly-ordered (uncached) */ 488bb0daffSRob Clark 498bb0daffSRob Clark /* tiled modes */ 508bb0daffSRob Clark #define OMAP_BO_TILED_8 0x00000100 518bb0daffSRob Clark #define OMAP_BO_TILED_16 0x00000200 528bb0daffSRob Clark #define OMAP_BO_TILED_32 0x00000300 538bb0daffSRob Clark #define OMAP_BO_TILED (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32) 548bb0daffSRob Clark 558bb0daffSRob Clark union omap_gem_size { 56337ba7fbSDmitry V. Levin __u32 bytes; /* (for non-tiled formats) */ 578bb0daffSRob Clark struct { 58337ba7fbSDmitry V. Levin __u16 width; 59337ba7fbSDmitry V. Levin __u16 height; 608bb0daffSRob Clark } tiled; /* (for tiled formats) */ 618bb0daffSRob Clark }; 628bb0daffSRob Clark 638bb0daffSRob Clark struct drm_omap_gem_new { 648bb0daffSRob Clark union omap_gem_size size; /* in */ 65337ba7fbSDmitry V. Levin __u32 flags; /* in */ 66337ba7fbSDmitry V. Levin __u32 handle; /* out */ 67337ba7fbSDmitry V. Levin __u32 __pad; 688bb0daffSRob Clark }; 698bb0daffSRob Clark 708bb0daffSRob Clark /* mask of operations: */ 718bb0daffSRob Clark enum omap_gem_op { 728bb0daffSRob Clark OMAP_GEM_READ = 0x01, 738bb0daffSRob Clark OMAP_GEM_WRITE = 0x02, 748bb0daffSRob Clark }; 758bb0daffSRob Clark 768bb0daffSRob Clark struct drm_omap_gem_cpu_prep { 77337ba7fbSDmitry V. Levin __u32 handle; /* buffer handle (in) */ 78337ba7fbSDmitry V. Levin __u32 op; /* mask of omap_gem_op (in) */ 798bb0daffSRob Clark }; 808bb0daffSRob Clark 818bb0daffSRob Clark struct drm_omap_gem_cpu_fini { 82337ba7fbSDmitry V. Levin __u32 handle; /* buffer handle (in) */ 83337ba7fbSDmitry V. Levin __u32 op; /* mask of omap_gem_op (in) */ 848bb0daffSRob Clark /* TODO maybe here we pass down info about what regions are touched 858bb0daffSRob Clark * by sw so we can be clever about cache ops? For now a placeholder, 868bb0daffSRob Clark * set to zero and we just do full buffer flush.. 878bb0daffSRob Clark */ 88337ba7fbSDmitry V. Levin __u32 nregions; 89337ba7fbSDmitry V. Levin __u32 __pad; 908bb0daffSRob Clark }; 918bb0daffSRob Clark 928bb0daffSRob Clark struct drm_omap_gem_info { 93337ba7fbSDmitry V. Levin __u32 handle; /* buffer handle (in) */ 94337ba7fbSDmitry V. Levin __u32 pad; 95337ba7fbSDmitry V. Levin __u64 offset; /* mmap offset (out) */ 968bb0daffSRob Clark /* note: in case of tiled buffers, the user virtual size can be 978bb0daffSRob Clark * different from the physical size (ie. how many pages are needed 988bb0daffSRob Clark * to back the object) which is returned in DRM_IOCTL_GEM_OPEN.. 998bb0daffSRob Clark * This size here is the one that should be used if you want to 1008bb0daffSRob Clark * mmap() the buffer: 1018bb0daffSRob Clark */ 102337ba7fbSDmitry V. Levin __u32 size; /* virtual size for mmap'ing (out) */ 103337ba7fbSDmitry V. Levin __u32 __pad; 1048bb0daffSRob Clark }; 1058bb0daffSRob Clark 1068bb0daffSRob Clark #define DRM_OMAP_GET_PARAM 0x00 1078bb0daffSRob Clark #define DRM_OMAP_SET_PARAM 0x01 1088bb0daffSRob Clark #define DRM_OMAP_GEM_NEW 0x03 109*d6f544f6SLaurent Pinchart #define DRM_OMAP_GEM_CPU_PREP 0x04 /* Deprecated, to be removed */ 110*d6f544f6SLaurent Pinchart #define DRM_OMAP_GEM_CPU_FINI 0x05 /* Deprecated, to be removed */ 1118bb0daffSRob Clark #define DRM_OMAP_GEM_INFO 0x06 1128bb0daffSRob Clark #define DRM_OMAP_NUM_IOCTLS 0x07 1138bb0daffSRob Clark 1148bb0daffSRob Clark #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param) 1158bb0daffSRob Clark #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param) 1168bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new) 1178bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep) 1188bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini) 1198bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info) 1208bb0daffSRob Clark 121c92378a0SEmil Velikov #if defined(__cplusplus) 122c92378a0SEmil Velikov } 123c92378a0SEmil Velikov #endif 124c92378a0SEmil Velikov 1258bb0daffSRob Clark #endif /* __OMAP_DRM_H__ */ 126