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(bool multi_clients, 46 int ctx_flags, 47 const char *render_device); 48 void vtest_cleanup_renderer(void); 49 50 int vtest_create_context(struct vtest_input *input, int out_fd, 51 uint32_t length_dw, struct vtest_context **out_ctx); 52 int vtest_lazy_init_context(struct vtest_context *ctx); 53 void vtest_destroy_context(struct vtest_context *ctx); 54 55 void vtest_poll_context(struct vtest_context *ctx); 56 int vtest_get_context_poll_fd(struct vtest_context *ctx); 57 58 void vtest_set_current_context(struct vtest_context *ctx); 59 60 int vtest_send_caps(uint32_t length_dw); 61 int vtest_send_caps2(uint32_t length_dw); 62 int vtest_create_resource(uint32_t length_dw); 63 int vtest_create_resource2(uint32_t length_dw); 64 int vtest_resource_unref(uint32_t length_dw); 65 int vtest_submit_cmd(uint32_t length_dw); 66 67 int vtest_transfer_get(uint32_t length_dw); 68 int vtest_transfer_get_nop(uint32_t length_dw); 69 int vtest_transfer_get2(uint32_t length_dw); 70 int vtest_transfer_get2_nop(uint32_t length_dw); 71 int vtest_transfer_put(uint32_t length_dw); 72 int vtest_transfer_put_nop(uint32_t length_dw); 73 int vtest_transfer_put2(uint32_t length_dw); 74 int vtest_transfer_put2_nop(uint32_t length_dw); 75 76 int vtest_block_read(struct vtest_input *input, void *buf, int size); 77 int vtest_buf_read(struct vtest_input *input, void *buf, int size); 78 79 int vtest_resource_busy_wait(uint32_t length_dw); 80 int vtest_resource_busy_wait_nop(uint32_t length_dw); 81 void vtest_poll_resource_busy_wait(void); 82 83 int vtest_ping_protocol_version(uint32_t length_dw); 84 int vtest_protocol_version(uint32_t length_dw); 85 86 /* since protocol version 3 */ 87 int vtest_get_param(uint32_t length_dw); 88 int vtest_get_capset(uint32_t length_dw); 89 int vtest_context_init(uint32_t length_dw); 90 int vtest_resource_create_blob(uint32_t length_dw); 91 92 int vtest_sync_create(uint32_t length_dw); 93 int vtest_sync_unref(uint32_t length_dw); 94 int vtest_sync_read(uint32_t length_dw); 95 int vtest_sync_write(uint32_t length_dw); 96 int vtest_sync_wait(uint32_t length_dw); 97 98 int vtest_submit_cmd2(uint32_t length_dw); 99 100 void vtest_set_max_length(uint32_t length); 101 102 #endif 103 104