153476e07SGerd Hoffmann /*
253476e07SGerd Hoffmann  * Virtio GPU Device
353476e07SGerd Hoffmann  *
453476e07SGerd Hoffmann  * Copyright Red Hat, Inc. 2013-2014
553476e07SGerd Hoffmann  *
653476e07SGerd Hoffmann  * Authors:
753476e07SGerd Hoffmann  *     Dave Airlie <airlied@redhat.com>
853476e07SGerd Hoffmann  *     Gerd Hoffmann <kraxel@redhat.com>
953476e07SGerd Hoffmann  *
1053476e07SGerd Hoffmann  * This header is BSD licensed so anyone can use the definitions
1153476e07SGerd Hoffmann  * to implement compatible drivers/servers:
1253476e07SGerd Hoffmann  *
1353476e07SGerd Hoffmann  * Redistribution and use in source and binary forms, with or without
1453476e07SGerd Hoffmann  * modification, are permitted provided that the following conditions
1553476e07SGerd Hoffmann  * are met:
1653476e07SGerd Hoffmann  * 1. Redistributions of source code must retain the above copyright
1753476e07SGerd Hoffmann  *    notice, this list of conditions and the following disclaimer.
1853476e07SGerd Hoffmann  * 2. Redistributions in binary form must reproduce the above copyright
1953476e07SGerd Hoffmann  *    notice, this list of conditions and the following disclaimer in the
2053476e07SGerd Hoffmann  *    documentation and/or other materials provided with the distribution.
2153476e07SGerd Hoffmann  * 3. Neither the name of IBM nor the names of its contributors
2253476e07SGerd Hoffmann  *    may be used to endorse or promote products derived from this software
2353476e07SGerd Hoffmann  *    without specific prior written permission.
2453476e07SGerd Hoffmann  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2553476e07SGerd Hoffmann  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2653476e07SGerd Hoffmann  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2753476e07SGerd Hoffmann  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR
2853476e07SGerd Hoffmann  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2953476e07SGerd Hoffmann  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3053476e07SGerd Hoffmann  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
3153476e07SGerd Hoffmann  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3253476e07SGerd Hoffmann  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3353476e07SGerd Hoffmann  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3453476e07SGerd Hoffmann  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3553476e07SGerd Hoffmann  * SUCH DAMAGE.
3653476e07SGerd Hoffmann  */
3753476e07SGerd Hoffmann 
3853476e07SGerd Hoffmann #ifndef VIRTIO_GPU_HW_H
3953476e07SGerd Hoffmann #define VIRTIO_GPU_HW_H
4053476e07SGerd Hoffmann 
4125b8b39bSAlexey Kardashevskiy #include "standard-headers/linux/types.h"
4225b8b39bSAlexey Kardashevskiy 
43*d9cb4336SCornelia Huck /*
44*d9cb4336SCornelia Huck  * VIRTIO_GPU_CMD_CTX_*
45*d9cb4336SCornelia Huck  * VIRTIO_GPU_CMD_*_3D
46*d9cb4336SCornelia Huck  */
47fff02bc0SPaolo Bonzini #define VIRTIO_GPU_F_VIRGL               0
48*d9cb4336SCornelia Huck 
49*d9cb4336SCornelia Huck /*
50*d9cb4336SCornelia Huck  * VIRTIO_GPU_CMD_GET_EDID
51*d9cb4336SCornelia Huck  */
52da054c64SPaolo Bonzini #define VIRTIO_GPU_F_EDID                1
53bc79e964SGerd Hoffmann 
5453476e07SGerd Hoffmann enum virtio_gpu_ctrl_type {
5553476e07SGerd Hoffmann 	VIRTIO_GPU_UNDEFINED = 0,
5653476e07SGerd Hoffmann 
5753476e07SGerd Hoffmann 	/* 2d commands */
5853476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_GET_DISPLAY_INFO = 0x0100,
5953476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_RESOURCE_CREATE_2D,
6053476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_RESOURCE_UNREF,
6153476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_SET_SCANOUT,
6253476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_RESOURCE_FLUSH,
6353476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D,
6453476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING,
6553476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING,
66bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_GET_CAPSET_INFO,
67bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_GET_CAPSET,
68da054c64SPaolo Bonzini 	VIRTIO_GPU_CMD_GET_EDID,
69bc79e964SGerd Hoffmann 
70bc79e964SGerd Hoffmann 	/* 3d commands */
71bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_CTX_CREATE = 0x0200,
72bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_CTX_DESTROY,
73bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE,
74bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE,
75bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_RESOURCE_CREATE_3D,
76bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D,
77bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D,
78bc79e964SGerd Hoffmann 	VIRTIO_GPU_CMD_SUBMIT_3D,
7953476e07SGerd Hoffmann 
8053476e07SGerd Hoffmann 	/* cursor commands */
8153476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300,
8253476e07SGerd Hoffmann 	VIRTIO_GPU_CMD_MOVE_CURSOR,
8353476e07SGerd Hoffmann 
8453476e07SGerd Hoffmann 	/* success responses */
8553476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_OK_NODATA = 0x1100,
8653476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_OK_DISPLAY_INFO,
87bc79e964SGerd Hoffmann 	VIRTIO_GPU_RESP_OK_CAPSET_INFO,
88bc79e964SGerd Hoffmann 	VIRTIO_GPU_RESP_OK_CAPSET,
89da054c64SPaolo Bonzini 	VIRTIO_GPU_RESP_OK_EDID,
9053476e07SGerd Hoffmann 
9153476e07SGerd Hoffmann 	/* error responses */
9253476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200,
9353476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY,
9453476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID,
9553476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID,
9653476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_ERR_INVALID_CONTEXT_ID,
9753476e07SGerd Hoffmann 	VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER,
9853476e07SGerd Hoffmann };
9953476e07SGerd Hoffmann 
10053476e07SGerd Hoffmann #define VIRTIO_GPU_FLAG_FENCE (1 << 0)
10153476e07SGerd Hoffmann 
10253476e07SGerd Hoffmann struct virtio_gpu_ctrl_hdr {
10353476e07SGerd Hoffmann 	uint32_t type;
10453476e07SGerd Hoffmann 	uint32_t flags;
10553476e07SGerd Hoffmann 	uint64_t fence_id;
10653476e07SGerd Hoffmann 	uint32_t ctx_id;
10753476e07SGerd Hoffmann 	uint32_t padding;
10853476e07SGerd Hoffmann };
10953476e07SGerd Hoffmann 
11053476e07SGerd Hoffmann /* data passed in the cursor vq */
11153476e07SGerd Hoffmann 
11253476e07SGerd Hoffmann struct virtio_gpu_cursor_pos {
11353476e07SGerd Hoffmann 	uint32_t scanout_id;
11453476e07SGerd Hoffmann 	uint32_t x;
11553476e07SGerd Hoffmann 	uint32_t y;
11653476e07SGerd Hoffmann 	uint32_t padding;
11753476e07SGerd Hoffmann };
11853476e07SGerd Hoffmann 
11953476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_UPDATE_CURSOR, VIRTIO_GPU_CMD_MOVE_CURSOR */
12053476e07SGerd Hoffmann struct virtio_gpu_update_cursor {
12153476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
12253476e07SGerd Hoffmann 	struct virtio_gpu_cursor_pos pos;  /* update & move */
12353476e07SGerd Hoffmann 	uint32_t resource_id;           /* update only */
12453476e07SGerd Hoffmann 	uint32_t hot_x;                 /* update only */
12553476e07SGerd Hoffmann 	uint32_t hot_y;                 /* update only */
12653476e07SGerd Hoffmann 	uint32_t padding;
12753476e07SGerd Hoffmann };
12853476e07SGerd Hoffmann 
12953476e07SGerd Hoffmann /* data passed in the control vq, 2d related */
13053476e07SGerd Hoffmann 
13153476e07SGerd Hoffmann struct virtio_gpu_rect {
13253476e07SGerd Hoffmann 	uint32_t x;
13353476e07SGerd Hoffmann 	uint32_t y;
13453476e07SGerd Hoffmann 	uint32_t width;
13553476e07SGerd Hoffmann 	uint32_t height;
13653476e07SGerd Hoffmann };
13753476e07SGerd Hoffmann 
13853476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_RESOURCE_UNREF */
13953476e07SGerd Hoffmann struct virtio_gpu_resource_unref {
14053476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
14153476e07SGerd Hoffmann 	uint32_t resource_id;
14253476e07SGerd Hoffmann 	uint32_t padding;
14353476e07SGerd Hoffmann };
14453476e07SGerd Hoffmann 
14553476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_RESOURCE_CREATE_2D: create a 2d resource with a format */
14653476e07SGerd Hoffmann struct virtio_gpu_resource_create_2d {
14753476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
14853476e07SGerd Hoffmann 	uint32_t resource_id;
14953476e07SGerd Hoffmann 	uint32_t format;
15053476e07SGerd Hoffmann 	uint32_t width;
15153476e07SGerd Hoffmann 	uint32_t height;
15253476e07SGerd Hoffmann };
15353476e07SGerd Hoffmann 
15453476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_SET_SCANOUT */
15553476e07SGerd Hoffmann struct virtio_gpu_set_scanout {
15653476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
15753476e07SGerd Hoffmann 	struct virtio_gpu_rect r;
15853476e07SGerd Hoffmann 	uint32_t scanout_id;
15953476e07SGerd Hoffmann 	uint32_t resource_id;
16053476e07SGerd Hoffmann };
16153476e07SGerd Hoffmann 
16253476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_RESOURCE_FLUSH */
16353476e07SGerd Hoffmann struct virtio_gpu_resource_flush {
16453476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
16553476e07SGerd Hoffmann 	struct virtio_gpu_rect r;
16653476e07SGerd Hoffmann 	uint32_t resource_id;
16753476e07SGerd Hoffmann 	uint32_t padding;
16853476e07SGerd Hoffmann };
16953476e07SGerd Hoffmann 
17053476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D: simple transfer to_host */
17153476e07SGerd Hoffmann struct virtio_gpu_transfer_to_host_2d {
17253476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
17353476e07SGerd Hoffmann 	struct virtio_gpu_rect r;
17453476e07SGerd Hoffmann 	uint64_t offset;
17553476e07SGerd Hoffmann 	uint32_t resource_id;
17653476e07SGerd Hoffmann 	uint32_t padding;
17753476e07SGerd Hoffmann };
17853476e07SGerd Hoffmann 
17953476e07SGerd Hoffmann struct virtio_gpu_mem_entry {
18053476e07SGerd Hoffmann 	uint64_t addr;
18153476e07SGerd Hoffmann 	uint32_t length;
18253476e07SGerd Hoffmann 	uint32_t padding;
18353476e07SGerd Hoffmann };
18453476e07SGerd Hoffmann 
18553476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING */
18653476e07SGerd Hoffmann struct virtio_gpu_resource_attach_backing {
18753476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
18853476e07SGerd Hoffmann 	uint32_t resource_id;
18953476e07SGerd Hoffmann 	uint32_t nr_entries;
19053476e07SGerd Hoffmann };
19153476e07SGerd Hoffmann 
19253476e07SGerd Hoffmann /* VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING */
19353476e07SGerd Hoffmann struct virtio_gpu_resource_detach_backing {
19453476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
19553476e07SGerd Hoffmann 	uint32_t resource_id;
19653476e07SGerd Hoffmann 	uint32_t padding;
19753476e07SGerd Hoffmann };
19853476e07SGerd Hoffmann 
19953476e07SGerd Hoffmann /* VIRTIO_GPU_RESP_OK_DISPLAY_INFO */
20053476e07SGerd Hoffmann #define VIRTIO_GPU_MAX_SCANOUTS 16
20153476e07SGerd Hoffmann struct virtio_gpu_resp_display_info {
20253476e07SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
20353476e07SGerd Hoffmann 	struct virtio_gpu_display_one {
20453476e07SGerd Hoffmann 		struct virtio_gpu_rect r;
20553476e07SGerd Hoffmann 		uint32_t enabled;
20653476e07SGerd Hoffmann 		uint32_t flags;
20753476e07SGerd Hoffmann 	} pmodes[VIRTIO_GPU_MAX_SCANOUTS];
20853476e07SGerd Hoffmann };
20953476e07SGerd Hoffmann 
210bc79e964SGerd Hoffmann /* data passed in the control vq, 3d related */
211bc79e964SGerd Hoffmann 
212bc79e964SGerd Hoffmann struct virtio_gpu_box {
213bc79e964SGerd Hoffmann 	uint32_t x, y, z;
214bc79e964SGerd Hoffmann 	uint32_t w, h, d;
215bc79e964SGerd Hoffmann };
216bc79e964SGerd Hoffmann 
217bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D, VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D */
218bc79e964SGerd Hoffmann struct virtio_gpu_transfer_host_3d {
219bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
220bc79e964SGerd Hoffmann 	struct virtio_gpu_box box;
221bc79e964SGerd Hoffmann 	uint64_t offset;
222bc79e964SGerd Hoffmann 	uint32_t resource_id;
223bc79e964SGerd Hoffmann 	uint32_t level;
224bc79e964SGerd Hoffmann 	uint32_t stride;
225bc79e964SGerd Hoffmann 	uint32_t layer_stride;
226bc79e964SGerd Hoffmann };
227bc79e964SGerd Hoffmann 
228bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_RESOURCE_CREATE_3D */
229bc79e964SGerd Hoffmann #define VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP (1 << 0)
230bc79e964SGerd Hoffmann struct virtio_gpu_resource_create_3d {
231bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
232bc79e964SGerd Hoffmann 	uint32_t resource_id;
233bc79e964SGerd Hoffmann 	uint32_t target;
234bc79e964SGerd Hoffmann 	uint32_t format;
235bc79e964SGerd Hoffmann 	uint32_t bind;
236bc79e964SGerd Hoffmann 	uint32_t width;
237bc79e964SGerd Hoffmann 	uint32_t height;
238bc79e964SGerd Hoffmann 	uint32_t depth;
239bc79e964SGerd Hoffmann 	uint32_t array_size;
240bc79e964SGerd Hoffmann 	uint32_t last_level;
241bc79e964SGerd Hoffmann 	uint32_t nr_samples;
242bc79e964SGerd Hoffmann 	uint32_t flags;
243bc79e964SGerd Hoffmann 	uint32_t padding;
244bc79e964SGerd Hoffmann };
245bc79e964SGerd Hoffmann 
246bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_CTX_CREATE */
247bc79e964SGerd Hoffmann struct virtio_gpu_ctx_create {
248bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
249bc79e964SGerd Hoffmann 	uint32_t nlen;
250bc79e964SGerd Hoffmann 	uint32_t padding;
251bc79e964SGerd Hoffmann 	char debug_name[64];
252bc79e964SGerd Hoffmann };
253bc79e964SGerd Hoffmann 
254bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_CTX_DESTROY */
255bc79e964SGerd Hoffmann struct virtio_gpu_ctx_destroy {
256bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
257bc79e964SGerd Hoffmann };
258bc79e964SGerd Hoffmann 
259bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE, VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE */
260bc79e964SGerd Hoffmann struct virtio_gpu_ctx_resource {
261bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
262bc79e964SGerd Hoffmann 	uint32_t resource_id;
263bc79e964SGerd Hoffmann 	uint32_t padding;
264bc79e964SGerd Hoffmann };
265bc79e964SGerd Hoffmann 
266bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_SUBMIT_3D */
267bc79e964SGerd Hoffmann struct virtio_gpu_cmd_submit {
268bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
269bc79e964SGerd Hoffmann 	uint32_t size;
270bc79e964SGerd Hoffmann 	uint32_t padding;
271bc79e964SGerd Hoffmann };
272bc79e964SGerd Hoffmann 
273bc79e964SGerd Hoffmann #define VIRTIO_GPU_CAPSET_VIRGL 1
27477d361b1SEric Auger #define VIRTIO_GPU_CAPSET_VIRGL2 2
275bc79e964SGerd Hoffmann 
276bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */
277bc79e964SGerd Hoffmann struct virtio_gpu_get_capset_info {
278bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
279bc79e964SGerd Hoffmann 	uint32_t capset_index;
280bc79e964SGerd Hoffmann 	uint32_t padding;
281bc79e964SGerd Hoffmann };
282bc79e964SGerd Hoffmann 
283bc79e964SGerd Hoffmann /* VIRTIO_GPU_RESP_OK_CAPSET_INFO */
284bc79e964SGerd Hoffmann struct virtio_gpu_resp_capset_info {
285bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
286bc79e964SGerd Hoffmann 	uint32_t capset_id;
287bc79e964SGerd Hoffmann 	uint32_t capset_max_version;
288bc79e964SGerd Hoffmann 	uint32_t capset_max_size;
289bc79e964SGerd Hoffmann 	uint32_t padding;
290bc79e964SGerd Hoffmann };
291bc79e964SGerd Hoffmann 
292bc79e964SGerd Hoffmann /* VIRTIO_GPU_CMD_GET_CAPSET */
293bc79e964SGerd Hoffmann struct virtio_gpu_get_capset {
294bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
295bc79e964SGerd Hoffmann 	uint32_t capset_id;
296bc79e964SGerd Hoffmann 	uint32_t capset_version;
297bc79e964SGerd Hoffmann };
298bc79e964SGerd Hoffmann 
299bc79e964SGerd Hoffmann /* VIRTIO_GPU_RESP_OK_CAPSET */
300bc79e964SGerd Hoffmann struct virtio_gpu_resp_capset {
301bc79e964SGerd Hoffmann 	struct virtio_gpu_ctrl_hdr hdr;
302bc79e964SGerd Hoffmann 	uint8_t capset_data[];
303bc79e964SGerd Hoffmann };
304bc79e964SGerd Hoffmann 
305da054c64SPaolo Bonzini /* VIRTIO_GPU_CMD_GET_EDID */
306da054c64SPaolo Bonzini struct virtio_gpu_cmd_get_edid {
307da054c64SPaolo Bonzini 	struct virtio_gpu_ctrl_hdr hdr;
308da054c64SPaolo Bonzini 	uint32_t scanout;
309da054c64SPaolo Bonzini 	uint32_t padding;
310da054c64SPaolo Bonzini };
311da054c64SPaolo Bonzini 
312da054c64SPaolo Bonzini /* VIRTIO_GPU_RESP_OK_EDID */
313da054c64SPaolo Bonzini struct virtio_gpu_resp_edid {
314da054c64SPaolo Bonzini 	struct virtio_gpu_ctrl_hdr hdr;
315da054c64SPaolo Bonzini 	uint32_t size;
316da054c64SPaolo Bonzini 	uint32_t padding;
317da054c64SPaolo Bonzini 	uint8_t edid[1024];
318da054c64SPaolo Bonzini };
319da054c64SPaolo Bonzini 
32053476e07SGerd Hoffmann #define VIRTIO_GPU_EVENT_DISPLAY (1 << 0)
32153476e07SGerd Hoffmann 
32253476e07SGerd Hoffmann struct virtio_gpu_config {
32353476e07SGerd Hoffmann 	uint32_t events_read;
32453476e07SGerd Hoffmann 	uint32_t events_clear;
32553476e07SGerd Hoffmann 	uint32_t num_scanouts;
326bc79e964SGerd Hoffmann 	uint32_t num_capsets;
32753476e07SGerd Hoffmann };
32853476e07SGerd Hoffmann 
32953476e07SGerd Hoffmann /* simple formats for fbcon/X use */
33053476e07SGerd Hoffmann enum virtio_gpu_formats {
33153476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM  = 1,
33253476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM  = 2,
33353476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM  = 3,
33453476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM  = 4,
33553476e07SGerd Hoffmann 
33653476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM  = 67,
33753476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM  = 68,
33853476e07SGerd Hoffmann 
33953476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM  = 121,
34053476e07SGerd Hoffmann 	VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM  = 134,
34153476e07SGerd Hoffmann };
34253476e07SGerd Hoffmann 
34353476e07SGerd Hoffmann #endif
344