• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 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 #include "gfxstream/virtio-gpu-gfxstream-renderer-goldfish.h"
16 
17 #include "host-common/opengles.h"
18 #include "snapshot/common.h"
19 
stream_renderer_snapshot_presave_pause()20 VG_EXPORT int stream_renderer_snapshot_presave_pause() {
21     android_getOpenglesRenderer()->pauseAllPreSave();
22     return 0;
23 }
24 
stream_renderer_snapshot_postsave_resume()25 VG_EXPORT int stream_renderer_snapshot_postsave_resume() {
26     android_getOpenglesRenderer()->resumeAll();
27     return 0;
28 }
29 
stream_renderer_snapshot_save(void * saverStream)30 VG_EXPORT int stream_renderer_snapshot_save(void* saverStream) {
31     auto* saver = static_cast<android::snapshot::SnapshotSaveStream*>(saverStream);
32     android_getOpenglesRenderer()->save(saver->stream, saver->textureSaver);
33     return 0;
34 }
35 
stream_renderer_snapshot_load(void * loaderStream)36 VG_EXPORT int stream_renderer_snapshot_load(void* loaderStream) {
37     auto* loader = static_cast<android::snapshot::SnapshotLoadStream*>(loaderStream);
38     android_getOpenglesRenderer()->load(loader->stream, loader->textureLoader);
39     return 0;
40 }
41