36 Commits
Author SHA1 Message Date
Serdar Kocdemir 90d0347c16 Use uint8_t instead of unsigned char for screenMask data
.. to unify with other usages over the data and indicate the intent
better.

Bug: 389646068
Test: CI
Change-Id: I0d0c2f05020bbd86728abdbfebb5084b1112b657
2025-09-11 08:25:45 +00:00
Jason Macnak baa96a6945 Convert egl2egl to a feature
... to avoid having to pass around extra params.

Bug: n/a
Test: cvd create --gpu_mode=gfxstream
Change-Id: Id1bac44a576a8faf1ae8ecbaa17d6f98ca0919b4
2025-07-16 00:02:45 +00:00
Serdar Kocdemir 6308f87a93 Add support for display color transform matrix
Add new display operation callback to be able to set and get color
transform matrix, which can be used to change appearance of the
display for accessibility features.

Bug: 420586022
Test: Set color accessibility options in emulator
Test: adb shell settings put secure accessibility_display_inversion_enabled 1
Test: FrameBufferTest.SetMultiDisplayColorTransform
Change-Id: If972487785b0635bfc6ec126d950dec0cf1cd6fb
2025-07-10 23:58:52 +00:00
Jason Macnak aacd6a2b02 Remove unused header include 2025-06-17 21:04:07 +00:00
Serdar Kocdemir ced2c390cc Add setLogLevel interface
Bug: 425322724
Test: emulator -verbose
Change-Id: I0af8f7263b06826c14a99a2fbd614ecafdcd418c
2025-06-17 21:04:07 +00:00
Treehugger Robot 5c013b46bb Merge "Add missing #include for C++23 compatibility." into main 2025-05-29 14:22:25 -07:00
Jason Macnak f819fddf43 Cleanups to make internal build happy
Remove more unused files.

Moves TestClock into health, which is its only user, to avoid
having to mix testonly and non-testonly libraries. The health
target currently uses TestClock as a non-testonly library but
common/base/include/gfxstream/testing/* needs to be testonly
due to its dependency on gtest libs.

Enforce strict dependency checking in bazel
(https://bazel.build/docs/bazel-and-cpp#toolchain-features).

Split up "opengl headers" into multiple targets to better
translate to internal targets.

Bug: b/403363880
Test: bazel build ...
Change-Id: I20dd2579cca0b6ea7c2d3770afd0e6001e2e9562
2025-05-28 23:23:49 +00:00
Elliott Hughes 73cc1f23f8 Add missing #include for C++23 compatibility.
Change-Id: I2a321578d4e7e8f8dfbf2362ebb8e5b6822a2ad8
2025-05-28 16:22:31 -04:00
Jason Macnak 254e5cf2ce Add existing Gfxstream tests to Bazel
Bug: b/403363880
Test: bazel test ...
Change-Id: I5351ccde8075d279041b82d2a754aed5e37304f0
2025-05-19 17:51:38 -07:00
Jason Macnak c2b159afd1 Move logging to common
and add Android support which uses __android_log_print to
the default callback. This will allow us to eventually build
and run the guest libs in a standalone bazel environment without
Android libs (no "liblog", "libcutils", etc).

Misc notes:

 * Updates some cases of ANDROID vs __ANDROID__. The former is
   set when building with Soong (either host or guest) while the
   latter is set specifically when targeting the Android platform.
   Some places that were using ANDROID needed to be fixed to use
   __ANDROID__ to properly detect when to use ANativeWindow.

 * Updates the EGL platform header to address something similar
   to the above where we may want to use X11 display when building
   host binaries with Soong where ANDROID may still be defined.

Bug: b/416342919

Test: cd hardware/google/gfxstream
      bazel build ...
      bazel test ...

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I4db669047f3900392d50509c470ea350d94a64ba
2025-05-14 16:51:19 -07:00
Jason Macnak e4360539f2 Even more fixups found be release tool
Bug: b/403363880
Test: n/a
Change-Id: I40e2b9cbae7f4e6dfe4ad7193607aa0f7cfc4131
2025-05-09 10:22:46 -07:00
Jason Macnak d4ae528b16 Hide ASG internals from the consumer interface
Refactors Gfxstream's ASG to hide ASG internals (context init, ring
buffer, ring config, etc) from external use. The ASG consumer interface
is updated to only take the shared memory pointers as arguments and then
all of the internal ASG context / ring initialization should happen
inside of `RingStream`. This requires a little bit of refactoring
around `onUnavailableRead()` to move the unavailable read count and
to move the setting of the `asg_context::host_state` into `RingStream`.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I43cc8e55ec4ded3071c22e2cfce6fab930262a17
2025-05-07 12:35:25 -07:00
Jason Macnak 453d39675a Use Gfxstream's Stream for save/load interface
Moves several of the "common/base" classes to host/backend as these
classes all used `Stream` which is a host only interface.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...

Change-Id: Ia664776c2322b310614f632e4926bb3b031f3bc1
2025-05-07 12:35:25 -07:00
Jason Macnak cd95e6c655 Move unmap on main looper into AEMU
... as this is AEMU specific.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: Id9d3cd0fae1b7b8cd1f681b5134a4f43f7e6378b
2025-05-07 02:27:54 +00:00
Jason Macnak 11310916d9 Clean up ITextureLoader/ITextureSaver interface
by removing functions that are never used internally by Gfxstream
and that are only used by AEMU's `TextureLoader`/`TextureSaver`
implementation. Also, remove `InterruptibleThread` from the interface
and replace with callbacks that can be used to interact with Gfxstream's
internal async use in GLBackgroundLoader.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: Ia02476aa00c4a57016c94f395f5899e1f5a29316
2025-05-06 15:35:51 -07:00
Jason Macnak 4e8cb60572 Move SmallVector into Gfxstream host interface directory
... as this is a part of the Renderer/RenderChannel interface
and that interface should be completely standalone.

Also deletes a bunch of other unused files from common/base.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I466d520f0ac4be0049a7ed858d74287aefeef825
2025-05-02 18:00:39 +00:00
Jason Macnak 7e7eb0fd46 Move snapshot interface
... alongside the rest of the Gfxstream host interface.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I5db79bd3f7f6e8d776a34696f0fde3b3ef66627e
2025-04-30 03:55:26 +00:00
Jason Macnak 4b4e852b36 Cleanup references to host-common
Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I6765726663c333cd8dbbf3223e8960bec5d224d9
2025-04-28 13:06:02 +00:00
Jason Macnak 6f6f152284 Move default address space impl from h/g/aemu
... and remove some of the non-virtio gpu code paths inside
of the default implementation.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I4001dce27c2ba9d3dc3b2c9781358a8025067dda
2025-04-28 01:19:24 +00:00
Jason Macnak d0da7da0cf Migrate "misc" operations from h/g/aemu to h/h/gfxstream
Consolidates the second copy of opengl headers into common/opengl
and fixes some targets which were transitively relying on headers
via gl-host-common.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: Id6a651b746bb36da04650f62dc8c0ae7e01989cb
2025-04-28 01:18:46 +00:00
Jason Macnak cc117a3b9a Move "guest ops" from h/g/aemu to h/g/gfxstream
Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I88eac06be57d5eb0a8c9b66333c5ecbe9844a484
2025-04-25 14:48:06 +00:00
Jason Macnak 2a2f0f9e38 Move AEMU logging callback to AEMU
... so that we can "gfxstream"-ify the setLogger()
part of the renderlib interface.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: Iaba158e8826445438097ab8775bb143c875c1a9f
2025-04-24 22:11:38 +00:00
Jason Macnak 2db0c30174 Move display operations from h/g/aemu to h/g/gfxstream
and split type declarations off into render-utils as this is a
part of the RenderLib interface.

Updates FrameBuffer_unittest to use Mock'ed ops and moves
FrameBuffer_unittest next to FrameBuffer.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I2668585a0a2a8a37daaa7da97208fba250e00859
2025-04-24 22:11:38 +00:00
Jason Macnak 0040031849 Fixup bazel build
goldfish dma and goldfish sync are not a part of the gfxstream
renderer interface anymore.

Bug: b/403363880
Test: prebuilts/bazel/linux-x86_64/bazel test \
   --platforms=@//build/bazel/platforms:linux_x64 \
   //hardware/generic/goldfish/emulator:emulator_unit_tests \
   //hardware/generic/goldfish/emulator:package_goldfish_symbols \
   //hardware/generic/goldfish/emulator:release \
   //hardware/generic/goldfish/emulator:release_build_test
Change-Id: Ic4ff3a23ee008d405d7e64f6e2f4276df5c0d74d
2025-04-24 16:30:25 +00:00
Jason Macnak 93ba0bceef Move window operations from h/g/aemu to h/g/gfxstream
and split type declarations off into render-utils as this is a
part of the RenderLib interface.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: Ief42a5decdb946b4943388bd40c24bd6ca3a4cba
2025-04-22 21:01:21 +00:00
Jason Macnak f790204a2f Move vm operations from h/g/aemu to h/g/gfxstream
and split type declarations off into render-utils as this is a
part of the RenderLib interface.

Note: Makes hostmem register/unregister a no-op. These functions connect
to `HostmemIdMapping`. `HostmemIdMapping` has been effectively replaced by
`ExternalObjectManager` (originally `BlobManager`) starting in aosp/2571451
(and that change description even calls out `HostmemIdMapping` should no
longer be needed).

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: Iee4d0dca2143377b266972d2d38ec727a90c3deb
2025-04-22 16:50:16 +00:00
Jason Macnak 00c99ebdb0 Move dma devce from h/g/aemu to h/g/gfxstream
and split type declarations off into render-utils as this is a
part of the RenderLib interface.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I738b30ac926a1b3a2dfa3220ba00385e19c799b0
2025-04-22 16:50:15 +00:00
Jason Macnak ff0ca91754 Move sync devce from h/g/aemu to h/g/gfxstream
and split type declarations off into render-utils as this is a
part of the RenderLib interface.

Bug: b/403363880
Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...
Change-Id: I14f0e04b67d3a10556dc4be1b5e4404598b94f14
2025-04-20 04:56:38 +00:00
Jason Macnak 47559aa5d8 Move callback defintion into gfxstream renderer interface headers
... to continue to break up host-common dependency.

Bug: b/403363880
Test: m
Change-Id: I2fd01a995a09835321e1e30cf785252aac439991
2025-04-20 04:54:57 +00:00
Jason Macnak fd40fcd014 Remove cpu-usage/memory-tracker from Gfxstream interface
... as this is never used internally in Gfxstream.

Bug: b/403363880
Test: m
Change-Id: I70c121de21c1b65dfe8bc0e9a859a4e22374c2fc
2025-04-20 04:49:20 +00:00
Jason Macnak cacaf607aa Remove emugl feature control from Gfxstream interface
... as this is never used internally in Gfxstream.

Bug: b/403363880
Test: m
Change-Id: Iae0927eece0e82a3a8e4c690b4f6fafcedfafdbf
2025-04-20 04:37:21 +00:00
Jason Macnak 16303e9c27 Remove emugl crash report from Gfxstream interface
... as this is never used internally in Gfxstream.

Bug: b/403363880
Test: m
Change-Id: If25399e9321fd305b0ebf42e1388696463872612
2025-04-20 04:36:59 +00:00
Jason Macnak cdb72923ed Remove GLObjectCounter from Gfxstream interface
... as this is never used.

Bug: b/403363880
Test: m
Change-Id: I5a15959c1dee3c4d943fe829e734693c7e6afa6e
2025-04-20 04:36:21 +00:00
Jason Macnak e48f75a098 Move gralloc/renderer enums to gfxstream header directory
... as this is a part of the public gfxstream / RenderLib
interface.

Bug: b/403363880
Test: m
Change-Id: Iebefeb3e601c5a893022333f9a6251798e36726f
2025-04-20 04:35:43 +00:00
Jason Macnak 937ef1d2d6 Remove gl-host-common dependency on aemu/host-common
... to continue working on breaking up dependencies on
hardware/google/aemu to support a standalone build.

NO_IFTTT=renderer not snapshot/restored in context

Bug: b/403363880
Test: cvd create --gpu_mode=gfxstream
Test: cvd create --gpu_mode=gfxstream_guest_angle
Change-Id: I6378c0c1139a12f9f3ab8cede6274cf9bda85bc0
2025-04-16 10:50:38 -07:00
Jason Macnak 48da24c27e Move "render-util" headers into the server include directory
Upcoming changes hope to make the interface of the "server" more
explicity. Right now, the interface is kind of shared between the
virtio-gpu-gfxstream-renderer*.h files but also the *.h files in
hardware/google/gfxstream/include/render-utils.

Bug: b/403363880
Test: m
Change-Id: I47d60a1c4e7d6ff691595987589a522564c111c6
2025-04-14 16:01:12 -07:00