34 Commits
Author SHA1 Message Date
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
Serdar Kocdemir ced2c390cc Add setLogLevel interface
Bug: 425322724
Test: emulator -verbose
Change-Id: I0af8f7263b06826c14a99a2fbd614ecafdcd418c
2025-06-17 21:04:07 +00:00
Serdar Kocdemir ca38754fdd Add envvar control for setting the log levels
With recent logging related changes, goldfish lost ability to get
verbose logs from gfxstream. This CL allows using GFXSTREAM_LOG_LEVEL
and GFXSTREAM_LOG_VERBOSE environment variables to set the level.
Follow up CLs on qemu will be done to set the envvar correctly
when legacy envvars or -verbose command line option is given.

Bug: 425322724
Test: GFXSTREAM_LOG_LEVEL=verbose emulator
Change-Id: I2ebb1715e9fe4a0743e2f942c8950eca6d720598
2025-06-17 21:04:07 +00: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 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 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 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 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 550ddd6600 Use reference type for FeatureSet arguments
FeautreSet is a large structure with lots of strings, better
to not copy around unnecessarily.

Bug: N/A
Test: build
Change-Id: I604b4ad7af01f222b54dcda4cd2299e350324f50
2025-03-27 14:47:51 +00:00
Erwin Jansen 6b0e5abc9b Standardize logging
This standardizes the logging so guests can inject a callback that can
log to the abseil framework.

Bug: 358381877
Change-Id: Idb485959301168cfddb661634cbbf2b0bec8d4b7
2024-08-27 17:22:14 -07:00
Gurchetan Singh c9ffbcec72 Revert "Enable GraphicsObjectCounter in PerfStatReporter"
aosp/3221062 introduces a new AEMU "GraphicsObjectCounter"
API.  This would only work the QEMU 2.12 Emulator since
that's the only code that uses the studio stats proto.

This breaks the build of gfxstream against AEMUv0.1.2,
which is exists so clients don't have to update that library
for features specific to an older emulator version:

https://crosvm.dev/book/appendix/rutabaga_gfx.html#install-libaemu

BUG=317816825
TEST=meson build

Change-Id: I1de98f97e30a46de7c4b47bc6ceb7328e3facff7
2024-08-23 13:49:16 -07:00
sergiuferentz ecaa82126f Enable GraphicsObjectCounter in PerfStatReporter
* Integrate the object counter into perfstatreporter
* Report color buffer count as proof of concept statistic

Test: run emulator with -perf-stat perf_stat.txt and notice the string
'graphics_resource_usage { colorbuffer_count: 105 }'

Bug:356817108
Change-Id: Ic471c87442ce10520e54f6e1bf542ee56307ba9c
2024-08-20 14:39:37 +01:00
Joshua Duong 8a6d74c455 [qemu] Call address_space_set_vm_operations in RenderLib.
This is a hack because qemu's implementation is not using
virtio-gpu-gfxstream-renderer APIs yet, so
address_space_set_vm_operations was never called in gfxstream
space, which causes a null pointer dereference when using
asg.

Bug: 339461355
Test: Boot emulator with minigbm build
Change-Id: Ifaf3fc3d775079cae406152006c611635bc200f4
2024-06-03 20:33:36 +00:00
Jason Macnak 2687212e49 Introduce Gfxstream Features to decouple Gfxstream from AEMU
... which will allow building Gfxstream from a fixed version of
AEMU for the purposes of packaging.

Bug: b/326648397
Test: cvd start --gpu_mode=gfxstream
Test: cvd start --gpu_mode=gfxstream_guest_angle
Change-Id: I8ac1622428f0194997597868bef49118bcc3ea90
2024-03-18 15:50:46 -07:00
Gurchetan Singh 95b30dc862 Reland "gfxstream: introduce GFXSTREAM_ENABLE_HOST_GLES compiler flag"
Same as before, but added extra GFXSTREAM_ENABLE_HOST_GLES
to keep MacOS builders happy.

Change-Id: I333503ecb6e67840326ce248428fa097eb152e92
2024-01-18 18:34:08 -08:00
Gurchetan Singh 6ed12e9d66 Revert "gfxstream: introduce GFXSTREAM_ENABLE_HOST_GLES compiler flag"
This reverts commit 4675a9d4ef.

Reason for revert: I suppose it breaks MacOS

Change-Id: I91bef5c2fa0e8726b6e77e6678540b808ad26316
2024-01-19 02:19:50 +00:00
Gurchetan Singh 4675a9d4ef gfxstream: introduce GFXSTREAM_ENABLE_HOST_GLES compiler flag
This allows:

meson -Ddecoders=vulkan

to build without errors.  This is useful for enviroments where
GLES does not exist (Fuchsia) or where importing the entire
gfxstream GLES decoder is undesirable.

BUG=31148679
TEST=compile

Change-Id: I59e385c205588a4dbbe472fac1681ebe261127dc
2024-01-17 18:13:22 -08:00
Gurchetan Singh 527ffa557c gfxstream: add CONFIG_AEMU to logger statements
Not necessary for crosvm or upstream QEMU:
STREAM_RENDERER_PARAM_DEBUG_CALLBACK is already well-integrated
into respective VMMs.

BUG=317816825
TEST=meson build still works with older AEMU lib

Change-Id: I95599e6fb0c75a8856f29b78cc6963bf71b17ba1
2023-12-26 15:58:42 -08:00
Yahan Zhou 398166fe04 Re-enable logger setup
We need more logs in crash reports to debug graphics initialization
failures.

Bug: 314841455
Change-Id: Id40871b439de4a16885ac3673443db37b95ccecf
2023-12-06 14:11:49 -08:00
Jason Macnak 648a9edc06 Rename stream-servers to host
Bug: b/271464937
Test: m
Change-Id: I89553dfe2e27170e1e968e234b364f13e76b2f88
2023-05-19 15:09:46 -07:00