18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2013 Red Hat 38c2ecf20Sopenharmony_ci * All Rights Reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 68c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 78c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 88c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 98c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 108c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 138c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 148c2ecf20Sopenharmony_ci * Software. 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 178c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 188c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 198c2ecf20Sopenharmony_ci * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 208c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 218c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 228c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_ci#ifndef QXL_DRM_H 258c2ecf20Sopenharmony_ci#define QXL_DRM_H 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include "drm.h" 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#if defined(__cplusplus) 308c2ecf20Sopenharmony_ciextern "C" { 318c2ecf20Sopenharmony_ci#endif 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* Please note that modifications to all structs defined here are 348c2ecf20Sopenharmony_ci * subject to backwards-compatibility constraints. 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel 378c2ecf20Sopenharmony_ci * compatibility Keep fields aligned to their size 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define QXL_GEM_DOMAIN_CPU 0 418c2ecf20Sopenharmony_ci#define QXL_GEM_DOMAIN_VRAM 1 428c2ecf20Sopenharmony_ci#define QXL_GEM_DOMAIN_SURFACE 2 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define DRM_QXL_ALLOC 0x00 458c2ecf20Sopenharmony_ci#define DRM_QXL_MAP 0x01 468c2ecf20Sopenharmony_ci#define DRM_QXL_EXECBUFFER 0x02 478c2ecf20Sopenharmony_ci#define DRM_QXL_UPDATE_AREA 0x03 488c2ecf20Sopenharmony_ci#define DRM_QXL_GETPARAM 0x04 498c2ecf20Sopenharmony_ci#define DRM_QXL_CLIENTCAP 0x05 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define DRM_QXL_ALLOC_SURF 0x06 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistruct drm_qxl_alloc { 548c2ecf20Sopenharmony_ci __u32 size; 558c2ecf20Sopenharmony_ci __u32 handle; /* 0 is an invalid handle */ 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cistruct drm_qxl_map { 598c2ecf20Sopenharmony_ci __u64 offset; /* use for mmap system call */ 608c2ecf20Sopenharmony_ci __u32 handle; 618c2ecf20Sopenharmony_ci __u32 pad; 628c2ecf20Sopenharmony_ci}; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * dest is the bo we are writing the relocation into 668c2ecf20Sopenharmony_ci * src is bo we are relocating. 678c2ecf20Sopenharmony_ci * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr + 688c2ecf20Sopenharmony_ci * src_offset) 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_ci#define QXL_RELOC_TYPE_BO 1 718c2ecf20Sopenharmony_ci#define QXL_RELOC_TYPE_SURF 2 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistruct drm_qxl_reloc { 748c2ecf20Sopenharmony_ci __u64 src_offset; /* offset into src_handle or src buffer */ 758c2ecf20Sopenharmony_ci __u64 dst_offset; /* offset in dest handle */ 768c2ecf20Sopenharmony_ci __u32 src_handle; /* dest handle to compute address from */ 778c2ecf20Sopenharmony_ci __u32 dst_handle; /* 0 if to command buffer */ 788c2ecf20Sopenharmony_ci __u32 reloc_type; 798c2ecf20Sopenharmony_ci __u32 pad; 808c2ecf20Sopenharmony_ci}; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cistruct drm_qxl_command { 838c2ecf20Sopenharmony_ci __u64 command; /* void* */ 848c2ecf20Sopenharmony_ci __u64 relocs; /* struct drm_qxl_reloc* */ 858c2ecf20Sopenharmony_ci __u32 type; 868c2ecf20Sopenharmony_ci __u32 command_size; 878c2ecf20Sopenharmony_ci __u32 relocs_num; 888c2ecf20Sopenharmony_ci __u32 pad; 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistruct drm_qxl_execbuffer { 928c2ecf20Sopenharmony_ci __u32 flags; /* for future use */ 938c2ecf20Sopenharmony_ci __u32 commands_num; 948c2ecf20Sopenharmony_ci __u64 commands; /* struct drm_qxl_command* */ 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistruct drm_qxl_update_area { 988c2ecf20Sopenharmony_ci __u32 handle; 998c2ecf20Sopenharmony_ci __u32 top; 1008c2ecf20Sopenharmony_ci __u32 left; 1018c2ecf20Sopenharmony_ci __u32 bottom; 1028c2ecf20Sopenharmony_ci __u32 right; 1038c2ecf20Sopenharmony_ci __u32 pad; 1048c2ecf20Sopenharmony_ci}; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */ 1078c2ecf20Sopenharmony_ci#define QXL_PARAM_MAX_RELOCS 2 1088c2ecf20Sopenharmony_cistruct drm_qxl_getparam { 1098c2ecf20Sopenharmony_ci __u64 param; 1108c2ecf20Sopenharmony_ci __u64 value; 1118c2ecf20Sopenharmony_ci}; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci/* these are one bit values */ 1148c2ecf20Sopenharmony_cistruct drm_qxl_clientcap { 1158c2ecf20Sopenharmony_ci __u32 index; 1168c2ecf20Sopenharmony_ci __u32 pad; 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistruct drm_qxl_alloc_surf { 1208c2ecf20Sopenharmony_ci __u32 format; 1218c2ecf20Sopenharmony_ci __u32 width; 1228c2ecf20Sopenharmony_ci __u32 height; 1238c2ecf20Sopenharmony_ci __s32 stride; 1248c2ecf20Sopenharmony_ci __u32 handle; 1258c2ecf20Sopenharmony_ci __u32 pad; 1268c2ecf20Sopenharmony_ci}; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_ALLOC \ 1298c2ecf20Sopenharmony_ci DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc) 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_MAP \ 1328c2ecf20Sopenharmony_ci DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_EXECBUFFER \ 1358c2ecf20Sopenharmony_ci DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\ 1368c2ecf20Sopenharmony_ci struct drm_qxl_execbuffer) 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_UPDATE_AREA \ 1398c2ecf20Sopenharmony_ci DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\ 1408c2ecf20Sopenharmony_ci struct drm_qxl_update_area) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_GETPARAM \ 1438c2ecf20Sopenharmony_ci DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\ 1448c2ecf20Sopenharmony_ci struct drm_qxl_getparam) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_CLIENTCAP \ 1478c2ecf20Sopenharmony_ci DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\ 1488c2ecf20Sopenharmony_ci struct drm_qxl_clientcap) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define DRM_IOCTL_QXL_ALLOC_SURF \ 1518c2ecf20Sopenharmony_ci DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\ 1528c2ecf20Sopenharmony_ci struct drm_qxl_alloc_surf) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#if defined(__cplusplus) 1558c2ecf20Sopenharmony_ci} 1568c2ecf20Sopenharmony_ci#endif 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci#endif 159