all repos — mgba @ daaa2fa5236df5e8976e7e0ba7ac39e0d9233422

mGBA Game Boy Advance Emulator

src/gba/renderers/thread-proxy.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef VIDEO_THREAD_PROXY_H
 7#define VIDEO_THREAD_PROXY_H
 8
 9#include "gba/video.h"
10#include "util/threading.h"
11#include "util/ring-fifo.h"
12
13enum GBAVideoThreadProxyState {
14	PROXY_THREAD_STOPPED = 0,
15	PROXY_THREAD_IDLE,
16	PROXY_THREAD_BUSY
17};
18
19struct GBAVideoThreadProxyRenderer {
20	struct GBAVideoRenderer d;
21	struct GBAVideoRenderer* backend;
22
23	Thread thread;
24	Condition fromThreadCond;
25	Condition toThreadCond;
26	Mutex mutex;
27	enum GBAVideoThreadProxyState threadState;
28
29	struct RingFIFO dirtyQueue;
30
31	uint32_t vramDirtyBitmap;
32	uint32_t oamDirtyBitmap[16];
33
34	uint16_t* vramProxy;
35	union GBAOAM oamProxy;
36	uint16_t paletteProxy[512];
37};
38
39void GBAVideoThreadProxyRendererCreate(struct GBAVideoThreadProxyRenderer* renderer, struct GBAVideoRenderer* backend);
40
41#endif