ecore_drm2: Move atomic state into an output state struct

This should make it easier to share code paths between atomic and non
atomic operations.
This commit is contained in:
Derek Foreman 2017-04-27 16:02:59 -05:00
parent 6482367aa2
commit 63dbf061a9
3 changed files with 26 additions and 11 deletions

View File

@ -321,16 +321,16 @@ _fb_atomic_flip_test(Ecore_Drm2_Output *output)
if (res)
{
if (output->atomic_req)
if (output->prep.atomic_req)
{
/* clear any previous request */
sym_drmModeAtomicFree(output->atomic_req);
sym_drmModeAtomicFree(output->prep.atomic_req);
/* just use the new request */
output->atomic_req = req;
output->prep.atomic_req = req;
}
else
output->atomic_req = req;
output->prep.atomic_req = req;
}
return res;
@ -351,10 +351,11 @@ _fb_atomic_flip(Ecore_Drm2_Output *output)
DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT |
DRM_MODE_ATOMIC_ALLOW_MODESET;
if (!output->atomic_req) return -1;
if (!output->prep.atomic_req) return -1;
res =
sym_drmModeAtomicCommit(output->fd, output->atomic_req, flags, NULL);
sym_drmModeAtomicCommit(output->fd,
output->prep.atomic_req, flags, NULL);
if (res < 0)
{
ERR("Failed Atomic Commit: %m");

View File

@ -898,8 +898,8 @@ _output_destroy(Ecore_Drm2_Device *dev, Ecore_Drm2_Output *output)
#ifdef HAVE_ATOMIC_DRM
if (_ecore_drm2_use_atomic)
{
if (output->atomic_req)
sym_drmModeAtomicFree(output->atomic_req);
if (output->prep.atomic_req)
sym_drmModeAtomicFree(output->prep.atomic_req);
}
#endif

View File

@ -723,6 +723,19 @@ struct _Ecore_Drm2_Output_Mode
drmModeModeInfo info;
};
/* A half step - we still keep an fb for the canvas
* and an atomic_req for all atomic state (including
* the canvas fb).
* The non atomic code only uses the canvas fb.
*/
typedef struct _Ecore_Drm2_Output_State
{
Ecore_Drm2_Fb *fb;
# ifdef HAVE_ATOMIC_DRM
drmModeAtomicReq *atomic_req;
# endif
} Ecore_Drm2_Output_State;
struct _Ecore_Drm2_Output
{
Eina_Stringshare *name;
@ -755,6 +768,10 @@ struct _Ecore_Drm2_Output
drmModeCrtcPtr ocrtc;
/* prep is for state we're preparing and have never
* attempted to commit */
Ecore_Drm2_Output_State prep;
Ecore_Drm2_Fb *current, *next, *pending;
Eina_Matrix4 matrix, inverse;
@ -776,9 +793,6 @@ struct _Ecore_Drm2_Output
Eina_List *plane_states;
Eina_List *planes;
# ifdef HAVE_ATOMIC_DRM
drmModeAtomicReq *atomic_req;
# endif
Eina_Bool connected : 1;
Eina_Bool primary : 1;