Path: blob/21.2-virgl/src/amd/common/ac_msgpack.h
7099 views
/*1* Copyright 2021 Advanced Micro Devices, Inc.2* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* on the rights to use, copy, modify, merge, publish, distribute, sub8* license, and/or sell copies of the Software, and to permit persons to whom9* the Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL18* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,19* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR20* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE21* USE OR OTHER DEALINGS IN THE SOFTWARE.22*23*/2425#ifndef AC_MSGPACK_H26#define AC_MSGPACK_H2728struct ac_msgpack {29uint8_t *mem;30uint32_t mem_size;31uint32_t offset;32};3334void ac_msgpack_init(struct ac_msgpack *msgpack);35void ac_msgpack_destroy(struct ac_msgpack *msgpack);36int ac_msgpack_resize_if_required(struct ac_msgpack *msgpack,37uint32_t data_size);38void ac_msgpack_add_fixmap_op(struct ac_msgpack *msgpack, uint32_t n);39void ac_msgpack_add_fixarray_op(struct ac_msgpack *msgpack, uint32_t n);40void ac_msgpack_add_fixstr(struct ac_msgpack *msgpack, char *str);41void ac_msgpack_add_uint(struct ac_msgpack *msgpack, uint64_t val);42void ac_msgpack_add_int(struct ac_msgpack *msgpack, int64_t val);4344#endif454647