1d722e3fbSopenharmony_ci/* 2d722e3fbSopenharmony_ci * Copyright (C) 2012 Samsung Electronics Co., Ltd. 3d722e3fbSopenharmony_ci * 4d722e3fbSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5d722e3fbSopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6d722e3fbSopenharmony_ci * to deal in the Software without restriction, including without limitation 7d722e3fbSopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8d722e3fbSopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9d722e3fbSopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10d722e3fbSopenharmony_ci * 11d722e3fbSopenharmony_ci * The above copyright notice and this permission notice (including the next 12d722e3fbSopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13d722e3fbSopenharmony_ci * Software. 14d722e3fbSopenharmony_ci * 15d722e3fbSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16d722e3fbSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17d722e3fbSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18d722e3fbSopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19d722e3fbSopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20d722e3fbSopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21d722e3fbSopenharmony_ci * SOFTWARE. 22d722e3fbSopenharmony_ci * 23d722e3fbSopenharmony_ci * Authors: 24d722e3fbSopenharmony_ci * Inki Dae <inki.dae@samsung.com> 25d722e3fbSopenharmony_ci */ 26d722e3fbSopenharmony_ci 27d722e3fbSopenharmony_ci#ifndef EXYNOS_DRMIF_H_ 28d722e3fbSopenharmony_ci#define EXYNOS_DRMIF_H_ 29d722e3fbSopenharmony_ci 30d722e3fbSopenharmony_ci#include <xf86drm.h> 31d722e3fbSopenharmony_ci#include <stdint.h> 32d722e3fbSopenharmony_ci#include "exynos_drm.h" 33d722e3fbSopenharmony_ci 34d722e3fbSopenharmony_ci#if defined(__cplusplus) 35d722e3fbSopenharmony_ciextern "C" { 36d722e3fbSopenharmony_ci#endif 37d722e3fbSopenharmony_ci 38d722e3fbSopenharmony_cistruct exynos_device { 39d722e3fbSopenharmony_ci int fd; 40d722e3fbSopenharmony_ci}; 41d722e3fbSopenharmony_ci 42d722e3fbSopenharmony_ci/* 43d722e3fbSopenharmony_ci * Exynos Buffer Object structure. 44d722e3fbSopenharmony_ci * 45d722e3fbSopenharmony_ci * @dev: exynos device object allocated. 46d722e3fbSopenharmony_ci * @handle: a gem handle to gem object created. 47d722e3fbSopenharmony_ci * @flags: indicate memory allocation and cache attribute types. 48d722e3fbSopenharmony_ci * @size: size to the buffer created. 49d722e3fbSopenharmony_ci * @vaddr: user space address to a gem buffer mmapped. 50d722e3fbSopenharmony_ci * @name: a gem global handle from flink request. 51d722e3fbSopenharmony_ci */ 52d722e3fbSopenharmony_cistruct exynos_bo { 53d722e3fbSopenharmony_ci struct exynos_device *dev; 54d722e3fbSopenharmony_ci uint32_t handle; 55d722e3fbSopenharmony_ci uint32_t flags; 56d722e3fbSopenharmony_ci size_t size; 57d722e3fbSopenharmony_ci void *vaddr; 58d722e3fbSopenharmony_ci uint32_t name; 59d722e3fbSopenharmony_ci}; 60d722e3fbSopenharmony_ci 61d722e3fbSopenharmony_ci#define EXYNOS_EVENT_CONTEXT_VERSION 1 62d722e3fbSopenharmony_ci 63d722e3fbSopenharmony_ci/* 64d722e3fbSopenharmony_ci * Exynos Event Context structure. 65d722e3fbSopenharmony_ci * 66d722e3fbSopenharmony_ci * @base: base context (for core events). 67d722e3fbSopenharmony_ci * @version: version info similar to the one in 'drmEventContext'. 68d722e3fbSopenharmony_ci * @g2d_event_handler: handler for G2D events. 69d722e3fbSopenharmony_ci */ 70d722e3fbSopenharmony_cistruct exynos_event_context { 71d722e3fbSopenharmony_ci drmEventContext base; 72d722e3fbSopenharmony_ci 73d722e3fbSopenharmony_ci int version; 74d722e3fbSopenharmony_ci 75d722e3fbSopenharmony_ci void (*g2d_event_handler)(int fd, unsigned int cmdlist_no, 76d722e3fbSopenharmony_ci unsigned int tv_sec, unsigned int tv_usec, 77d722e3fbSopenharmony_ci void *user_data); 78d722e3fbSopenharmony_ci}; 79d722e3fbSopenharmony_ci 80d722e3fbSopenharmony_ci/* 81d722e3fbSopenharmony_ci * device related functions: 82d722e3fbSopenharmony_ci */ 83d722e3fbSopenharmony_cistruct exynos_device * exynos_device_create(int fd); 84d722e3fbSopenharmony_civoid exynos_device_destroy(struct exynos_device *dev); 85d722e3fbSopenharmony_ci 86d722e3fbSopenharmony_ci/* 87d722e3fbSopenharmony_ci * buffer-object related functions: 88d722e3fbSopenharmony_ci */ 89d722e3fbSopenharmony_cistruct exynos_bo * exynos_bo_create(struct exynos_device *dev, 90d722e3fbSopenharmony_ci size_t size, uint32_t flags); 91d722e3fbSopenharmony_ciint exynos_bo_get_info(struct exynos_device *dev, uint32_t handle, 92d722e3fbSopenharmony_ci size_t *size, uint32_t *flags); 93d722e3fbSopenharmony_civoid exynos_bo_destroy(struct exynos_bo *bo); 94d722e3fbSopenharmony_cistruct exynos_bo * exynos_bo_from_name(struct exynos_device *dev, uint32_t name); 95d722e3fbSopenharmony_ciint exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name); 96d722e3fbSopenharmony_ciuint32_t exynos_bo_handle(struct exynos_bo *bo); 97d722e3fbSopenharmony_civoid * exynos_bo_map(struct exynos_bo *bo); 98d722e3fbSopenharmony_ciint exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle, 99d722e3fbSopenharmony_ci int *fd); 100d722e3fbSopenharmony_ciint exynos_prime_fd_to_handle(struct exynos_device *dev, int fd, 101d722e3fbSopenharmony_ci uint32_t *handle); 102d722e3fbSopenharmony_ci 103d722e3fbSopenharmony_ci/* 104d722e3fbSopenharmony_ci * Virtual Display related functions: 105d722e3fbSopenharmony_ci */ 106d722e3fbSopenharmony_ciint exynos_vidi_connection(struct exynos_device *dev, uint32_t connect, 107d722e3fbSopenharmony_ci uint32_t ext, void *edid); 108d722e3fbSopenharmony_ci 109d722e3fbSopenharmony_ci/* 110d722e3fbSopenharmony_ci * event handling related functions: 111d722e3fbSopenharmony_ci */ 112d722e3fbSopenharmony_ciint exynos_handle_event(struct exynos_device *dev, 113d722e3fbSopenharmony_ci struct exynos_event_context *ctx); 114d722e3fbSopenharmony_ci 115d722e3fbSopenharmony_ci 116d722e3fbSopenharmony_ci#if defined(__cplusplus) 117d722e3fbSopenharmony_ci} 118d722e3fbSopenharmony_ci#endif 119d722e3fbSopenharmony_ci 120d722e3fbSopenharmony_ci#endif /* EXYNOS_DRMIF_H_ */ 121