}
qt5_num_outputs = i;
qt5_console = g_new0(struct qt5_state, qt5_num_outputs);
+#ifdef CONFIG_OPENGL
+ qt5_gl_init_items();
+#endif
for (i = 0; i < qt5_num_outputs; i++) {
QemuConsole *con = qemu_console_lookup_by_index(i);
#ifdef CONFIG_OPENGL
static dpy_item dpy_item_pool[DPY_ITEM_NO];
static uint64_t dpy_item_gen[DPY_ITEM_NO];
+void qt5_gl_init_items()
+{
+ for (int i = 0; i < DPY_ITEM_NO; ++i) {
+ qemu_mutex_init(&dpy_item_pool[i].mutex);
+ dpy_item_pool[i].available = true;
+ }
+}
+// TODO: Is there a good place to put this?
+/* void qt5_gl_destroy_items()
+{
+ for (int i = 0; i < DPY_ITEM_NO; ++i) {
+ qemu_mutex_destroy(&dpy_item_pool[i].mutex);
+ }
+} */
+
uint32_t qt5_gl_refresh_internal(uint32_t tex, uint32_t width, uint32_t height, uint64_t gen, bool *should_free)
{
uint32_t ret = tex;
{
auto item = &dpy_item_pool[item_id];
qemu_mutex_lock(&item->mutex);
- bool ok = dpy_item_gen[item_id] == 0 || item->available;
+ bool ok = item->available;
if (ok) {
ret = item->tex;
if (dpy_item_gen[item_id] != gen || /* HACK HACK HACK */ item->tex < 25) {
void qt5_set_force_legacy(bool isLegacy);
#ifdef CONFIG_OPENGL
+void qt5_gl_init_items(void);
+// void qt5_gl_destroy_items(void);
uint32_t qt5_gl_refresh_internal(uint32_t tex, uint32_t width, uint32_t height, uint64_t gen, bool *should_free);
void *qt5_gl_create_context_internal(int major, int minor);
void qt5_gl_destroy_context_internal(void *);