5 Commits
Author SHA1 Message Date
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 a43dfa9f3c Add gfxstream host logging lib
... to eventually replace the existing host-common/logging. This
is needed to break up the circular dependency between aemu-base and
aemu-host-common, so that we can move parts of aemu-base and
aemu-host-common into hardware/google/gfxstream, in order to make
Gfxstream a self contained library for building.

Hooks up the existing host-common/logging via the
RenderLibImpl::setLogger() call.

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: Id52c6f756f85d0a5fb948601228234d7a84a14c2
2025-04-09 13:11:08 -07:00
Serdar Kocdemir 4a181f3478 Use const reference argument for onDeviceCreated
.. to avoid unnecessary copies of the large structure.

Bug: N/A
Test: CI
Change-Id: I2af1085edc9bd15751c04b20a92502d69c303ef9
2025-02-24 18:20:52 +00:00
Jason Macnak bb9e296745 Add device registry to DeviceLostHelper
... in order to break the need for locking on device lost in
VkDecoderGlobalState.

b/240788417 updated `VkDecoderGlobalState` to use a recursive mutex
because `on_DeviceLost()` could potentially be called via VK_CHECK
and the callback needed to find all of the devices+queues that should
be checked for potentially unfinished command buffers. However,
std::recursive_mutex prevents thread safety annotations. Instead,
DeviceLostHelper should be a thread-safe standalone object that can
be called into regardless of the current state.

Bug: b/383139165
Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader
Change-Id: Iafbb2bd0852b11ef42bcbf21ef9adcb35a5fb058
2024-12-12 17:11:41 -08:00
Jason Macnak 05eaa8ee9b Adds helper for tracking command buffers with device lost
... which was useful for debugging b/347288539.

Bug: b/347288539
Test: cvd start \
 --gpu_mode=gfxstream_guest_angle \
 --gpu_renderer_features=VulkanCommandBufferCheckpoints:enabled
Change-Id: I8056ba820a1c28410d94fa56608f38fbf0328148
2024-07-09 09:42:54 -07:00