/*1* Copyright 2013 Red Hat2* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL18* THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR19* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,20* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR21* OTHER DEALINGS IN THE SOFTWARE.22*/23#ifndef QXL_DRM_H24#define QXL_DRM_H2526#include "drm.h"2728#if defined(__cplusplus)29extern "C" {30#endif3132/* Please note that modifications to all structs defined here are33* subject to backwards-compatibility constraints.34*35* Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel36* compatibility Keep fields aligned to their size37*/3839#define QXL_GEM_DOMAIN_CPU 040#define QXL_GEM_DOMAIN_VRAM 141#define QXL_GEM_DOMAIN_SURFACE 24243#define DRM_QXL_ALLOC 0x0044#define DRM_QXL_MAP 0x0145#define DRM_QXL_EXECBUFFER 0x0246#define DRM_QXL_UPDATE_AREA 0x0347#define DRM_QXL_GETPARAM 0x0448#define DRM_QXL_CLIENTCAP 0x054950#define DRM_QXL_ALLOC_SURF 0x065152struct drm_qxl_alloc {53__u32 size;54__u32 handle; /* 0 is an invalid handle */55};5657struct drm_qxl_map {58__u64 offset; /* use for mmap system call */59__u32 handle;60__u32 pad;61};6263/*64* dest is the bo we are writing the relocation into65* src is bo we are relocating.66* *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr +67* src_offset)68*/69#define QXL_RELOC_TYPE_BO 170#define QXL_RELOC_TYPE_SURF 27172struct drm_qxl_reloc {73__u64 src_offset; /* offset into src_handle or src buffer */74__u64 dst_offset; /* offset in dest handle */75__u32 src_handle; /* dest handle to compute address from */76__u32 dst_handle; /* 0 if to command buffer */77__u32 reloc_type;78__u32 pad;79};8081struct drm_qxl_command {82__u64 command; /* void* */83__u64 relocs; /* struct drm_qxl_reloc* */84__u32 type;85__u32 command_size;86__u32 relocs_num;87__u32 pad;88};8990struct drm_qxl_execbuffer {91__u32 flags; /* for future use */92__u32 commands_num;93__u64 commands; /* struct drm_qxl_command* */94};9596struct drm_qxl_update_area {97__u32 handle;98__u32 top;99__u32 left;100__u32 bottom;101__u32 right;102__u32 pad;103};104105#define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */106#define QXL_PARAM_MAX_RELOCS 2107struct drm_qxl_getparam {108__u64 param;109__u64 value;110};111112/* these are one bit values */113struct drm_qxl_clientcap {114__u32 index;115__u32 pad;116};117118struct drm_qxl_alloc_surf {119__u32 format;120__u32 width;121__u32 height;122__s32 stride;123__u32 handle;124__u32 pad;125};126127#define DRM_IOCTL_QXL_ALLOC \128DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc)129130#define DRM_IOCTL_QXL_MAP \131DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map)132133#define DRM_IOCTL_QXL_EXECBUFFER \134DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\135struct drm_qxl_execbuffer)136137#define DRM_IOCTL_QXL_UPDATE_AREA \138DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\139struct drm_qxl_update_area)140141#define DRM_IOCTL_QXL_GETPARAM \142DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\143struct drm_qxl_getparam)144145#define DRM_IOCTL_QXL_CLIENTCAP \146DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\147struct drm_qxl_clientcap)148149#define DRM_IOCTL_QXL_ALLOC_SURF \150DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\151struct drm_qxl_alloc_surf)152153#if defined(__cplusplus)154}155#endif156157#endif158159160