| 238 | } |
| 239 | |
| 240 | bool gspPresentBuffer(unsigned screen, unsigned swap, const void* fb_a, const void* fb_b, u32 stride, u32 mode) |
| 241 | { |
| 242 | GSPGPU_FramebufferInfo info; |
| 243 | info.active_framebuf = swap; |
| 244 | info.framebuf0_vaddr = (u32*)fb_a; |
| 245 | info.framebuf1_vaddr = (u32*)fb_b; |
| 246 | info.framebuf_widthbytesize = stride; |
| 247 | info.format = mode; |
| 248 | info.framebuf_dispselect = swap; |
| 249 | info.unk = 0; |
| 250 | |
| 251 | s32* fbInfoHeader = (s32*)((u8*)gspSharedMem + 0x200 + gspThreadId*0x80 + screen*0x40); |
| 252 | GSPGPU_FramebufferInfo* fbInfos = (GSPGPU_FramebufferInfo*)&fbInfoHeader[1]; |
| 253 | unsigned pos = 1 - (*fbInfoHeader & 0xff); |
| 254 | fbInfos[pos] = info; |
| 255 | __dsb(); |
| 256 | |
| 257 | union |
| 258 | { |
| 259 | s32 header; |
| 260 | struct { u8 swap, update; }; |
| 261 | } u; |
| 262 | |
| 263 | bool ret; |
| 264 | do |
| 265 | { |
| 266 | u.header = __ldrex(fbInfoHeader); |
| 267 | ret = u.update != 0; |
| 268 | |
| 269 | u.swap = pos; |
| 270 | u.update = 1; |
| 271 | } while (__strex(fbInfoHeader, u.header)); |
| 272 | |
| 273 | return ret; |
| 274 | } |
| 275 | |
| 276 | bool gspIsPresentPending(unsigned screen) |
| 277 | { |
no test coverage detected