forked from enlightenment/efl
ecore-drm2: Add API function to set output rotation
This patch adds a new API function that can be called from Enlightenment wl_drm module to enable output rotation. NB: Only works if Atomic support is enabled as it rotates the hardware plane directly...and we don't support planes without Atomic enabled. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
ca194584d5
commit
c126ce2e70
|
@ -757,6 +757,22 @@ EAPI void ecore_drm2_output_gamma_set(Ecore_Drm2_Output *output, uint16_t size,
|
||||||
*/
|
*/
|
||||||
EAPI int ecore_drm2_output_supported_rotations_get(Ecore_Drm2_Output *output);
|
EAPI int ecore_drm2_output_supported_rotations_get(Ecore_Drm2_Output *output);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a rotation on a given output
|
||||||
|
*
|
||||||
|
* @param output
|
||||||
|
* @param rotation
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE on success, EINA_FALSE otherwise
|
||||||
|
*
|
||||||
|
* @note This function will only work if Atomic support
|
||||||
|
* is enabled as it requires hardware plane support.
|
||||||
|
*
|
||||||
|
* @ingroup Ecore_Drm2_Output_Group
|
||||||
|
* @since 1.19
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool ecore_drm2_output_rotation_set(Ecore_Drm2_Output *output, int rotation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Ecore_Drm2_Fb_Group Drm framebuffer functions
|
* @defgroup Ecore_Drm2_Fb_Group Drm framebuffer functions
|
||||||
*
|
*
|
||||||
|
|
|
@ -1529,3 +1529,52 @@ ecore_drm2_output_supported_rotations_get(Ecore_Drm2_Output *output)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
ecore_drm2_output_rotation_set(Ecore_Drm2_Output *output, int rotation)
|
||||||
|
{
|
||||||
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
|
||||||
|
|
||||||
|
#ifdef HAVE_ATOMIC_DRM
|
||||||
|
if (_ecore_drm2_use_atomic)
|
||||||
|
{
|
||||||
|
Ecore_Drm2_Plane_State *pstate;
|
||||||
|
drmModeAtomicReq *req = NULL;
|
||||||
|
int res = 0;
|
||||||
|
uint32_t flags =
|
||||||
|
DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT |
|
||||||
|
DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
|
|
||||||
|
pstate = output->plane_state;
|
||||||
|
if ((pstate->supported_rotations & rotation) == 0)
|
||||||
|
{
|
||||||
|
WRN("Unsupported rotation");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
req = sym_drmModeAtomicAlloc();
|
||||||
|
if (!req) return EINA_FALSE;
|
||||||
|
|
||||||
|
sym_drmModeAtomicSetCursor(req, 0);
|
||||||
|
|
||||||
|
res = sym_drmModeAtomicAddProperty(req, pstate->obj_id,
|
||||||
|
pstate->rotation.id, rotation);
|
||||||
|
if (res < 0) goto err;
|
||||||
|
|
||||||
|
res = sym_drmModeAtomicCommit(output->fd, req, flags, output->user_data);
|
||||||
|
if (res < 0) goto err;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = EINA_TRUE;
|
||||||
|
pstate->rotation.value = rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
err:
|
||||||
|
sym_drmModeAtomicFree(req);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue