| 1 | /* Pcsx - Pc Psx Emulator |
| 2 | * Copyright (C) 1999-2016 Pcsx Team |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses>. |
| 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * q: Why bother with GPU stuff in a plugin-based emu core? |
| 20 | * a: mostly because of busy bits, we have all the needed timing info |
| 21 | * that GPU plugin doesn't. |
| 22 | */ |
| 23 | |
| 24 | #ifndef __GPU_H__ |
| 25 | #define __GPU_H__ |
| 26 | |
| 27 | #define PSXGPU_LCF (1u<<31) |
| 28 | #define PSXGPU_nBUSY (1u<<26) |
| 29 | #define PSXGPU_ILACE (1u<<22) |
| 30 | #define PSXGPU_DHEIGHT (1u<<19) |
| 31 | #define PSXGPU_FIELD (1u<<13) |
| 32 | |
| 33 | // both must be set for interlace to work |
| 34 | #define PSXGPU_ILACE_BITS (PSXGPU_ILACE | PSXGPU_DHEIGHT | PSXGPU_FIELD) |
| 35 | |
| 36 | #define HW_GPU_STATUS psxHu32ref(0x1814) |
| 37 | |
| 38 | // TODO: handle com too |
| 39 | #define PSXGPU_TIMING_BITS (PSXGPU_LCF | PSXGPU_nBUSY | PSXGPU_FIELD) |
| 40 | |
| 41 | #define gpuSyncPluginSR() { \ |
| 42 | HW_GPU_STATUS &= SWAP32(PSXGPU_TIMING_BITS); \ |
| 43 | HW_GPU_STATUS |= SWAP32(GPU_readStatus() & ~PSXGPU_TIMING_BITS); \ |
| 44 | } |
| 45 | |
| 46 | enum psx_gpu_state { |
| 47 | PGS_VRAM_TRANSFER_START, |
| 48 | PGS_VRAM_TRANSFER_END, |
| 49 | PGS_PRIMITIVE_START, // for non-dma only |
| 50 | }; |
| 51 | |
| 52 | void gpu_state_change(int what); |
| 53 | |
| 54 | #endif /* __GPU_H__ */ |