forked from enlightenment/efl
ecore_drm2: Add a function to set the pageflip callback data once
Instead of passing the user data for the page flip callback every time, set it just once. This will make it easier to push tick logic into ecore_evas_drm, as there will be a transitional period where page flips are driven in two places that don't have access to the same pointers.
This commit is contained in:
parent
cfd172c64b
commit
3d39c1e9b8
|
@ -770,14 +770,13 @@ EAPI void ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned
|
|||
*
|
||||
* @param fb
|
||||
* @param output
|
||||
* @param data
|
||||
*
|
||||
* @return The result of drmModePageFlip function call
|
||||
*
|
||||
* @ingroup Ecore_Drm2_Fb_Group
|
||||
* @since 1.18
|
||||
*/
|
||||
EAPI int ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output, void *data);
|
||||
EAPI int ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output);
|
||||
|
||||
/**
|
||||
* Return the Ecore_Drm2_Fb's busy status
|
||||
|
@ -802,6 +801,17 @@ EAPI Eina_Bool ecore_drm2_fb_busy_get(Ecore_Drm2_Fb *fb);
|
|||
*/
|
||||
EAPI void ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, Eina_Bool busy);
|
||||
|
||||
/**
|
||||
* Set the user data for the output's page flip handler
|
||||
*
|
||||
* @param output The output to update user data for
|
||||
* @param data The new user data pointer
|
||||
*
|
||||
* @ingroup Ecore_Drm2_Output_Group
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI void ecore_drm2_output_user_data_set(Ecore_Drm2_Output *o, void *data);
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -224,7 +224,7 @@ ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned int count
|
|||
}
|
||||
|
||||
EAPI int
|
||||
ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output, void *data)
|
||||
ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -260,7 +260,7 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output, void *data)
|
|||
|
||||
ret =
|
||||
drmModePageFlip(fb->fd, output->crtc_id, fb->id,
|
||||
DRM_MODE_PAGE_FLIP_EVENT, data);
|
||||
DRM_MODE_PAGE_FLIP_EVENT, output->user_data);
|
||||
if (ret < 0)
|
||||
{
|
||||
DBG("Pageflip Failed for Crtc %u on Connector %u: %m",
|
||||
|
|
|
@ -1208,3 +1208,9 @@ next:
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_drm2_output_user_data_set(Ecore_Drm2_Output *o, void *data)
|
||||
{
|
||||
o->user_data = data;
|
||||
}
|
||||
|
|
|
@ -151,6 +151,8 @@ struct _Ecore_Drm2_Output
|
|||
|
||||
Eina_List *planes;
|
||||
|
||||
void *user_data;
|
||||
|
||||
Eina_Bool connected : 1;
|
||||
Eina_Bool primary : 1;
|
||||
Eina_Bool cloned : 1;
|
||||
|
|
|
@ -97,7 +97,7 @@ _cb_pageflip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int se
|
|||
if (next)
|
||||
{
|
||||
ecore_drm2_output_next_fb_set(ob->priv.output, NULL);
|
||||
ecore_drm2_fb_flip(next, ob->priv.output, ob);
|
||||
ecore_drm2_fb_flip(next, ob->priv.output);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ _outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
|
|||
}
|
||||
|
||||
ecore_drm2_fb_dirty(ofb->fb, rects, count);
|
||||
if (ecore_drm2_fb_flip(ofb->fb, ob->priv.output, ob) == 0)
|
||||
if (ecore_drm2_fb_flip(ofb->fb, ob->priv.output) == 0)
|
||||
ob->priv.display = ofb;
|
||||
|
||||
ecore_drm2_fb_busy_set(ofb->fb, EINA_TRUE);
|
||||
|
@ -256,6 +256,8 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
|
|||
ob->ctx.vblank_handler = _cb_vblank;
|
||||
ob->ctx.page_flip_handler = _cb_pageflip;
|
||||
|
||||
ecore_drm2_output_user_data_set(ob->priv.output, ob);
|
||||
|
||||
ob->hdlr =
|
||||
ecore_main_fd_handler_add(ob->fd, ECORE_FD_READ, _cb_drm_event, ob,
|
||||
NULL, NULL);
|
||||
|
|
|
@ -80,7 +80,7 @@ evas_outbuf_page_flip(void *data, int fd EINA_UNUSED)
|
|||
if (next)
|
||||
{
|
||||
ecore_drm2_output_next_fb_set(ob->priv.output, NULL);
|
||||
if (ecore_drm2_fb_flip(next, ob->priv.output, ob) < 0)
|
||||
if (ecore_drm2_fb_flip(next, ob->priv.output) < 0)
|
||||
_outbuf_tick_source_set(NULL);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ _evas_outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
|
|||
if (fb)
|
||||
{
|
||||
ecore_drm2_fb_dirty(fb, rects, count);
|
||||
if (ecore_drm2_fb_flip(fb, ob->priv.output, ob) < 0)
|
||||
if (ecore_drm2_fb_flip(fb, ob->priv.output) < 0)
|
||||
_outbuf_tick_source_set(NULL);
|
||||
|
||||
/* Ecore_Drm2_Plane *plane; */
|
||||
|
@ -480,6 +480,7 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ecore_drm2_output_user_data_set(ob->priv.output, ob);
|
||||
_outbuf_tick_source_set(ob);
|
||||
|
||||
return ob;
|
||||
|
|
Loading…
Reference in New Issue