xref: /linux/include/uapi/drm/omap_drm.h (revision c95baf12f5077419db01313ab61c2aac007d40cd)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28bb0daffSRob Clark /*
38bb0daffSRob Clark  * include/uapi/drm/omap_drm.h
48bb0daffSRob Clark  *
58bb0daffSRob Clark  * Copyright (C) 2011 Texas Instruments
68bb0daffSRob Clark  * Author: Rob Clark <rob@ti.com>
78bb0daffSRob Clark  *
88bb0daffSRob Clark  * This program is free software; you can redistribute it and/or modify it
98bb0daffSRob Clark  * under the terms of the GNU General Public License version 2 as published by
108bb0daffSRob Clark  * the Free Software Foundation.
118bb0daffSRob Clark  *
128bb0daffSRob Clark  * This program is distributed in the hope that it will be useful, but WITHOUT
138bb0daffSRob Clark  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
148bb0daffSRob Clark  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
158bb0daffSRob Clark  * more details.
168bb0daffSRob Clark  *
178bb0daffSRob Clark  * You should have received a copy of the GNU General Public License along with
188bb0daffSRob Clark  * this program.  If not, see <http://www.gnu.org/licenses/>.
198bb0daffSRob Clark  */
208bb0daffSRob Clark 
218bb0daffSRob Clark #ifndef __OMAP_DRM_H__
228bb0daffSRob Clark #define __OMAP_DRM_H__
238bb0daffSRob Clark 
247ef500e4SGabriel Laskar #include "drm.h"
258bb0daffSRob Clark 
26c92378a0SEmil Velikov #if defined(__cplusplus)
27c92378a0SEmil Velikov extern "C" {
28c92378a0SEmil Velikov #endif
29c92378a0SEmil Velikov 
308bb0daffSRob Clark /* Please note that modifications to all structs defined here are
318bb0daffSRob Clark  * subject to backwards-compatibility constraints.
328bb0daffSRob Clark  */
338bb0daffSRob Clark 
348bb0daffSRob Clark #define OMAP_PARAM_CHIPSET_ID	1	/* ie. 0x3430, 0x4430, etc */
358bb0daffSRob Clark 
368bb0daffSRob Clark struct drm_omap_param {
37337ba7fbSDmitry V. Levin 	__u64 param;			/* in */
38337ba7fbSDmitry V. Levin 	__u64 value;			/* in (set_param), out (get_param) */
398bb0daffSRob Clark };
408bb0daffSRob Clark 
41*9b7117e2STomi Valkeinen /* Scanout buffer, consumable by DSS */
42*9b7117e2STomi Valkeinen #define OMAP_BO_SCANOUT		0x00000001
438bb0daffSRob Clark 
44*9b7117e2STomi Valkeinen /* Buffer CPU caching mode: cached, write-combining or uncached. */
45*9b7117e2STomi Valkeinen #define OMAP_BO_CACHED		0x00000000
46*9b7117e2STomi Valkeinen #define OMAP_BO_WC		0x00000002
47*9b7117e2STomi Valkeinen #define OMAP_BO_UNCACHED	0x00000004
48*9b7117e2STomi Valkeinen #define OMAP_BO_CACHE_MASK	0x00000006
498bb0daffSRob Clark 
50*9b7117e2STomi Valkeinen /* Use TILER for the buffer. The TILER container unit can be 8, 16 or 32 bits. */
518bb0daffSRob Clark #define OMAP_BO_TILED_8		0x00000100
528bb0daffSRob Clark #define OMAP_BO_TILED_16	0x00000200
538bb0daffSRob Clark #define OMAP_BO_TILED_32	0x00000300
54*9b7117e2STomi Valkeinen #define OMAP_BO_TILED_MASK	0x00000f00
558bb0daffSRob Clark 
568bb0daffSRob Clark union omap_gem_size {
57337ba7fbSDmitry V. Levin 	__u32 bytes;		/* (for non-tiled formats) */
588bb0daffSRob Clark 	struct {
59337ba7fbSDmitry V. Levin 		__u16 width;
60337ba7fbSDmitry V. Levin 		__u16 height;
618bb0daffSRob Clark 	} tiled;		/* (for tiled formats) */
628bb0daffSRob Clark };
638bb0daffSRob Clark 
648bb0daffSRob Clark struct drm_omap_gem_new {
658bb0daffSRob Clark 	union omap_gem_size size;	/* in */
66337ba7fbSDmitry V. Levin 	__u32 flags;			/* in */
67337ba7fbSDmitry V. Levin 	__u32 handle;			/* out */
68337ba7fbSDmitry V. Levin 	__u32 __pad;
698bb0daffSRob Clark };
708bb0daffSRob Clark 
718bb0daffSRob Clark /* mask of operations: */
728bb0daffSRob Clark enum omap_gem_op {
738bb0daffSRob Clark 	OMAP_GEM_READ = 0x01,
748bb0daffSRob Clark 	OMAP_GEM_WRITE = 0x02,
758bb0daffSRob Clark };
768bb0daffSRob Clark 
778bb0daffSRob Clark struct drm_omap_gem_cpu_prep {
78337ba7fbSDmitry V. Levin 	__u32 handle;			/* buffer handle (in) */
79337ba7fbSDmitry V. Levin 	__u32 op;			/* mask of omap_gem_op (in) */
808bb0daffSRob Clark };
818bb0daffSRob Clark 
828bb0daffSRob Clark struct drm_omap_gem_cpu_fini {
83337ba7fbSDmitry V. Levin 	__u32 handle;			/* buffer handle (in) */
84337ba7fbSDmitry V. Levin 	__u32 op;			/* mask of omap_gem_op (in) */
858bb0daffSRob Clark 	/* TODO maybe here we pass down info about what regions are touched
868bb0daffSRob Clark 	 * by sw so we can be clever about cache ops?  For now a placeholder,
878bb0daffSRob Clark 	 * set to zero and we just do full buffer flush..
888bb0daffSRob Clark 	 */
89337ba7fbSDmitry V. Levin 	__u32 nregions;
90337ba7fbSDmitry V. Levin 	__u32 __pad;
918bb0daffSRob Clark };
928bb0daffSRob Clark 
938bb0daffSRob Clark struct drm_omap_gem_info {
94337ba7fbSDmitry V. Levin 	__u32 handle;			/* buffer handle (in) */
95337ba7fbSDmitry V. Levin 	__u32 pad;
96337ba7fbSDmitry V. Levin 	__u64 offset;			/* mmap offset (out) */
978bb0daffSRob Clark 	/* note: in case of tiled buffers, the user virtual size can be
988bb0daffSRob Clark 	 * different from the physical size (ie. how many pages are needed
998bb0daffSRob Clark 	 * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
1008bb0daffSRob Clark 	 * This size here is the one that should be used if you want to
1018bb0daffSRob Clark 	 * mmap() the buffer:
1028bb0daffSRob Clark 	 */
103337ba7fbSDmitry V. Levin 	__u32 size;			/* virtual size for mmap'ing (out) */
104337ba7fbSDmitry V. Levin 	__u32 __pad;
1058bb0daffSRob Clark };
1068bb0daffSRob Clark 
1078bb0daffSRob Clark #define DRM_OMAP_GET_PARAM		0x00
1088bb0daffSRob Clark #define DRM_OMAP_SET_PARAM		0x01
1098bb0daffSRob Clark #define DRM_OMAP_GEM_NEW		0x03
110d6f544f6SLaurent Pinchart #define DRM_OMAP_GEM_CPU_PREP		0x04	/* Deprecated, to be removed */
111d6f544f6SLaurent Pinchart #define DRM_OMAP_GEM_CPU_FINI		0x05	/* Deprecated, to be removed */
1128bb0daffSRob Clark #define DRM_OMAP_GEM_INFO		0x06
1138bb0daffSRob Clark #define DRM_OMAP_NUM_IOCTLS		0x07
1148bb0daffSRob Clark 
1158bb0daffSRob Clark #define DRM_IOCTL_OMAP_GET_PARAM	DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
1168bb0daffSRob Clark #define DRM_IOCTL_OMAP_SET_PARAM	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
1178bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_NEW		DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
1188bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_CPU_PREP	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
1198bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_CPU_FINI	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
1208bb0daffSRob Clark #define DRM_IOCTL_OMAP_GEM_INFO		DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
1218bb0daffSRob Clark 
122c92378a0SEmil Velikov #if defined(__cplusplus)
123c92378a0SEmil Velikov }
124c92378a0SEmil Velikov #endif
125c92378a0SEmil Velikov 
1268bb0daffSRob Clark #endif /* __OMAP_DRM_H__ */
127