Skip to content
Snippets Groups Projects
Commit bff400f1 authored by pippin's avatar pippin Committed by pippin
Browse files

ctx: sync with upstream to get public ctx_set_frameclock

parent b4edc49c
No related branches found
No related tags found
1 merge request!110ctx,st3m: increment the frame-clock of the texture cache context
/* ctx git commit: 4349079e */ /* ctx git commit: aeaa8b2b */
/* /*
* ctx.h is free software; you can redistribute it and/or * ctx.h is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -2509,6 +2509,10 @@ void ctx_vt_write (Ctx *ctx, uint8_t byte); ...@@ -2509,6 +2509,10 @@ void ctx_vt_write (Ctx *ctx, uint8_t byte);
int ctx_vt_has_data (Ctx *ctx); int ctx_vt_has_data (Ctx *ctx);
int ctx_vt_read (Ctx *ctx); int ctx_vt_read (Ctx *ctx);
   
void ctx_set_textureclock (Ctx *ctx, int frame);
int ctx_textureclock (Ctx *ctx);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -6121,8 +6125,7 @@ void ctx_buffer_set_data (CtxBuffer *buffer, ...@@ -6121,8 +6125,7 @@ void ctx_buffer_set_data (CtxBuffer *buffer,
void (*freefunc) (void *pixels, void *user_data), void (*freefunc) (void *pixels, void *user_data),
void *user_data); void *user_data);
   
int _ctx_set_frame (Ctx *ctx, int frame); int ctx_textureclock (Ctx *ctx);
int _ctx_frame (Ctx *ctx);
   
   
void ctx_exit (Ctx *ctx); void ctx_exit (Ctx *ctx);
...@@ -53372,14 +53375,15 @@ void ctx_texture (Ctx *ctx, const char *eid, float x, float y) ...@@ -53372,14 +53375,15 @@ void ctx_texture (Ctx *ctx, const char *eid, float x, float y)
//fclose (f); //fclose (f);
} }
int int
_ctx_frame (Ctx *ctx) ctx_textureclock (Ctx *ctx)
{ {
return ctx->frame; return ctx->frame;
} }
int
_ctx_set_frame (Ctx *ctx, int frame) void
ctx_set_textureclock (Ctx *ctx, int textureclock)
{ {
return ctx->frame = frame; ctx->frame = textureclock;
} }
   
void ctx_define_texture (Ctx *ctx, void ctx_define_texture (Ctx *ctx,
...@@ -60980,8 +60984,8 @@ static void vt_ctx_exit (void *data) ...@@ -60980,8 +60984,8 @@ static void vt_ctx_exit (void *data)
vt->current_line->ctx = vt->current_line->ctx_copy; vt->current_line->ctx = vt->current_line->ctx_copy;
vt->current_line->ctx_copy = tmp; vt->current_line->ctx_copy = tmp;
   
_ctx_set_frame (vt->current_line->ctx, _ctx_frame (vt->current_line->ctx) + 1); ctx_set_textureclock (vt->current_line->ctx, ctx_textureclock (vt->current_line->ctx) + 1);
_ctx_set_frame (vt->current_line->ctx_copy, _ctx_frame (vt->current_line->ctx)); ctx_set_textureclock (vt->current_line->ctx_copy, ctx_textureclock (vt->current_line->ctx));
#if 1 #if 1
if (vt->ctxp) // XXX: ugly hack to aid double buffering if (vt->ctxp) // XXX: ugly hack to aid double buffering
((void**)vt->ctxp)[0]= vt->current_line->ctx; ((void**)vt->ctxp)[0]= vt->current_line->ctx;
...@@ -67126,7 +67130,7 @@ void vt_draw (VT *vt, Ctx *ctx, double x0, double y0) ...@@ -67126,7 +67130,7 @@ void vt_draw (VT *vt, Ctx *ctx, double x0, double y0)
   
if (line->ctx_copy) if (line->ctx_copy)
{ {
//fprintf (stderr, " [%i]\n", _ctx_frame (ctx)); //fprintf (stderr, " [%i]\n", ctx_textureclock (ctx));
//ctx_render_stream (line->ctx_copy, stderr, 1); //ctx_render_stream (line->ctx_copy, stderr, 1);
   
ctx_begin_path (ctx); ctx_begin_path (ctx);
...@@ -110,6 +110,8 @@ static void st3m_gfx_crtc_task(void *_arg) { ...@@ -110,6 +110,8 @@ static void st3m_gfx_crtc_task(void *_arg) {
} }
} }
void st3m_ctx_increment_frame(Ctx *ctx);
static void st3m_gfx_rast_task(void *_arg) { static void st3m_gfx_rast_task(void *_arg) {
(void)_arg; (void)_arg;
...@@ -129,6 +131,8 @@ static void st3m_gfx_rast_task(void *_arg) { ...@@ -129,6 +131,8 @@ static void st3m_gfx_rast_task(void *_arg) {
end = esp_timer_get_time(); end = esp_timer_get_time();
st3m_counter_timer_sample(&rast_read_dctx_time, end - start); st3m_counter_timer_sample(&rast_read_dctx_time, end - start);
st3m_ctx_increment_frame(framebuffer_descs[0].ctx);
// Render drawctx into fbctx. // Render drawctx into fbctx.
start = esp_timer_get_time(); start = esp_timer_get_time();
ctx_render_ctx(draw->ctx, fb->ctx); ctx_render_ctx(draw->ctx, fb->ctx);
......
...@@ -59,6 +59,5 @@ class Clouds(Application): ...@@ -59,6 +59,5 @@ class Clouds(Application):
c.draw(ctx) c.draw(ctx)
if __name__ == "__main__": # uncomment to make runnable via mpremote
# Continue to make runnable via mpremote run. # st3m.run.run_view(Clouds(ApplicationContext()))
st3m.run.run_view(Clouds(ApplicationContext()))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment