• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright (C) 2015 Red Hat Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * 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 OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  **************************************************************************/
24 
25 #ifndef VTEST_H
26 #define VTEST_H
27 
28 #include <errno.h>
29 
30 struct vtest_context;
31 
32 struct vtest_buffer {
33    const char *buffer;
34    int size;
35 };
36 
37 struct vtest_input {
38    union {
39       int fd;
40       struct vtest_buffer *buffer;
41    } data;
42    int (*read)(struct vtest_input *input, void *buf, int size);
43 };
44 
45 int vtest_init_renderer(int ctx_flags, const char *render_device);
46 void vtest_cleanup_renderer(void);
47 
48 int vtest_create_context(struct vtest_input *input, int out_fd,
49                          uint32_t length_dw, struct vtest_context **out_ctx);
50 int vtest_lazy_init_context(struct vtest_context *ctx);
51 void vtest_destroy_context(struct vtest_context *ctx);
52 
53 void vtest_set_current_context(struct vtest_context *ctx);
54 
55 int vtest_send_caps(uint32_t length_dw);
56 int vtest_send_caps2(uint32_t length_dw);
57 int vtest_create_resource(uint32_t length_dw);
58 int vtest_create_resource2(uint32_t length_dw);
59 int vtest_resource_unref(uint32_t length_dw);
60 int vtest_submit_cmd(uint32_t length_dw);
61 
62 int vtest_transfer_get(uint32_t length_dw);
63 int vtest_transfer_get_nop(uint32_t length_dw);
64 int vtest_transfer_get2(uint32_t length_dw);
65 int vtest_transfer_get2_nop(uint32_t length_dw);
66 int vtest_transfer_put(uint32_t length_dw);
67 int vtest_transfer_put_nop(uint32_t length_dw);
68 int vtest_transfer_put2(uint32_t length_dw);
69 int vtest_transfer_put2_nop(uint32_t length_dw);
70 
71 int vtest_block_read(struct vtest_input *input, void *buf, int size);
72 int vtest_buf_read(struct vtest_input *input, void *buf, int size);
73 
74 int vtest_resource_busy_wait(uint32_t length_dw);
75 int vtest_renderer_create_fence(void);
76 int vtest_poll(void);
77 
78 int vtest_ping_protocol_version(uint32_t length_dw);
79 int vtest_protocol_version(uint32_t length_dw);
80 
81 /* since protocol version 3 */
82 int vtest_get_param(uint32_t length_dw);
83 int vtest_get_capset(uint32_t length_dw);
84 int vtest_context_init(uint32_t length_dw);
85 
86 void vtest_set_max_length(uint32_t length);
87 
88 #endif
89 
90