[client] renderers: add new needs_render method to the interface

With jitRender the renderer needs to tell the main application if it
needs to be rendererd, such as during the initial splash screen fade
out.
This commit is contained in:
Geoffrey McRae 2021-08-01 18:18:08 +10:00
parent 2d74c93232
commit f8e1ab8f31
3 changed files with 17 additions and 0 deletions

View File

@ -36,6 +36,7 @@
(x)->on_mouse_shape && \ (x)->on_mouse_shape && \
(x)->on_mouse_event && \ (x)->on_mouse_event && \
(x)->render_startup && \ (x)->render_startup && \
(x)->needs_render && \
(x)->render) (x)->render)
typedef struct LG_RendererParams typedef struct LG_RendererParams
@ -112,6 +113,7 @@ typedef bool (* LG_RendererOnMouseEvent )(void * opaque, const bool visi
typedef bool (* LG_RendererOnFrameFormat)(void * opaque, const LG_RendererFormat format, bool useDMA); typedef bool (* LG_RendererOnFrameFormat)(void * opaque, const LG_RendererFormat format, bool useDMA);
typedef bool (* LG_RendererOnFrame )(void * opaque, const FrameBuffer * frame, int dmaFD, const FrameDamageRect * damage, int damageCount); typedef bool (* LG_RendererOnFrame )(void * opaque, const FrameBuffer * frame, int dmaFD, const FrameDamageRect * damage, int damageCount);
typedef bool (* LG_RendererRenderStartup)(void * opaque); typedef bool (* LG_RendererRenderStartup)(void * opaque);
typedef bool (* LG_RendererNeedsRender )(void * opaque);
typedef bool (* LG_RendererRender )(void * opaque, LG_RendererRotate rotate, const bool newFrame, const bool invalidateWindow); typedef bool (* LG_RendererRender )(void * opaque, LG_RendererRotate rotate, const bool newFrame, const bool invalidateWindow);
typedef struct LG_Renderer typedef struct LG_Renderer
@ -130,6 +132,7 @@ typedef struct LG_Renderer
LG_RendererOnFrameFormat on_frame_format; LG_RendererOnFrameFormat on_frame_format;
LG_RendererOnFrame on_frame; LG_RendererOnFrame on_frame;
LG_RendererRenderStartup render_startup; LG_RendererRenderStartup render_startup;
LG_RendererNeedsRender needs_render;
LG_RendererRender render; LG_RendererRender render;
} }
LG_Renderer; LG_Renderer;

View File

@ -805,6 +805,12 @@ static bool egl_render_startup(void * opaque)
return true; return true;
} }
static bool egl_needs_render(void * opaque)
{
struct Inst * this = (struct Inst *)opaque;
return !this->waitDone;
}
static bool egl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame, static bool egl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame,
const bool invalidateWindow) const bool invalidateWindow)
{ {
@ -1007,5 +1013,6 @@ struct LG_Renderer LGR_EGL =
.on_frame_format = egl_on_frame_format, .on_frame_format = egl_on_frame_format,
.on_frame = egl_on_frame, .on_frame = egl_on_frame,
.render_startup = egl_render_startup, .render_startup = egl_render_startup,
.needs_render = egl_needs_render,
.render = egl_render .render = egl_render
}; };

View File

@ -456,6 +456,12 @@ bool opengl_render_startup(void * opaque)
return true; return true;
} }
static bool opengl_needs_render(void * opaque)
{
struct Inst * this = (struct Inst *)opaque;
return !this->waitDone;
}
bool opengl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame, bool opengl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame,
const bool invalidateWindow) const bool invalidateWindow)
{ {
@ -618,6 +624,7 @@ const LG_Renderer LGR_OpenGL =
.on_frame_format = opengl_on_frame_format, .on_frame_format = opengl_on_frame_format,
.on_frame = opengl_on_frame, .on_frame = opengl_on_frame,
.render_startup = opengl_render_startup, .render_startup = opengl_render_startup,
.needs_render = opengl_needs_render,
.render = opengl_render .render = opengl_render
}; };