summaryrefslogtreecommitdiff
path: root/include/drm/qxl_drm.h
blob: 636d50f9dfebc9b4178e9236a272589efb304a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef QXL_DRM_H
#define QXL_DRM_H

#include "drm.h"

/* Please note that modifications to all structs defined here are
 * subject to backwards-compatibility constraints.
 */

#define QXL_GEM_DOMAIN_CPU 0
#define QXL_GEM_DOMAIN_VRAM 1

#define DRM_QXL_ALLOC       0x00
#define DRM_QXL_INCREF      0x01
#define DRM_QXL_DECREF      0x02
#define DRM_QXL_MAP         0x03
#define DRM_QXL_UNMAP       0x04
#define DRM_QXL_EXECBUFFER  0x05

enum {
    QXL_ALLOC_TYPE_DATA,
    QXL_ALLOC_TYPE_SURFACE,
    QXL_ALLOC_TYPE_SURFACE_PRIMARY,
};

struct drm_qxl_alloc {
    uint32_t type;
    uint32_t size;
    uint64_t handle; // output // 0 is an invalid handle
};

struct drm_qxl_incref {
    uint64_t handle;
};

struct drm_qxl_decref {
    uint64_t handle;
};

struct drm_qxl_map {
    uint64_t handle;
    uint64_t addr; // output // cast to pointer
};

struct drm_qxl_unmap {
    uint64_t handle;
};

struct drm_qxl_reloc { // 32?
    uint64_t offset;
    uint64_t handle;
    uint64_t delta;
};

struct drm_qxl_command {
    uint32_t type;
    uint32_t command_size;
    uint8_t *command;
    uint32_t relocs_num;
    struct drm_qxl_reloc* relocs;
};

/* XXX: call it drm_qxl_commands? */
struct drm_qxl_execbuffer {
    uint32_t flags; // for future
    uint32_t comands_num;
    struct drm_qxl_command* commands;
    uint8_t spare[16]; // spare for future
};

// TODO: why have a seperate mmap and alloc ioctl? also, why not just unmmap on the last
// decref, i.e. when destroyed? is there a huge performance gain to unmapping stuff before
// destroying? and can anyone use an allocated but not mapped memory from userspace??
#define DRM_IOCTL_QXL_ALLOC	DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc)
#define DRM_IOCTL_QXL_INCREF	DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_INCREF, struct drm_qxl_incref)
#define DRM_IOCTL_QXL_DECREF	DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_DECREF, struct drm_qxl_decref)
#define DRM_IOCTL_QXL_MAP	DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map)
#define DRM_IOCTL_QXL_UNMAP	DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UNMAP, struct drm_qxl_unmap)
#define DRM_IOCTL_QXL_EXECBUFFER	DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER, struct drm_qxl_execbuffer)

#endif