13d0407baSopenharmony_ci/* 23d0407baSopenharmony_ci * 33d0407baSopenharmony_ci * Copyright (c) Fuzhou Rockchip Electronics Co.Ltd 43d0407baSopenharmony_ci * Authors: 53d0407baSopenharmony_ci * Mark Yao <yzq@rock-chips.com> 63d0407baSopenharmony_ci * 73d0407baSopenharmony_ci * base on exynos_drm.h 83d0407baSopenharmony_ci * 93d0407baSopenharmony_ci * This program is free software; you can redistribute it and/or modify it 103d0407baSopenharmony_ci * under the terms of the GNU General Public License as published by the 113d0407baSopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 123d0407baSopenharmony_ci * option) any later version. 133d0407baSopenharmony_ci */ 143d0407baSopenharmony_ci 153d0407baSopenharmony_ci#ifndef _UAPI_ROCKCHIP_DRM_H 163d0407baSopenharmony_ci#define _UAPI_ROCKCHIP_DRM_H 173d0407baSopenharmony_ci 183d0407baSopenharmony_ci#include <drm/drm.h> 193d0407baSopenharmony_ci#include <drm/drm_file.h> 203d0407baSopenharmony_ci 213d0407baSopenharmony_ci/* 223d0407baSopenharmony_ci * Send vcnt event instead of blocking, 233d0407baSopenharmony_ci * like _DRM_VBLANK_EVENT 243d0407baSopenharmony_ci */ 253d0407baSopenharmony_ci#define _DRM_ROCKCHIP_VCNT_EVENT 0x80000000 263d0407baSopenharmony_ci#define DRM_EVENT_ROCKCHIP_CRTC_VCNT 0xf 273d0407baSopenharmony_ci 283d0407baSopenharmony_ci/* memory type definitions. */ 293d0407baSopenharmony_cienum drm_rockchip_gem_mem_type { 303d0407baSopenharmony_ci /* Physically Continuous memory. */ 313d0407baSopenharmony_ci ROCKCHIP_BO_CONTIG = 1 << 0, 323d0407baSopenharmony_ci /* cachable mapping. */ 333d0407baSopenharmony_ci ROCKCHIP_BO_CACHABLE = 1 << 1, 343d0407baSopenharmony_ci /* write-combine mapping. */ 353d0407baSopenharmony_ci ROCKCHIP_BO_WC = 1 << 2, 363d0407baSopenharmony_ci ROCKCHIP_BO_SECURE = 1 << 3, 373d0407baSopenharmony_ci /* keep kmap for cma buffer or alloc kmap for other type memory */ 383d0407baSopenharmony_ci ROCKCHIP_BO_ALLOC_KMAP = 1 << 4, 393d0407baSopenharmony_ci ROCKCHIP_BO_MASK = ROCKCHIP_BO_CONTIG | ROCKCHIP_BO_CACHABLE | 403d0407baSopenharmony_ci ROCKCHIP_BO_WC | ROCKCHIP_BO_SECURE | ROCKCHIP_BO_ALLOC_KMAP, 413d0407baSopenharmony_ci}; 423d0407baSopenharmony_ci 433d0407baSopenharmony_ci/** 443d0407baSopenharmony_ci * User-desired buffer creation information structure. 453d0407baSopenharmony_ci * 463d0407baSopenharmony_ci * @size: user-desired memory allocation size. 473d0407baSopenharmony_ci * @flags: user request for setting memory type or cache attributes. 483d0407baSopenharmony_ci * @handle: returned a handle to created gem object. 493d0407baSopenharmony_ci * - this handle will be set by gem module of kernel side. 503d0407baSopenharmony_ci */ 513d0407baSopenharmony_cistruct drm_rockchip_gem_create { 523d0407baSopenharmony_ci uint64_t size; 533d0407baSopenharmony_ci uint32_t flags; 543d0407baSopenharmony_ci uint32_t handle; 553d0407baSopenharmony_ci}; 563d0407baSopenharmony_ci 573d0407baSopenharmony_cistruct drm_rockchip_gem_phys { 583d0407baSopenharmony_ci uint32_t handle; 593d0407baSopenharmony_ci uint32_t phy_addr; 603d0407baSopenharmony_ci}; 613d0407baSopenharmony_ci 623d0407baSopenharmony_ci/** 633d0407baSopenharmony_ci * A structure for getting buffer offset. 643d0407baSopenharmony_ci * 653d0407baSopenharmony_ci * @handle: a pointer to gem object created. 663d0407baSopenharmony_ci * @pad: just padding to be 64-bit aligned. 673d0407baSopenharmony_ci * @offset: relatived offset value of the memory region allocated. 683d0407baSopenharmony_ci * - this value should be set by user. 693d0407baSopenharmony_ci */ 703d0407baSopenharmony_cistruct drm_rockchip_gem_map_off { 713d0407baSopenharmony_ci uint32_t handle; 723d0407baSopenharmony_ci uint32_t pad; 733d0407baSopenharmony_ci uint64_t offset; 743d0407baSopenharmony_ci}; 753d0407baSopenharmony_ci 763d0407baSopenharmony_ci/* acquire type definitions. */ 773d0407baSopenharmony_cienum drm_rockchip_gem_cpu_acquire_type { 783d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_CPU_ACQUIRE_SHARED = 0x0, 793d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_CPU_ACQUIRE_EXCLUSIVE = 0x1, 803d0407baSopenharmony_ci}; 813d0407baSopenharmony_ci 823d0407baSopenharmony_cienum rockchip_crtc_feture { 833d0407baSopenharmony_ci ROCKCHIP_DRM_CRTC_FEATURE_ALPHA_SCALE, 843d0407baSopenharmony_ci ROCKCHIP_DRM_CRTC_FEATURE_HDR10, 853d0407baSopenharmony_ci ROCKCHIP_DRM_CRTC_FEATURE_NEXT_HDR, 863d0407baSopenharmony_ci}; 873d0407baSopenharmony_ci 883d0407baSopenharmony_cienum rockchip_plane_feture { 893d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_SCALE, 903d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_ALPHA, 913d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_HDR2SDR, 923d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_SDR2HDR, 933d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_AFBDC, 943d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_PDAF_POS, 953d0407baSopenharmony_ci ROCKCHIP_DRM_PLANE_FEATURE_MAX, 963d0407baSopenharmony_ci}; 973d0407baSopenharmony_ci 983d0407baSopenharmony_cienum rockchip_cabc_mode { 993d0407baSopenharmony_ci ROCKCHIP_DRM_CABC_MODE_DISABLE, 1003d0407baSopenharmony_ci ROCKCHIP_DRM_CABC_MODE_NORMAL, 1013d0407baSopenharmony_ci ROCKCHIP_DRM_CABC_MODE_LOWPOWER, 1023d0407baSopenharmony_ci ROCKCHIP_DRM_CABC_MODE_USERSPACE, 1033d0407baSopenharmony_ci}; 1043d0407baSopenharmony_ci 1053d0407baSopenharmony_cistruct drm_rockchip_vcnt_event { 1063d0407baSopenharmony_ci struct drm_pending_event base; 1073d0407baSopenharmony_ci}; 1083d0407baSopenharmony_ci 1093d0407baSopenharmony_ci#define DRM_ROCKCHIP_GEM_CREATE 0x00 1103d0407baSopenharmony_ci#define DRM_ROCKCHIP_GEM_MAP_OFFSET 0x01 1113d0407baSopenharmony_ci#define DRM_ROCKCHIP_GEM_CPU_ACQUIRE 0x02 1123d0407baSopenharmony_ci#define DRM_ROCKCHIP_GEM_CPU_RELEASE 0x03 1133d0407baSopenharmony_ci#define DRM_ROCKCHIP_GEM_GET_PHYS 0x04 1143d0407baSopenharmony_ci#define DRM_ROCKCHIP_GET_VCNT_EVENT 0x05 1153d0407baSopenharmony_ci 1163d0407baSopenharmony_ci#define DRM_IOCTL_ROCKCHIP_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 1173d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_CREATE, struct drm_rockchip_gem_create) 1183d0407baSopenharmony_ci 1193d0407baSopenharmony_ci#define DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \ 1203d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_MAP_OFFSET, struct drm_rockchip_gem_map_off) 1213d0407baSopenharmony_ci 1223d0407baSopenharmony_ci#define DRM_IOCTL_ROCKCHIP_GEM_CPU_ACQUIRE DRM_IOWR(DRM_COMMAND_BASE + \ 1233d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_CPU_ACQUIRE, struct drm_rockchip_gem_cpu_acquire) 1243d0407baSopenharmony_ci 1253d0407baSopenharmony_ci#define DRM_IOCTL_ROCKCHIP_GEM_CPU_RELEASE DRM_IOWR(DRM_COMMAND_BASE + \ 1263d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_CPU_RELEASE, struct drm_rockchip_gem_cpu_release) 1273d0407baSopenharmony_ci 1283d0407baSopenharmony_ci#define DRM_IOCTL_ROCKCHIP_GEM_GET_PHYS DRM_IOWR(DRM_COMMAND_BASE + \ 1293d0407baSopenharmony_ci DRM_ROCKCHIP_GEM_GET_PHYS, struct drm_rockchip_gem_phys) 1303d0407baSopenharmony_ci 1313d0407baSopenharmony_ci#define DRM_IOCTL_ROCKCHIP_GET_VCNT_EVENT DRM_IOWR(DRM_COMMAND_BASE + \ 1323d0407baSopenharmony_ci DRM_ROCKCHIP_GET_VCNT_EVENT, union drm_wait_vblank) 1333d0407baSopenharmony_ci 1343d0407baSopenharmony_ci#endif /* _UAPI_ROCKCHIP_DRM_H */ 135