gpu_neon: handle 0xEx cmds while frameskiping
[pcsx_rearmed.git] / plugins / gpu_neon / gpu.h
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
15 struct 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;
47   uint32_t gp0;
48   uint32_t ex_regs[8];
49   struct {
50     int hres, vres;
51     int x, y, w, h;
52     int x1, x2;
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;
62   struct {
63     uint32_t fb_dirty:1;
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;
72   } state;
73   struct {
74     uint32_t enabled:1;
75     uint32_t active:1;
76     uint32_t frame_ready:1;
77     uint32_t skipped_blits:5;
78     const int *advice;
79   } frameskip;
80 };
81
82 extern struct psx_gpu gpu;
83
84 extern const unsigned char cmd_lengths[256];
85
86 void do_cmd_list(uint32_t *list, int count);
87
88 int  renderer_init(void);
89 void renderer_sync_ecmds(uint32_t * ecmds);
90 void renderer_invalidate_caches(int x, int y, int w, int h);
91 void renderer_flush_queues(void);
92
93 int vout_init(void);
94 int vout_finish(void);