An EL2 monitor/hypervisor and toolchain that boots macOS 27 on the ASUS A16 (Snapdragon X2 Elite), with an Adreno Metal plug-in and IOGPU kext, and air2ir3, an AIR to Mesa ir3 shader compiler. MIT, with GPL-2.0 components listed in LICENSE and THIRD_PARTY_NOTICES.md. No Apple, Qualcomm, ASUS or Microsoft binaries are included.
23 lines
981 B
C
23 lines
981 B
C
/* SPDX-License-Identifier: MIT */
|
|
#include "adreno-submit.h"
|
|
|
|
static uint32_t load32(const unsigned char *p)
|
|
{
|
|
return (uint32_t)p[0] | (uint32_t)p[1]<<8 | (uint32_t)p[2]<<16 | (uint32_t)p[3]<<24;
|
|
}
|
|
int adreno_submit_command(const void *command, uint64_t available,
|
|
int (*fence)(void *), void *context)
|
|
{
|
|
if (!command || available < sizeof(struct adreno_submit_header) || !fence)
|
|
return ADRENO_SUBMIT_E_FORMAT;
|
|
const unsigned char *bytes = command;
|
|
uint32_t type = load32(bytes), size = load32(bytes+4);
|
|
if (size < sizeof(struct adreno_submit_header) || (size & 3) || size > available)
|
|
return ADRENO_SUBMIT_E_FORMAT;
|
|
if (type == ADRENO_KCMD_IOGPU_DEBUG_LOG || type == ADRENO_KCMD_IOGPU_TIMESTAMP)
|
|
return ADRENO_SUBMIT_GENERIC;
|
|
if (type != ADRENO_KCMD_FENCE) return ADRENO_SUBMIT_E_COMMAND;
|
|
if (size != sizeof(struct adreno_submit_header)) return ADRENO_SUBMIT_E_FORMAT;
|
|
return fence(context);
|
|
}
|