ecore_drm2: Add API function to return if a possible crtc
This commit is contained in:
parent
0272285970
commit
d8e6231f96
|
@ -81,6 +81,7 @@ EAPI int ecore_drm2_display_rotation_get(Ecore_Drm2_Display *disp);
|
|||
EAPI void ecore_drm2_display_rotation_set(Ecore_Drm2_Display *disp, uint64_t rotation);
|
||||
EAPI void ecore_drm2_display_mode_set(Ecore_Drm2_Display *disp, Ecore_Drm2_Display_Mode *mode, int x, int y);
|
||||
EAPI Ecore_Drm2_Crtc *ecore_drm2_display_crtc_get(Ecore_Drm2_Display *disp);
|
||||
EAPI Eina_Bool ecore_drm2_display_possible_crtc_get(Ecore_Drm2_Display *disp, Ecore_Drm2_Crtc *crtc);
|
||||
|
||||
# endif
|
||||
|
||||
|
|
|
@ -883,3 +883,35 @@ ecore_drm2_display_crtc_get(Ecore_Drm2_Display *disp)
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(disp, NULL);
|
||||
return disp->crtc;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_drm2_display_possible_crtc_get(Ecore_Drm2_Display *disp, Ecore_Drm2_Crtc *crtc)
|
||||
{
|
||||
drmModeConnector *conn;
|
||||
drmModeEncoder *enc;
|
||||
int i = 0;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(disp, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(disp->conn, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(disp->conn->drmConn, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(crtc, EINA_FALSE);
|
||||
|
||||
conn = disp->conn->drmConn;
|
||||
for (; i < conn->count_encoders; i++)
|
||||
{
|
||||
enc = sym_drmModeGetEncoder(disp->conn->fd, conn->encoders[i]);
|
||||
if (!enc) continue;
|
||||
|
||||
if (enc->crtc_id != crtc->id) goto next;
|
||||
|
||||
if (enc->possible_crtcs & (1 << crtc->pipe))
|
||||
ret = EINA_TRUE;
|
||||
|
||||
next:
|
||||
sym_drmModeFreeEncoder(enc);
|
||||
if (ret) break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue