gpu_neon: support caching renderers, update rearmed if
[pcsx_rearmed.git] / plugins / gpu_neon / gpu.h
CommitLineData
56f08d83 1/*
2 * (C) GraÅžvydas "notaz" Ignotas, 2011
3 *
4 * This work is licensed under the terms of any of these licenses
5 * (at your option):
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
9 */
10
11#include <stdint.h>
12
13#define CMD_BUFFER_LEN 1024
14
15struct psx_gpu {
16 uint16_t vram[1024 * 512];
17 uint16_t guard[1024 * 512]; // overdraw guard
18 uint32_t cmd_buffer[CMD_BUFFER_LEN];
19 uint32_t regs[16];
20 union {
21 uint32_t reg;
22 struct {
23 uint32_t tx:4; // 0 texture page
24 uint32_t ty:1;
25 uint32_t abr:2;
26 uint32_t tp:2; // 7 t.p. mode (4,8,15bpp)
27 uint32_t dtd:1; // 9 dither
28 uint32_t dfe:1;
29 uint32_t md:1; // 11 set mask bit when drawing
30 uint32_t me:1; // 12 no draw on mask
31 uint32_t unkn:3;
32 uint32_t width1:1; // 16
33 uint32_t width0:2;
34 uint32_t dheight:1; // 19 double height
35 uint32_t video:1; // 20 NTSC,PAL
36 uint32_t rgb24:1;
37 uint32_t interlace:1; // 22 interlace on
38 uint32_t blanking:1; // 23 display not enabled
39 uint32_t unkn2:2;
40 uint32_t busy:1; // 26 !busy drawing
41 uint32_t img:1; // 27 ready to DMA image data
42 uint32_t com:1; // 28 ready for commands
43 uint32_t dma:2; // 29 off, ?, to vram, from vram
44 uint32_t lcf:1; // 31
45 };
46 } status;
6e9bdaef 47 uint32_t gp0;
48 uint32_t ex_regs[8];
56f08d83 49 struct {
8dd855cd 50 int hres, vres;
56f08d83 51 int x, y, w, h;
8dd855cd 52 int x1, x2;
56f08d83 53 int y1, y2;
54 } screen;
55 struct {
56 int x, y, w, h;
57 int offset;
58 } dma;
59 int cmd_len;
60 const uint32_t *lcf_hc;
61 uint32_t zero;
fc84f618 62 struct {
63 uint32_t fb_dirty:1;
deb18d24 64 uint32_t frame_count;
65 uint32_t *hcnt;
66 struct {
67 uint32_t addr;
68 uint32_t words;
69 uint32_t frame;
70 uint32_t hcnt;
71 } last_list;
fc84f618 72 } state;
73 struct {
74 uint32_t enabled:1;
75 uint32_t active:1;
76 uint32_t frame_ready:1;
77 const int *advice;
78 } frameskip;
56f08d83 79};
80
81extern struct psx_gpu gpu;
82
83extern const unsigned char cmd_lengths[256];
84
85void do_cmd_list(uint32_t *list, int count);
86
9394ada5 87int renderer_init(void);
88void renderer_invalidate_caches(int x, int y, int w, int h);
89void renderer_flush_queues(void);
90
56f08d83 91int vout_init(void);
92int vout_finish(void);