35 Commits
Author SHA1 Message Date
Serdar Kocdemir 0a0ba2b54b Add new render control functions for display color transform
New rc functions will be used from the host compositor to set a display
color transform matrix is given. This feature is used when the matrix is
set explicitly on surface flinger, or when using accessibility color
features, such as color blind modes. New functionality is added into
generate-apigen-sources code generator code to handle matrix data type.

New functions
* rcGetDisplayColorTransform: Get the matrix for the display
* rcSetDisplayColorTransform: Set the matrix for the display

Bug: 420586022
Test: Set color accessibility options in emulator
Test: ./scripts/generate-apigen-sources.sh
Change-Id: I21fa4bb4b5bbc6038f464f68c4c63eb50e46411c
2025-07-25 22:20:02 +00:00
Jason Macnak 14bffb8712 Use std::memcpy for opcode and packet len
... to avoid strict aliasing violations.
2025-06-11 23:10:29 +00:00
Jason Macnak 31adc8a3e6 Minor codegen changes
* Pragma macros are typcially not indented

 * Use GFXSTREAM_ERROR instead of fprintf

 * Update the run command in the header comments
2025-06-11 23:10:29 +00:00
Jason Macnak b595177715 Update apigen to avoid strict aliasing violations
The `tmpBuf` pointer may not necessarily meeting the alignment
requirements of the return value type.
2025-06-11 23:10:29 +00:00
Jason Macnak 3683847ab3 Move copts and defines to a common build_variables.bzl 2025-06-04 15:12:09 +00:00
Jason Macnak 352f8a4d67 Explicitly link subdirectories to top level license
Bug: b/416342919
Test: bazel build ...
Change-Id: Iebb71ac891143cf2982fb87d7d1549bf81f116a9
2025-05-30 15:40:14 +00: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
Jason Macnak d389e62b43 Update meson build files to apache2
... to ag/33650592

Bug: b/416342919
Test: n/a
Change-Id: Ica25db6c45145795d380d51cb13a89070386e333
2025-05-21 09:04:25 -07: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
Gurchetan Singh 85608ca198 gfxstream: fix meson build
Depending on the system, the opengl headers may not actually
be present.  Use internal ones.

BUG=317816825
TEST=meson build

Change-Id: Icc4a313d519a4d3f5aa5a1238fdf5e4dd74c2d79
2025-05-19 08:46:25 -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 afe8dc23a9 More findings from release tool
Bug: b/403363880
Test: n/a
Change-Id: If654b153ad385d5ae90d704a42ef1c4df1ebaa21
2025-05-09 10:22:46 -07:00
Jason Macnak 2da8e932f1 Fixup more licensing finding
Bug: b/403363880
Test: n/a
Change-Id: I65a0ca10f4867bd81c02a613b00c7fde7deeeb6a
2025-05-09 10:22:46 -07:00
Jason Macnak f96a59449c Add license headers to our cmake files
... as this is flagged by the release checker.

Bug: b/403363880
Test: n/a
Change-Id: I3743a2e710ddf7dfd196cb7d53f25eeaeab921f0
2025-05-08 13:50:49 -07:00
Jason Macnak d2de457391 Add apache header to apigen sources
Bug: b/403363880
Test: n/a
Change-Id: I88968b9231ed387dfe752760d9321a29997a7b0e
2025-05-08 12:21:45 -07:00
Jason Macnak 9ff6a7307e Cleanup third party
* Rename third-party to third_party

 * Move drm, opengl, vulkan, x11 headers to third_party

 * Remove virgl_hw.h since we only use a couple enums

... as part of the releasing checklist.

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: I078c9ae21e427ea67d5f51eabf63cd9d4689024c
2025-05-08 12:17:50 -07:00
Jason Macnak 9e1bd207bf Add clang toolchain registration to gfxstream module
... and fix default visibility.

After this, Gfxstream can be built entirely standalone with

  mkdir gfxstream
  cd gfxstream
  git clone <gfxstream url> .
  blaze build ...
  blaze test ...

Bug: b/403363880
Test: see above
Change-Id: Ibc1098f04fe7a062fe9d17feee95149731ae2f6b
2025-05-08 12:17:49 -07:00
Jason Macnak d4ffa9a5bc Normalize some directory names and includes
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: I0d4aa852da43ed3b2a411181689876c8b78f5367
2025-05-07 12:35:39 -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 b001c743d3 Update non interface parts of Gfxstream to use new base lib
NO_IFTTT=existing field covered with type change

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: I6bfb2c4ef8368799d9f99f6293d9762b7dcb4c7f
2025-05-01 16:29:17 +00:00
Jason Macnak 498ce2c768 Move iostream out of the "server" headers directory
... as this is a host-only impl header and not part of the public
Gfxstream 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: I23d12d7ab4106ae5aa6c6a9fdf164bb644356580
2025-04-14 16:01:12 -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
Jason Macnak 0fce07445a Make Gfxstream a bazel module
... so that it can be built outside of any AOSP trees where the
path may not be hardware/google/gfxstream.

Bug: b/403363880
Test: emu bazel build
Change-Id: Iabc69c7a9661ff744fa42a27625a53794fdc78bd
2025-03-18 08:20:54 -07:00
Erwin Jansen b45c014871 Enable GFXStream bazel build
This builds the "standalone" GFXStream library that can be consumed by
Qemu 8.2

The bazel build allows us to transition rutabaga to a bazel based
build, which will unify the Qemu 8.2 build as used by the emulator.

It also opens up the path to migrate this to g3 if we decide to do this.

This change forces a few header changes, as bazel is more strict about
the relationship between headers and packages, and doesn't easily give
you fine grained control over the include paths.

Change-Id: I3566d69f10c534f1176fa92eaa7f5f12ec0bcd4f
2024-03-20 18:21:20 -07:00
Jason Macnak e17ba9bf34 Format Android.bp files
with:

  cd hardware/google/gfxstream
  bpfmt -w .

Bug: n/a
Test: presubmit
Change-Id: I7ddc78f076eacf8459b588d08caee470900e692e
2024-02-27 16:29:33 -08:00
Jason Macnak b808eeba14 Normalize some Gfxstream library names
Bug: n/a
Test: presubmit
Change-Id: Ic1122241af0dd72800ec984adcb00175d3ae2737
2024-02-27 16:29:32 -08:00
Gurchetan Singh 7328390dde gfxstream: introduce inc_gfxstream_include
This adds an extra include path. "inc_include" is now for
Mesa include.

BUG=296903491
TEST=compile

Change-Id: Ice31274e436957e0c3daa69d8efe7588bc97ccee
2024-01-18 17:48:38 -08: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 8ca8546716 gfxstream: host_cpp_args in meson build
More descriptive.

BUG=311486792
TEST=compile

Change-Id: Icdd015f9a9afc78290f4ddd9925fcbb40d914680
2024-01-17 11:17:37 -08:00
Jason Macnak 14986c5b04 Make GL header lib and update libs to explicitly depend on it
Bug: b/293897204
Test: cd hardware/google/gfxstream && mma
Change-Id: Idfef6f99e6f4b8c008e67ac307e8cd782c929a6f
2023-11-15 11:13:09 -08:00
Gurchetan Singh 55bfba43ff gfxstream: update for new AEMU include model
Modify package config file names, and be more rigorous
about where to look.

BUG=273561059
TEST=compile

Change-Id: I895733da8cb52abe84904caf25b151bb215bdae0
2023-09-14 17:57:30 +00:00
C Stout d56201ffc9 [meson] More build fixing
BUG=202552093
TEST=compile

Change-Id: Id6dff069824b820ae4cc24bbb64a442ee7371bf3
2023-07-20 18:25:45 -07:00
Gurchetan Singh 0ac5f1c2ed gfxstream: add meson build
Right now, gfxstream downloads dependencies it needs via CMake
`FetchContent`, and that's generally in-advisable when writing
a package for distribution.

The CMake build also exports libraries and symbols that ideally
should be kept internal to gfxstream (like opengles.cpp symbols).
This is due to AEMU CMake compatibility, but even upstream
QEMU has moved to a meson based system. Meson should work well
on Unix systems, and Windows the standard strategy is to use a
mingw cross-compiler.

This allows gfxstream to be a completely external and versioned
dependency.

Note, tests were not compiled and only Linux has been tested so
far.  Also, meson configure -Ddecoders=auto is recommended until
decoder specific code can be further isolated.

BUG=284306280
TEST=Compile using the following options:

(Linux dependencies)
sudo apt-get install libdrm
sudo apt-get install libglm-dev
sudo apt-get install libstb-dev

mkdir aemu-build
(in platform/hardware/google/aemu)
cmake -DAEMU_COMMON_GEN_PKGCONFIG=ON -DAEMU_COMMON_BUILD_CONFIG=gfxstream
      -DENABLE_VKCEREAL_TESTS=OFF . ../
make -j && sudo make install

(in gfxstream)
mkdir amd64-build
meson -Ddefault_library=static amd64-build/
ninja -C amd64-build
sudo ninja -C amd64-build/ install

Change-Id: I1722d84e4810ec5e3377797b6951cef4209c278e
2023-06-07 09:09:56 -07:00
Jason Macnak 16135796e7 Merge remote-tracking branch 'aosp/master' into 'aosp/temp-consolidate-gfxstream-projects'
... for device/generic/vulkan-cereal to consolidate
Gfxstream code into hardware/google/gfxstream.

Bug: b/271464937
Test: lunch aosp_cf_x86_64_phone-userdebug && m
Test: python android/build/python/cmake.py --gfxstream
Change-Id: I086a5e26324072e7348222ecd6b4c0f896ffd895
2023-05-23 15:32:09 -07: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