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