2 * (C) GraÅžvydas "notaz" Ignotas, 2011
4 * This work is licensed under the terms of any of these licenses
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.
17 #define CMD_BUFFER_LEN 1024
19 #define BIT(x) (1 << (x))
21 #define PSX_GPU_STATUS_DHEIGHT BIT(19)
22 #define PSX_GPU_STATUS_RGB24 BIT(21)
23 #define PSX_GPU_STATUS_INTERLACE BIT(22)
24 #define PSX_GPU_STATUS_BLANKING BIT(23)
25 #define PSX_GPU_STATUS_IMG BIT(27)
26 #define PSX_GPU_STATUS_DMA(x) ((x) << 29)
27 #define PSX_GPU_STATUS_DMA_MASK (BIT(29) | BIT(30))
30 uint32_t cmd_buffer[CMD_BUFFER_LEN];
44 short int offset, is_read;
50 uint32_t old_interlace:1;
51 uint32_t allow_interlace:2;
53 uint32_t enhancement_enable:1;
54 uint32_t enhancement_active:1;
55 uint32_t *frame_count;
56 uint32_t *hcnt; /* hsync count */
63 uint32_t last_vram_read_frame;
66 int32_t set:3; /* -1 auto, 0 off, 1-3 fixed */
67 int32_t cnt:3; /* amount skipped in a row */
70 uint32_t frame_ready:1;
72 uint32_t last_flip_frame;
73 uint32_t pending_fill[3];
75 uint16_t *(*get_enhancement_bufer)
76 (int *x, int *y, int *w, int *h, int *vram_h);
77 void *(*mmap)(unsigned int size);
78 void (*munmap)(void *ptr, unsigned int size);
81 extern struct psx_gpu gpu;
83 extern const unsigned char cmd_lengths[256];
85 int do_cmd_list(uint32_t *list, int count, int *last_cmd);
89 int renderer_init(void);
90 void renderer_finish(void);
91 void renderer_sync_ecmds(uint32_t * ecmds);
92 void renderer_update_caches(int x, int y, int w, int h);
93 void renderer_flush_queues(void);
94 void renderer_set_interlace(int enable, int is_odd);
95 void renderer_set_config(const struct rearmed_cbs *config);
96 void renderer_notify_res_change(void);
99 int vout_finish(void);
100 void vout_update(void);
101 void vout_blank(void);
102 void vout_set_config(const struct rearmed_cbs *config);
104 /* listing these here for correct linkage if rasterizer uses c++ */
108 long GPUshutdown(void);
109 void GPUwriteDataMem(uint32_t *mem, int count);
110 long GPUdmaChain(uint32_t *rambase, uint32_t addr);
111 void GPUwriteData(uint32_t data);
112 void GPUreadDataMem(uint32_t *mem, int count);
113 uint32_t GPUreadData(void);
114 uint32_t GPUreadStatus(void);
115 void GPUwriteStatus(uint32_t data);
116 long GPUfreeze(uint32_t type, struct GPUFreeze *freeze);
117 void GPUupdateLace(void);
118 long GPUopen(void **dpy);
120 void GPUvBlank(int is_vblank, int lcf);
121 void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_);