From 4a5f0f63d2b268c8ad7dca59ae2ac64f1d934050 Mon Sep 17 00:00:00 2001 From: askmeaboutloom Date: Wed, 6 Sep 2023 16:58:17 +0200 Subject: [PATCH] WIP --- src/drawdance/libengine/dpengine/draw_context.c | 8 +++++++- src/drawdance/libengine/dpengine/preview.c | 1 + src/libclient/drawdance/global.cpp | 7 ++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/drawdance/libengine/dpengine/draw_context.c b/src/drawdance/libengine/dpengine/draw_context.c index 3c59ce6d89..30e918152d 100644 --- a/src/drawdance/libengine/dpengine/draw_context.c +++ b/src/drawdance/libengine/dpengine/draw_context.c @@ -69,12 +69,14 @@ DP_DrawContext *DP_draw_context_new(void) DP_DrawContext *dc = DP_malloc_simd(sizeof(*dc)); dc->pool_size = 0; dc->pool = NULL; + DP_warn("Allocate draw context %p", (void *)dc); return dc; } void DP_draw_context_free(DP_DrawContext *dc) { if (dc) { + DP_warn("Free draw context %p", (void *)dc); DP_free(dc->pool); DP_free_simd(dc); } @@ -203,8 +205,12 @@ unsigned char *DP_draw_context_raster_pool_resize(DP_DrawContext *dc, { DP_ASSERT(dc); DP_ASSERT(new_size > dc->pool_size); - DP_ASSERT(new_size < DP_DRAW_CONTEXT_RASTER_POOL_MAX_SIZE); + DP_ASSERT(new_size <= DP_DRAW_CONTEXT_RASTER_POOL_MAX_SIZE); DP_ASSERT(dc->pool); + DP_warn("Raster pool resize form %zu to %zu (min %zu/max %zu)", + dc->pool_size, new_size, + (size_t)DP_DRAW_CONTEXT_RASTER_POOL_MIN_SIZE, + (size_t)DP_DRAW_CONTEXT_RASTER_POOL_MAX_SIZE); DP_free(dc->pool); void *new_raster_pool = DP_malloc(new_size); dc->pool = new_raster_pool; diff --git a/src/drawdance/libengine/dpengine/preview.c b/src/drawdance/libengine/dpengine/preview.c index 4dbf3f8acf..d2789fd4b6 100644 --- a/src/drawdance/libengine/dpengine/preview.c +++ b/src/drawdance/libengine/dpengine/preview.c @@ -304,6 +304,7 @@ static bool preview_transform_prepare_image(DP_PreviewTransform *pvtf, pvtf->pixels.dispose = NULL; if (img) { + DP_warn("Transformed onl layer %d", pvtf->target_layer_id); pvtf->img = img; return true; } diff --git a/src/libclient/drawdance/global.cpp b/src/libclient/drawdance/global.cpp index b6992935ab..3a478a71dd 100644 --- a/src/libclient/drawdance/global.cpp +++ b/src/libclient/drawdance/global.cpp @@ -131,7 +131,7 @@ DrawContext DrawContextPool::acquireContext() DP_DrawContext *dc; if(m_available.isEmpty()) { dc = DP_draw_context_new(); - m_contexts.append(dc); + // m_contexts.append(dc); } else { dc = m_available.pop(); } @@ -141,8 +141,9 @@ DrawContext DrawContextPool::acquireContext() void DrawContextPool::releaseContext(DP_DrawContext *dc) { Q_ASSERT(dc); - QMutexLocker locker{&m_mutex}; - m_available.push(dc); + // QMutexLocker locker{&m_mutex}; + // m_available.push(dc); + DP_draw_context_free(dc); } DrawContextPoolStatistics DrawContextPool::instanceStatistics()