exynos_drmif.h revision 3f012e29
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 34e88f27b3Smrgstruct exynos_device { 35e88f27b3Smrg int fd; 36e88f27b3Smrg}; 37e88f27b3Smrg 38e88f27b3Smrg/* 39e88f27b3Smrg * Exynos Buffer Object structure. 40e88f27b3Smrg * 41e88f27b3Smrg * @dev: exynos device object allocated. 42e88f27b3Smrg * @handle: a gem handle to gem object created. 43e88f27b3Smrg * @flags: indicate memory allocation and cache attribute types. 44e88f27b3Smrg * @size: size to the buffer created. 45e88f27b3Smrg * @vaddr: user space address to a gem buffer mmaped. 46e88f27b3Smrg * @name: a gem global handle from flink request. 47e88f27b3Smrg */ 48e88f27b3Smrgstruct exynos_bo { 49e88f27b3Smrg struct exynos_device *dev; 50e88f27b3Smrg uint32_t handle; 51e88f27b3Smrg uint32_t flags; 52e88f27b3Smrg size_t size; 53e88f27b3Smrg void *vaddr; 54e88f27b3Smrg uint32_t name; 55e88f27b3Smrg}; 56e88f27b3Smrg 573f012e29Smrg#define EXYNOS_EVENT_CONTEXT_VERSION 1 583f012e29Smrg 593f012e29Smrg/* 603f012e29Smrg * Exynos Event Context structure. 613f012e29Smrg * 623f012e29Smrg * @base: base context (for core events). 633f012e29Smrg * @version: version info similar to the one in 'drmEventContext'. 643f012e29Smrg * @g2d_event_handler: handler for G2D events. 653f012e29Smrg */ 663f012e29Smrgstruct exynos_event_context { 673f012e29Smrg drmEventContext base; 683f012e29Smrg 693f012e29Smrg int version; 703f012e29Smrg 713f012e29Smrg void (*g2d_event_handler)(int fd, unsigned int cmdlist_no, 723f012e29Smrg unsigned int tv_sec, unsigned int tv_usec, 733f012e29Smrg void *user_data); 743f012e29Smrg}; 753f012e29Smrg 76e88f27b3Smrg/* 77e88f27b3Smrg * device related functions: 78e88f27b3Smrg */ 79e88f27b3Smrgstruct exynos_device * exynos_device_create(int fd); 80e88f27b3Smrgvoid exynos_device_destroy(struct exynos_device *dev); 81e88f27b3Smrg 82e88f27b3Smrg/* 83e88f27b3Smrg * buffer-object related functions: 84e88f27b3Smrg */ 85e88f27b3Smrgstruct exynos_bo * exynos_bo_create(struct exynos_device *dev, 86e88f27b3Smrg size_t size, uint32_t flags); 87e88f27b3Smrgint exynos_bo_get_info(struct exynos_device *dev, uint32_t handle, 88e88f27b3Smrg size_t *size, uint32_t *flags); 89e88f27b3Smrgvoid exynos_bo_destroy(struct exynos_bo *bo); 90e88f27b3Smrgstruct exynos_bo * exynos_bo_from_name(struct exynos_device *dev, uint32_t name); 91e88f27b3Smrgint exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name); 92e88f27b3Smrguint32_t exynos_bo_handle(struct exynos_bo *bo); 93e88f27b3Smrgvoid * exynos_bo_map(struct exynos_bo *bo); 94e88f27b3Smrgint exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle, 95e88f27b3Smrg int *fd); 96e88f27b3Smrgint exynos_prime_fd_to_handle(struct exynos_device *dev, int fd, 97e88f27b3Smrg uint32_t *handle); 98e88f27b3Smrg 99e88f27b3Smrg/* 100e88f27b3Smrg * Virtual Display related functions: 101e88f27b3Smrg */ 102e88f27b3Smrgint exynos_vidi_connection(struct exynos_device *dev, uint32_t connect, 103e88f27b3Smrg uint32_t ext, void *edid); 104e88f27b3Smrg 1053f012e29Smrg/* 1063f012e29Smrg * event handling related functions: 1073f012e29Smrg */ 1083f012e29Smrgint exynos_handle_event(struct exynos_device *dev, 1093f012e29Smrg struct exynos_event_context *ctx); 1103f012e29Smrg 1113f012e29Smrg 112e88f27b3Smrg#endif /* EXYNOS_DRMIF_H_ */ 113