Skip to content

Commit

Permalink
will this work?
Browse files Browse the repository at this point in the history
changes for pojav
  • Loading branch information
SolDev69 committed Mar 4, 2024
1 parent 725ee64 commit 0769fd8
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 135 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build Android

on:
[push, pull_request]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
strategy:
matrix:
arch: [ "arm32", "aarch64" ]
fail-fast: false

name: "Build for ${{matrix.arch}}"

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Build
run: |
sudo apt update
sudo apt install -y meson libxrandr-dev libxxf86vm-dev libxcb-*-dev libx11-xcb-dev libxfixes-dev libdrm-dev libx11-dev
pip3 install mako
export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk-bundle"
envsubst <android-drm-${{matrix.arch}} >build-crossfile-drm
git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.git
cd drm
meson setup "build-android" \
--prefix=/tmp/drm-static \
--cross-file "../build-crossfile-drm" \
-Ddefault_library=static \
-Dintel=disabled \
-Dradeon=disabled \
-Damdgpu=disabled \
-Dnouveau=disabled \
-Dvmwgfx=disabled \
-Dfreedreno=disabled \
-Dvc4=disabled \
-Detnaviv=disabled
ninja -C "build-android" install
cd ..
envsubst <android-${{matrix.arch}} >build-crossfile
meson setup "build-android" \
--prefix=/tmp/pan \
-Dtools=panfrost \
--cross-file "build-crossfile" \
-Dplatforms=android \
-Dplatform-sdk-version=26 \
-Dandroid-stub=true \
-Dllvm=disabled \
-Dxlib-lease=disabled \
-Degl=disabled \
-Dgbm=disabled \
-Dglx=disabled \
-Dopengl=true \
-Dosmesa=true \
-Dvulkan-drivers= \
-Dgallium-drivers=swrast,panfrost \
-Dshared-glapi=false \
-Dbuildtype=debug \
-Dandroid-libbacktrace=disabled
ninja -C "build-android" install
- name: Upload libraries
uses: actions/upload-artifact@v2
with:
name: panfrost_${{matrix.arch}}
path: /tmp/pan
60 changes: 0 additions & 60 deletions .github/workflows/macos.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/android_stub/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if with_android_stub
stub_libs = []
lib_names = ['cutils', 'hardware', 'log', 'nativewindow', 'sync']
lib_names = ['hardware', 'log', 'nativewindow', 'sync']

if with_libbacktrace
lib_names += ['backtrace']
Expand Down
17 changes: 17 additions & 0 deletions src/gallium/auxiliary/target-helpers/inline_sw_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include "d3d12/d3d12_public.h"
#endif

#ifdef GALLIUM_PANFROST
#include "panfrost/pan_public.h"
#endif

static inline struct pipe_screen *
sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
{
Expand Down Expand Up @@ -62,6 +66,19 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
screen = d3d12_create_dxcore_screen(winsys, NULL);
#endif

#if defined(GALLIUM_PANFROST)
if(screen == NULL && strcmp(driver, "panfrost") == 0) {
int kbase_device_fd = open("/dev/mali0", O_RDWR | O_CLOEXEC | O_NONBLOCK);
if(kbase_device_fd == -1) {
printf("PAN_OSMESA: Failed to open kbase device: %s", strerror(errno));
}else {
screen = panfrost_create_screen(kbase_device_fd, NULL);
}
}
#else
#error You forgot to include Panfrost
#endif

return screen ? debug_screen_wrap(screen) : NULL;
}

Expand Down
8 changes: 1 addition & 7 deletions src/gallium/drivers/panfrost/pan_disk_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,7 @@ void
panfrost_disk_cache_init(struct panfrost_screen *screen)
{
#ifdef ENABLE_SHADER_CACHE
const char *renderer = screen->base.get_name(&screen->base);

const struct build_id_note *note =
build_id_find_nhdr_for_addr(panfrost_disk_cache_init);
assert(note && build_id_length(note) == 20); /* sha1 */

const uint8_t *id_sha1 = build_id_data(note);
const uint8_t *id_sha1 = "1";
assert(id_sha1);

char timestamp[41];
Expand Down
2 changes: 1 addition & 1 deletion src/gallium/targets/osmesa/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ libosmesa = shared_library(
dep_ws2_32, dep_selinux, dep_thread, dep_clock, dep_unwind, driver_swrast
],
name_prefix : host_machine.system() == 'windows' ? '' : [], # otherwise mingw will create libosmesa.dll
soversion : host_machine.system() == 'windows' ? '' : '8',
soversion : '',
version : '8.0.0',
darwin_versions : '9.0.0',
install : true,
Expand Down
53 changes: 0 additions & 53 deletions src/util/os_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
# define LOG_TAG "MESA"
# include <unistd.h>
# include <log/log.h>
# include <cutils/properties.h>
#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM
# include <unistd.h>
#elif DETECT_OS_OPENBSD || DETECT_OS_FREEBSD
Expand Down Expand Up @@ -128,53 +127,6 @@ os_log_message(const char *message)
#endif
}

#if DETECT_OS_ANDROID
# include <ctype.h>
# include "c11/threads.h"

/**
* Get an option value from android's property system, as a fallback to
* getenv() (which is generally less useful on android due to processes
* typically being forked from the zygote.
*
* The option name used for getenv is translated into a property name
* by:
*
* 1) convert to lowercase
* 2) replace '_' with '.'
* 3) if necessary, prepend "mesa."
*
* For example:
* - MESA_EXTENSION_OVERRIDE -> mesa.extension.override
* - GALLIUM_HUD -> mesa.gallium.hud
*
*/
static char *
os_get_android_option(const char *name)
{
static thread_local char os_android_option_value[PROPERTY_VALUE_MAX];
char key[PROPERTY_KEY_MAX];
char *p = key, *end = key + PROPERTY_KEY_MAX;
/* add "mesa." prefix if necessary: */
if (strstr(name, "MESA_") != name)
p += strlcpy(p, "mesa.", end - p);
p += strlcpy(p, name, end - p);
for (int i = 0; key[i]; i++) {
if (key[i] == '_') {
key[i] = '.';
} else {
key[i] = tolower(key[i]);
}
}

int len = property_get(key, os_android_option_value, NULL);
if (len > 1) {
return os_android_option_value;
}
return NULL;
}
#endif

#if DETECT_OS_WINDOWS

/* getenv doesn't necessarily reflect changes to the environment
Expand All @@ -195,11 +147,6 @@ const char *
os_get_option(const char *name)
{
const char *opt = getenv(name);
#if DETECT_OS_ANDROID
if (!opt) {
opt = os_get_android_option(name);
}
#endif
return opt;
}

Expand Down
13 changes: 0 additions & 13 deletions src/util/perf/cpu_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@
util_perfetto_trace_end(); \
} while (0)

/* NOTE: for now disable atrace for C++ to workaround a ndk bug with ordering
* between stdatomic.h and atomic.h. See:
*
* https://github.com/android/ndk/issues/1178
*/
#elif DETECT_OS_ANDROID && !defined(__cplusplus)

#include <cutils/trace.h>

#define _MESA_TRACE_BEGIN(name) \
atrace_begin(ATRACE_TAG_GRAPHICS, name)
#define _MESA_TRACE_END() atrace_end(ATRACE_TAG_GRAPHICS)

#else

#define _MESA_TRACE_BEGIN(name)
Expand Down

0 comments on commit 0769fd8

Please sign in to comment.