18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * include/uapi/drm/omap_drm.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Texas Instruments
68c2ecf20Sopenharmony_ci * Author: Rob Clark <rob@ti.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
98c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License version 2 as published by
108c2ecf20Sopenharmony_ci * the Free Software Foundation.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but WITHOUT
138c2ecf20Sopenharmony_ci * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
148c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
158c2ecf20Sopenharmony_ci * more details.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along with
188c2ecf20Sopenharmony_ci * this program.  If not, see <http://www.gnu.org/licenses/>.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#ifndef __OMAP_DRM_H__
228c2ecf20Sopenharmony_ci#define __OMAP_DRM_H__
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include "drm.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#if defined(__cplusplus)
278c2ecf20Sopenharmony_ciextern "C" {
288c2ecf20Sopenharmony_ci#endif
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* Please note that modifications to all structs defined here are
318c2ecf20Sopenharmony_ci * subject to backwards-compatibility constraints.
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define OMAP_PARAM_CHIPSET_ID	1	/* ie. 0x3430, 0x4430, etc */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistruct drm_omap_param {
378c2ecf20Sopenharmony_ci	__u64 param;			/* in */
388c2ecf20Sopenharmony_ci	__u64 value;			/* in (set_param), out (get_param) */
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Scanout buffer, consumable by DSS */
428c2ecf20Sopenharmony_ci#define OMAP_BO_SCANOUT		0x00000001
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Buffer CPU caching mode: cached, write-combining or uncached. */
458c2ecf20Sopenharmony_ci#define OMAP_BO_CACHED		0x00000000
468c2ecf20Sopenharmony_ci#define OMAP_BO_WC		0x00000002
478c2ecf20Sopenharmony_ci#define OMAP_BO_UNCACHED	0x00000004
488c2ecf20Sopenharmony_ci#define OMAP_BO_CACHE_MASK	0x00000006
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* Use TILER for the buffer. The TILER container unit can be 8, 16 or 32 bits. */
518c2ecf20Sopenharmony_ci#define OMAP_BO_TILED_8		0x00000100
528c2ecf20Sopenharmony_ci#define OMAP_BO_TILED_16	0x00000200
538c2ecf20Sopenharmony_ci#define OMAP_BO_TILED_32	0x00000300
548c2ecf20Sopenharmony_ci#define OMAP_BO_TILED_MASK	0x00000f00
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciunion omap_gem_size {
578c2ecf20Sopenharmony_ci	__u32 bytes;		/* (for non-tiled formats) */
588c2ecf20Sopenharmony_ci	struct {
598c2ecf20Sopenharmony_ci		__u16 width;
608c2ecf20Sopenharmony_ci		__u16 height;
618c2ecf20Sopenharmony_ci	} tiled;		/* (for tiled formats) */
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct drm_omap_gem_new {
658c2ecf20Sopenharmony_ci	union omap_gem_size size;	/* in */
668c2ecf20Sopenharmony_ci	__u32 flags;			/* in */
678c2ecf20Sopenharmony_ci	__u32 handle;			/* out */
688c2ecf20Sopenharmony_ci	__u32 __pad;
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* mask of operations: */
728c2ecf20Sopenharmony_cienum omap_gem_op {
738c2ecf20Sopenharmony_ci	OMAP_GEM_READ = 0x01,
748c2ecf20Sopenharmony_ci	OMAP_GEM_WRITE = 0x02,
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_cistruct drm_omap_gem_cpu_prep {
788c2ecf20Sopenharmony_ci	__u32 handle;			/* buffer handle (in) */
798c2ecf20Sopenharmony_ci	__u32 op;			/* mask of omap_gem_op (in) */
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistruct drm_omap_gem_cpu_fini {
838c2ecf20Sopenharmony_ci	__u32 handle;			/* buffer handle (in) */
848c2ecf20Sopenharmony_ci	__u32 op;			/* mask of omap_gem_op (in) */
858c2ecf20Sopenharmony_ci	/* TODO maybe here we pass down info about what regions are touched
868c2ecf20Sopenharmony_ci	 * by sw so we can be clever about cache ops?  For now a placeholder,
878c2ecf20Sopenharmony_ci	 * set to zero and we just do full buffer flush..
888c2ecf20Sopenharmony_ci	 */
898c2ecf20Sopenharmony_ci	__u32 nregions;
908c2ecf20Sopenharmony_ci	__u32 __pad;
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cistruct drm_omap_gem_info {
948c2ecf20Sopenharmony_ci	__u32 handle;			/* buffer handle (in) */
958c2ecf20Sopenharmony_ci	__u32 pad;
968c2ecf20Sopenharmony_ci	__u64 offset;			/* mmap offset (out) */
978c2ecf20Sopenharmony_ci	/* note: in case of tiled buffers, the user virtual size can be
988c2ecf20Sopenharmony_ci	 * different from the physical size (ie. how many pages are needed
998c2ecf20Sopenharmony_ci	 * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
1008c2ecf20Sopenharmony_ci	 * This size here is the one that should be used if you want to
1018c2ecf20Sopenharmony_ci	 * mmap() the buffer:
1028c2ecf20Sopenharmony_ci	 */
1038c2ecf20Sopenharmony_ci	__u32 size;			/* virtual size for mmap'ing (out) */
1048c2ecf20Sopenharmony_ci	__u32 __pad;
1058c2ecf20Sopenharmony_ci};
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#define DRM_OMAP_GET_PARAM		0x00
1088c2ecf20Sopenharmony_ci#define DRM_OMAP_SET_PARAM		0x01
1098c2ecf20Sopenharmony_ci#define DRM_OMAP_GEM_NEW		0x03
1108c2ecf20Sopenharmony_ci#define DRM_OMAP_GEM_CPU_PREP		0x04	/* Deprecated, to be removed */
1118c2ecf20Sopenharmony_ci#define DRM_OMAP_GEM_CPU_FINI		0x05	/* Deprecated, to be removed */
1128c2ecf20Sopenharmony_ci#define DRM_OMAP_GEM_INFO		0x06
1138c2ecf20Sopenharmony_ci#define DRM_OMAP_NUM_IOCTLS		0x07
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define DRM_IOCTL_OMAP_GET_PARAM	DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
1168c2ecf20Sopenharmony_ci#define DRM_IOCTL_OMAP_SET_PARAM	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
1178c2ecf20Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_NEW		DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
1188c2ecf20Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_CPU_PREP	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
1198c2ecf20Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_CPU_FINI	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
1208c2ecf20Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_INFO		DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#if defined(__cplusplus)
1238c2ecf20Sopenharmony_ci}
1248c2ecf20Sopenharmony_ci#endif
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#endif /* __OMAP_DRM_H__ */
127