From 5a0776f1fdc6b7780cd21d568150e804347a6f8a Mon Sep 17 00:00:00 2001
From: Vito Caputo <vcaputo@pengaru.com>
Date: Tue, 14 Jun 2022 02:28:36 -0700
Subject: til: til_fb_fragment_t **fragment_ptr all the things

Preparatory commit for enabling cloneable/swappable fragments

There's an outstanding issue with the til_fb_page_t submission,
see comments.  Doesn't matter for now since cloning doesn't happen
yet, but will need to be addressed before they do.
---
 src/modules/moire/moire.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'src/modules/moire')

diff --git a/src/modules/moire/moire.c b/src/modules/moire/moire.c
index ceeefe0..d528f8c 100644
--- a/src/modules/moire/moire.c
+++ b/src/modules/moire/moire.c
@@ -71,7 +71,7 @@ static til_module_context_t * moire_create_context(unsigned seed, unsigned ticks
 }
 
 
-static void moire_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan)
+static void moire_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
 {
 	moire_context_t	*ctxt = (moire_context_t *)context;
 
@@ -84,12 +84,14 @@ static void moire_prepare_frame(til_module_context_t *context, unsigned ticks, t
 }
 
 
-static void moire_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+static void moire_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
 {
-	moire_context_t	*ctxt = (moire_context_t *)context;
-	float		xf = 2.f / (float)fragment->frame_width;
-	float		yf = 2.f / (float)fragment->frame_height;
-	float		cx, cy;
+	moire_context_t		*ctxt = (moire_context_t *)context;
+	til_fb_fragment_t	*fragment = *fragment_ptr;
+
+	float	xf = 2.f / (float)fragment->frame_width;
+	float	yf = 2.f / (float)fragment->frame_height;
+	float	cx, cy;
 
 	/* TODO: optimize */
 	cy = yf * (float)fragment->y - 1.f;
-- 
cgit v1.2.3