gfxstream: move generate-gfxstream-vulkan.sh script

This moves the generate-gfxstream-vulkan.sh script
to upstream Mesa too.  Right now, Mesa is the source
of truth for both guest and host codegen.

There needs to be a simple way to invoke genvk.py
for users.  The script assumes the AOSP directory
structure to find gfxstream host, but the user may
also pass the path to gfxstream as the first argument.

Please run this from the src/gfxstream/codegen directory.

Reviewed-by: Marcin Radomski <dextero@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31775>
This commit is contained in:
Gurchetan Singh 2024-10-17 17:03:32 -07:00 committed by Marge Bot
parent b318fbbd42
commit ceefcbecd5

View file

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright 2022 Android Open Source Project
# SPDX-License-Identifier: MIT
# Please run this from the Mesa codegen directory
# >> cd ${mesa_dir}/src/gfxstream/codegen
# >> ./generate-gfxstream-vulkan.sh ${gfxstream_dir}
#
# Note in AOSP, ${gfxstream_dir} is optional, and the script autodetects the
# path to gfxstream.
export MESA_DIR="$PWD/../../.."
if [ -z "$1" ];
then
export GFXSTREAM_DIR="$MESA_DIR/../../hardware/google/gfxstream"
else
export GFXSTREAM_DIR="$1"
fi
export PREFIX_DIR="src/gfxstream"
# We should use just use one vk.xml eventually..
export VK_MESA_XML="$MESA_DIR/src/vulkan/registry/vk.xml"
export VK_XML="$GFXSTREAM_DIR/codegen/vulkan/vulkan-docs-next/xml/vk.xml"
export GFXSTREAM_GUEST_ENCODER_DIR="/tmp/"
export GFXSTREAM_HOST_DECODER_DIR="$GFXSTREAM_DIR/host/vulkan"
export GFXSTREAM_OUTPUT_DIR="$GFXSTREAM_HOST_DECODER_DIR/cereal"
export GFXSTREAM_SCRIPTS_DIR="$GFXSTREAM_DIR/scripts"
export GEN_VK="$MESA_DIR/$PREFIX_DIR/codegen/scripts/genvk.py"
export CUSTOM_XML="$MESA_DIR/$PREFIX_DIR/codegen/xml/vk_gfxstream.xml"
python3 "$GEN_VK" -registry "$VK_XML" -registryGfxstream "$CUSTOM_XML" cereal -o "$GFXSTREAM_OUTPUT_DIR"
export CEREAL_VARIANT=guest
export GFXSTREAM_GUEST_ENCODER_DIR="$GFXSTREAM_DIR/guest/vulkan_enc"
python3 "$GEN_VK" -registry "$VK_MESA_XML" -registryGfxstream "$CUSTOM_XML" cereal -o /tmp/
# Should have a unified headers dir here:
python3 "$GEN_VK" -registry "$CUSTOM_XML" vulkan_gfxstream.h -o "$GFXSTREAM_GUEST_ENCODER_DIR"
python3 "$GEN_VK" -registry "$CUSTOM_XML" vulkan_gfxstream.h -o "$GFXSTREAM_HOST_DECODER_DIR"