| // Copyright 2017 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef MAGMA_ARM_MALI_TYPES_H_ |
| #define MAGMA_ARM_MALI_TYPES_H_ |
| |
| #include <cstdint> |
| |
| #include "magma_common_defs.h" |
| |
| // These flags can be specified to magma_map_buffer_gpu. |
| enum MagmaArmMaliGpuMapFlags { |
| // Accesses to this data should be GPU-L2 coherent. |
| kMagmaArmMaliGpuMapFlagInnerShareable = (1 << MAGMA_GPU_MAP_FLAG_VENDOR_SHIFT), |
| |
| // Accesses to this data should be coherent with the CPU |
| kMagmaArmMaliGpuMapFlagBothShareable = (1 << (MAGMA_GPU_MAP_FLAG_VENDOR_SHIFT + 1)), |
| }; |
| |
| enum AtomFlags { |
| kAtomFlagRequireFragmentShader = (1 << 0), |
| |
| // Compute shaders also include vertex and geometry shaders. |
| kAtomFlagRequireComputeShader = (1 << 1), |
| kAtomFlagRequireTiler = (1 << 2), |
| kAtomFlagRequireCycleCounter = (1 << 3), |
| kAtomFlagProtected = (1 << 4), // Executes in protected mode. |
| |
| // Atoms with this flag set are processed completely in the MSD and aren't |
| // sent to hardware. |
| kAtomFlagSoftware = (1 << 30), |
| |
| kAtomFlagSemaphoreSet = kAtomFlagSoftware | 1, |
| kAtomFlagSemaphoreReset = kAtomFlagSoftware | 2, |
| kAtomFlagSemaphoreWait = kAtomFlagSoftware | 3, |
| kAtomFlagSemaphoreWaitAndReset = kAtomFlagSoftware | 4, |
| }; |
| |
| enum ArmMaliResultCodeFlags { |
| // The result code is for a software event, not one created by hardware. |
| kArmMaliSoftwareEvent = (1u << 14), |
| |
| // A software event succeeded. |
| kArmMaliSoftwareEventSuccess = (1u << 13), |
| |
| // This event is not related to a specific GPU job. |
| kArmMaliSoftwareEventMisc = (1u << 12), |
| }; |
| |
| enum ArmMaliResultCode { |
| kArmMaliResultRunning = 0, |
| |
| // These codes match the result codes from hardware. |
| kArmMaliResultSuccess = 1, |
| kArmMaliResultSoftStopped = 3, |
| // The atom was terminated with a hard stop. |
| kArmMaliResultAtomTerminated = 4, |
| |
| // These faults happen while attempting to read jobs in a job chain. |
| kArmMaliResultFault = 0x40, |
| kArmMaliResultConfigFault = kArmMaliResultFault + 0, |
| kArmMaliResultPowerFault = kArmMaliResultFault + 1, |
| kArmMaliResultReadFault = kArmMaliResultFault + 2, |
| kArmMaliResultWriteFault = kArmMaliResultFault + 3, |
| kArmMaliResultAffinityFault = kArmMaliResultFault + 4, |
| kArmMaliResultBusFault = kArmMaliResultFault + 8, |
| |
| // These faults happpen when executing jobs. |
| kArmMaliResultInstructionFault = 0x50, |
| kArmMaliResultProgramCounterInvalidFault = kArmMaliResultInstructionFault, |
| kArmMaliResultEncodingInvalidFault = kArmMaliResultInstructionFault + 0x1, |
| kArmMaliResultTypeMismatchFault = kArmMaliResultInstructionFault + 0x2, |
| kArmMaliResultOperandFault = kArmMaliResultInstructionFault + 0x3, |
| kArmMaliResultTlsFault = kArmMaliResultInstructionFault + 0x4, |
| kArmMaliResultBarrierFault = kArmMaliResultInstructionFault + 0x5, |
| kArmMaliResultAlignmentFault = kArmMaliResultInstructionFault + 0x6, |
| kArmMaliResultDataInvalidFault = kArmMaliResultInstructionFault + 0x8, |
| kArmMaliResultTileRangeFault = kArmMaliResultInstructionFault + 0xa, |
| kArmMaliResultOutOfMemoryFault = 0x60, |
| |
| kArmMaliResultUnknownFault = 0x7f, |
| |
| // Faults for software atoms. |
| kArmMaliResultTimedOut = kArmMaliSoftwareEvent | 1, |
| |
| // This result code is only generated by the driver itself. |
| kArmMaliResultTerminated = |
| kArmMaliSoftwareEvent | kArmMaliSoftwareEventSuccess | kArmMaliSoftwareEventMisc, |
| }; |
| |
| // These values match the hardware. |
| enum ArmMaliCacheCoherencyStatus { |
| kArmMaliCacheCoherencyAceLite = 0, |
| kArmMaliCacheCoherencyAce = 1, |
| |
| kArmMaliCacheCoherencyNone = 31, |
| }; |
| |
| enum ArmMaliDependencyType { |
| // Data dependencies cause dependent atoms to fail. |
| kArmMaliDependencyData = 0, |
| |
| // Order dependencies allow dependent atoms to execute, even on failure. |
| kArmMaliDependencyOrder = 1, |
| }; |
| |
| struct magma_arm_mali_dependency { |
| uint8_t type; // ArmMaliDependencyType |
| uint8_t atom_number; // 0 means no dependency. |
| } __attribute__((packed)); |
| |
| // This is arbitrary user data that's used to identify an atom. |
| struct magma_arm_mali_user_data { |
| uint64_t data[2]; |
| } __attribute__((packed)); |
| |
| struct magma_arm_mali_atom { |
| uint64_t size; // Size of this structure. Used for backwards compatibility. |
| uint64_t job_chain_addr; |
| struct magma_arm_mali_user_data data; |
| uint32_t flags; // a set of AtomFlags. |
| uint8_t atom_number; |
| int8_t priority; // 0 is default. < 0 is less important, > 0 is more important. |
| |
| magma_arm_mali_dependency dependencies[2]; |
| } __attribute__((packed)); |
| |
| struct magma_arm_mali_status { |
| uint32_t result_code; |
| uint8_t atom_number; |
| magma_arm_mali_user_data data; |
| } __attribute__((packed)); |
| |
| #endif |