• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2024 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <vector>
18 
19 #include "aemu/base/containers/EntityManager.h"
20 
21 namespace gfxstream {
22 namespace vk {
23 
24 using VkSnapshotApiCallHandle = uint64_t;
25 
26 struct VkSnapshotApiCallInfo {
27     VkSnapshotApiCallHandle handle = -1;
28 
29     // Raw packet from VkDecoder.
30     std::vector<uint8_t> packet;
31 
32     // Book-keeping for which handles were created by this API
33     std::vector<uint64_t> createdHandles;
34 
35     // Extra boxed handles created for this API call that are not identifiable
36     // solely from the API parameters itself. For example, the extra boxed `VkQueue`s
37     // that are created during `vkCreateDevice()` can not be identified from the
38     // parameters to `vkCreateDevice()`.
39     //
40     // TODO: remove this and require that all of the `new_boxed_*()` take a
41     // `VkSnapshotApiCallInfo` as an argument so the creation order of the boxed
42     // handles in `createdHandles` is guaranteed to match the replay order. For now,
43     // this relies on careful manual ordering.
44     std::vector<uint64_t> extraCreatedHandles;
45 
addOrderedBoxedHandlesCreatedByCallVkSnapshotApiCallInfo46     void addOrderedBoxedHandlesCreatedByCall(const uint64_t* boxedHandles,
47                                              uint32_t boxedHandlesCount) {
48         extraCreatedHandles.insert(extraCreatedHandles.end(), boxedHandles,
49                                    boxedHandles + boxedHandlesCount);
50     }
51 };
52 
53 using VkSnapshotApiCallManager = android::base::EntityManager<32, 16, 16, VkSnapshotApiCallInfo>;
54 
55 }  // namespace vk
56 }  // namespace gfxstream