162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * include/uapi/drm/omap_drm.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2011 Texas Instruments
662306a36Sopenharmony_ci * Author: Rob Clark <rob@ti.com>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
962306a36Sopenharmony_ci * under the terms of the GNU General Public License version 2 as published by
1062306a36Sopenharmony_ci * the Free Software Foundation.
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, but WITHOUT
1362306a36Sopenharmony_ci * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1462306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
1562306a36Sopenharmony_ci * more details.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License along with
1862306a36Sopenharmony_ci * this program.  If not, see <http://www.gnu.org/licenses/>.
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#ifndef __OMAP_DRM_H__
2262306a36Sopenharmony_ci#define __OMAP_DRM_H__
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#include "drm.h"
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#if defined(__cplusplus)
2762306a36Sopenharmony_ciextern "C" {
2862306a36Sopenharmony_ci#endif
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/* Please note that modifications to all structs defined here are
3162306a36Sopenharmony_ci * subject to backwards-compatibility constraints.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define OMAP_PARAM_CHIPSET_ID	1	/* ie. 0x3430, 0x4430, etc */
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cistruct drm_omap_param {
3762306a36Sopenharmony_ci	__u64 param;			/* in */
3862306a36Sopenharmony_ci	__u64 value;			/* in (set_param), out (get_param) */
3962306a36Sopenharmony_ci};
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* Scanout buffer, consumable by DSS */
4262306a36Sopenharmony_ci#define OMAP_BO_SCANOUT		0x00000001
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* Buffer CPU caching mode: cached, write-combining or uncached. */
4562306a36Sopenharmony_ci#define OMAP_BO_CACHED		0x00000000
4662306a36Sopenharmony_ci#define OMAP_BO_WC		0x00000002
4762306a36Sopenharmony_ci#define OMAP_BO_UNCACHED	0x00000004
4862306a36Sopenharmony_ci#define OMAP_BO_CACHE_MASK	0x00000006
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* Use TILER for the buffer. The TILER container unit can be 8, 16 or 32 bits. */
5162306a36Sopenharmony_ci#define OMAP_BO_TILED_8		0x00000100
5262306a36Sopenharmony_ci#define OMAP_BO_TILED_16	0x00000200
5362306a36Sopenharmony_ci#define OMAP_BO_TILED_32	0x00000300
5462306a36Sopenharmony_ci#define OMAP_BO_TILED_MASK	0x00000f00
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ciunion omap_gem_size {
5762306a36Sopenharmony_ci	__u32 bytes;		/* (for non-tiled formats) */
5862306a36Sopenharmony_ci	struct {
5962306a36Sopenharmony_ci		__u16 width;
6062306a36Sopenharmony_ci		__u16 height;
6162306a36Sopenharmony_ci	} tiled;		/* (for tiled formats) */
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_cistruct drm_omap_gem_new {
6562306a36Sopenharmony_ci	union omap_gem_size size;	/* in */
6662306a36Sopenharmony_ci	__u32 flags;			/* in */
6762306a36Sopenharmony_ci	__u32 handle;			/* out */
6862306a36Sopenharmony_ci	__u32 __pad;
6962306a36Sopenharmony_ci};
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* mask of operations: */
7262306a36Sopenharmony_cienum omap_gem_op {
7362306a36Sopenharmony_ci	OMAP_GEM_READ = 0x01,
7462306a36Sopenharmony_ci	OMAP_GEM_WRITE = 0x02,
7562306a36Sopenharmony_ci};
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_cistruct drm_omap_gem_cpu_prep {
7862306a36Sopenharmony_ci	__u32 handle;			/* buffer handle (in) */
7962306a36Sopenharmony_ci	__u32 op;			/* mask of omap_gem_op (in) */
8062306a36Sopenharmony_ci};
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_cistruct drm_omap_gem_cpu_fini {
8362306a36Sopenharmony_ci	__u32 handle;			/* buffer handle (in) */
8462306a36Sopenharmony_ci	__u32 op;			/* mask of omap_gem_op (in) */
8562306a36Sopenharmony_ci	/* TODO maybe here we pass down info about what regions are touched
8662306a36Sopenharmony_ci	 * by sw so we can be clever about cache ops?  For now a placeholder,
8762306a36Sopenharmony_ci	 * set to zero and we just do full buffer flush..
8862306a36Sopenharmony_ci	 */
8962306a36Sopenharmony_ci	__u32 nregions;
9062306a36Sopenharmony_ci	__u32 __pad;
9162306a36Sopenharmony_ci};
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_cistruct drm_omap_gem_info {
9462306a36Sopenharmony_ci	__u32 handle;			/* buffer handle (in) */
9562306a36Sopenharmony_ci	__u32 pad;
9662306a36Sopenharmony_ci	__u64 offset;			/* mmap offset (out) */
9762306a36Sopenharmony_ci	/* note: in case of tiled buffers, the user virtual size can be
9862306a36Sopenharmony_ci	 * different from the physical size (ie. how many pages are needed
9962306a36Sopenharmony_ci	 * to back the object) which is returned in DRM_IOCTL_GEM_OPEN..
10062306a36Sopenharmony_ci	 * This size here is the one that should be used if you want to
10162306a36Sopenharmony_ci	 * mmap() the buffer:
10262306a36Sopenharmony_ci	 */
10362306a36Sopenharmony_ci	__u32 size;			/* virtual size for mmap'ing (out) */
10462306a36Sopenharmony_ci	__u32 __pad;
10562306a36Sopenharmony_ci};
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci#define DRM_OMAP_GET_PARAM		0x00
10862306a36Sopenharmony_ci#define DRM_OMAP_SET_PARAM		0x01
10962306a36Sopenharmony_ci#define DRM_OMAP_GEM_NEW		0x03
11062306a36Sopenharmony_ci#define DRM_OMAP_GEM_CPU_PREP		0x04	/* Deprecated, to be removed */
11162306a36Sopenharmony_ci#define DRM_OMAP_GEM_CPU_FINI		0x05	/* Deprecated, to be removed */
11262306a36Sopenharmony_ci#define DRM_OMAP_GEM_INFO		0x06
11362306a36Sopenharmony_ci#define DRM_OMAP_NUM_IOCTLS		0x07
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define DRM_IOCTL_OMAP_GET_PARAM	DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
11662306a36Sopenharmony_ci#define DRM_IOCTL_OMAP_SET_PARAM	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
11762306a36Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_NEW		DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
11862306a36Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_CPU_PREP	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
11962306a36Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_CPU_FINI	DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
12062306a36Sopenharmony_ci#define DRM_IOCTL_OMAP_GEM_INFO		DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info)
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci#if defined(__cplusplus)
12362306a36Sopenharmony_ci}
12462306a36Sopenharmony_ci#endif
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci#endif /* __OMAP_DRM_H__ */
127