xref: /aosp_15_r20/external/virglrenderer/src/vrend_object.h (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1*bbecb9d1SAndroid Build Coastguard Worker /**************************************************************************
2*bbecb9d1SAndroid Build Coastguard Worker  *
3*bbecb9d1SAndroid Build Coastguard Worker  * Copyright (C) 2014 Red Hat Inc.
4*bbecb9d1SAndroid Build Coastguard Worker  *
5*bbecb9d1SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
6*bbecb9d1SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
7*bbecb9d1SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
8*bbecb9d1SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9*bbecb9d1SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
10*bbecb9d1SAndroid Build Coastguard Worker  * Software is furnished to do so, subject to the following conditions:
11*bbecb9d1SAndroid Build Coastguard Worker  *
12*bbecb9d1SAndroid Build Coastguard Worker  * The above copyright notice and this permission notice shall be included
13*bbecb9d1SAndroid Build Coastguard Worker  * in all copies or substantial portions of the Software.
14*bbecb9d1SAndroid Build Coastguard Worker  *
15*bbecb9d1SAndroid Build Coastguard Worker  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16*bbecb9d1SAndroid Build Coastguard Worker  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*bbecb9d1SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18*bbecb9d1SAndroid Build Coastguard Worker  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19*bbecb9d1SAndroid Build Coastguard Worker  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20*bbecb9d1SAndroid Build Coastguard Worker  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21*bbecb9d1SAndroid Build Coastguard Worker  * OTHER DEALINGS IN THE SOFTWARE.
22*bbecb9d1SAndroid Build Coastguard Worker  *
23*bbecb9d1SAndroid Build Coastguard Worker  **************************************************************************/
24*bbecb9d1SAndroid Build Coastguard Worker 
25*bbecb9d1SAndroid Build Coastguard Worker #ifndef VREND_OBJECT_H
26*bbecb9d1SAndroid Build Coastguard Worker #define VREND_OBJECT_H
27*bbecb9d1SAndroid Build Coastguard Worker 
28*bbecb9d1SAndroid Build Coastguard Worker #include "virgl_protocol.h"
29*bbecb9d1SAndroid Build Coastguard Worker 
30*bbecb9d1SAndroid Build Coastguard Worker struct vrend_resource;
31*bbecb9d1SAndroid Build Coastguard Worker 
32*bbecb9d1SAndroid Build Coastguard Worker struct util_hash_table *vrend_object_init_ctx_table(void);
33*bbecb9d1SAndroid Build Coastguard Worker void vrend_object_fini_ctx_table(struct util_hash_table *ctx_hash);
34*bbecb9d1SAndroid Build Coastguard Worker 
35*bbecb9d1SAndroid Build Coastguard Worker void vrend_object_remove(struct util_hash_table *handle_hash, uint32_t handle, enum virgl_object_type obj);
36*bbecb9d1SAndroid Build Coastguard Worker void *vrend_object_lookup(struct util_hash_table *handle_hash, uint32_t handle, enum virgl_object_type obj);
37*bbecb9d1SAndroid Build Coastguard Worker uint32_t vrend_object_insert(struct util_hash_table *handle_hash,
38*bbecb9d1SAndroid Build Coastguard Worker                              void *data,
39*bbecb9d1SAndroid Build Coastguard Worker                              uint32_t handle,
40*bbecb9d1SAndroid Build Coastguard Worker                              enum virgl_object_type type);
41*bbecb9d1SAndroid Build Coastguard Worker 
42*bbecb9d1SAndroid Build Coastguard Worker void vrend_object_set_destroy_callback(int type, void (*cb)(void *));
43*bbecb9d1SAndroid Build Coastguard Worker 
44*bbecb9d1SAndroid Build Coastguard Worker struct util_hash_table *vrend_ctx_resource_init_table(void);
45*bbecb9d1SAndroid Build Coastguard Worker void vrend_ctx_resource_fini_table(struct util_hash_table *res_hash);
46*bbecb9d1SAndroid Build Coastguard Worker 
47*bbecb9d1SAndroid Build Coastguard Worker void vrend_ctx_resource_insert(struct util_hash_table *res_hash,
48*bbecb9d1SAndroid Build Coastguard Worker                                uint32_t res_id,
49*bbecb9d1SAndroid Build Coastguard Worker                                struct vrend_resource *res);
50*bbecb9d1SAndroid Build Coastguard Worker void vrend_ctx_resource_remove(struct util_hash_table *res_hash,
51*bbecb9d1SAndroid Build Coastguard Worker                                uint32_t res_id);
52*bbecb9d1SAndroid Build Coastguard Worker struct vrend_resource *vrend_ctx_resource_lookup(struct util_hash_table *res_hash,
53*bbecb9d1SAndroid Build Coastguard Worker                                                  uint32_t res_id);
54*bbecb9d1SAndroid Build Coastguard Worker 
55*bbecb9d1SAndroid Build Coastguard Worker #endif
56