Path: blob/21.2-virgl/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
4566 views
/*1* Copyright 2014, 2015 Red Hat.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* on the rights to use, copy, modify, merge, publish, distribute, sub7* license, and/or sell copies of the Software, and to permit persons to whom8* the Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20* USE OR OTHER DEALINGS IN THE SOFTWARE.21*/22#ifndef VIRGL_DRM_WINSYS_H23#define VIRGL_DRM_WINSYS_H2425#include <stdint.h>26#include "pipe/p_compiler.h"27#include "pipe/p_defines.h"28#include "pipe/p_state.h"29#include "util/list.h"30#include "os/os_thread.h"3132#include "virgl/virgl_winsys.h"33#include "vtest/vtest_protocol.h"34#include "virgl_resource_cache.h"3536struct pipe_fence_handle;37struct sw_winsys;38struct sw_displaytarget;3940struct virgl_vtest_winsys {41struct virgl_winsys base;4243struct sw_winsys *sws;4445/* fd to remote renderer */46int sock_fd;4748struct virgl_resource_cache cache;49mtx_t mutex;5051unsigned protocol_version;52};5354struct virgl_hw_res {55struct pipe_reference reference;56uint32_t res_handle;57int num_cs_references;5859void *ptr;60int size;6162uint32_t format;63uint32_t stride;64uint32_t width;65uint32_t height;6667struct sw_displaytarget *dt;68void *mapped;6970uint32_t bind;71struct virgl_resource_cache_entry cache_entry;72};7374struct virgl_vtest_cmd_buf {75struct virgl_cmd_buf base;76uint32_t *buf;77unsigned nres;78unsigned cres;79struct virgl_winsys *ws;80struct virgl_hw_res **res_bo;8182char is_handle_added[512];83unsigned reloc_indices_hashlist[512];84};8586static inline struct virgl_hw_res *87virgl_hw_res(struct pipe_fence_handle *f)88{89return (struct virgl_hw_res *)f;90}9192static inline struct virgl_vtest_winsys *93virgl_vtest_winsys(struct virgl_winsys *iws)94{95return (struct virgl_vtest_winsys *)iws;96}9798static inline struct virgl_vtest_cmd_buf *99virgl_vtest_cmd_buf(struct virgl_cmd_buf *cbuf)100{101return (struct virgl_vtest_cmd_buf *)cbuf;102}103104105int virgl_vtest_connect(struct virgl_vtest_winsys *vws);106int virgl_vtest_send_get_caps(struct virgl_vtest_winsys *vws,107struct virgl_drm_caps *caps);108109int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws,110uint32_t handle,111enum pipe_texture_target target,112uint32_t format,113uint32_t bind,114uint32_t width,115uint32_t height,116uint32_t depth,117uint32_t array_size,118uint32_t last_level,119uint32_t nr_samples,120uint32_t size,121int *out_fd);122123int virgl_vtest_send_resource_unref(struct virgl_vtest_winsys *vws,124uint32_t handle);125int virgl_vtest_submit_cmd(struct virgl_vtest_winsys *vtws,126struct virgl_vtest_cmd_buf *cbuf);127128int virgl_vtest_send_transfer_get(struct virgl_vtest_winsys *vws,129uint32_t handle,130uint32_t level, uint32_t stride,131uint32_t layer_stride,132const struct pipe_box *box,133uint32_t data_size,134uint32_t offset);135136int virgl_vtest_send_transfer_put(struct virgl_vtest_winsys *vws,137uint32_t handle,138uint32_t level, uint32_t stride,139uint32_t layer_stride,140const struct pipe_box *box,141uint32_t data_size,142uint32_t offset);143144int virgl_vtest_send_transfer_put_data(struct virgl_vtest_winsys *vws,145void *data,146uint32_t data_size);147int virgl_vtest_recv_transfer_get_data(struct virgl_vtest_winsys *vws,148void *data,149uint32_t data_size,150uint32_t stride,151const struct pipe_box *box,152uint32_t format);153154int virgl_vtest_busy_wait(struct virgl_vtest_winsys *vws, int handle,155int flags);156#endif157158159