uterm: add uterm_video_available() helper
This helper provides information whether a given backend is available and even whether kernel-runtime support is available for this backend. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
b1c7902eeb
commit
3e1f9f0c61
@ -170,6 +170,7 @@ typedef void (*uterm_display_cb) (struct uterm_display *disp,
|
||||
/* misc */
|
||||
|
||||
const char *uterm_dpms_to_name(int dpms);
|
||||
bool uterm_video_available(unsigned int type);
|
||||
|
||||
/* screen interface */
|
||||
|
||||
|
@ -59,6 +59,29 @@ const char *uterm_dpms_to_name(int dpms)
|
||||
}
|
||||
}
|
||||
|
||||
bool uterm_video_available(unsigned int type)
|
||||
{
|
||||
switch (type) {
|
||||
case UTERM_VIDEO_DRM:
|
||||
#ifdef BUILD_ENABLE_VIDEO_DRM
|
||||
return video_drm_available();
|
||||
#endif
|
||||
return false;
|
||||
case UTERM_VIDEO_DUMB:
|
||||
#ifdef BUILD_ENABLE_VIDEO_DUMB
|
||||
return video_drm_available();
|
||||
#endif
|
||||
return false;
|
||||
case UTERM_VIDEO_FBDEV:
|
||||
#ifdef BUILD_ENABLE_VIDEO_FBDEV
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Until we allow multiple displays in one screen, we use this constructor which
|
||||
* is basically just a wrapper around "struct uterm_dispaly".
|
||||
* The idea behind screens is having one single drawing-target which is spread
|
||||
|
@ -466,6 +466,11 @@ static inline void video_drm_free_name(char *name)
|
||||
free(name);
|
||||
}
|
||||
|
||||
static inline bool video_drm_available(void)
|
||||
{
|
||||
return drmAvailable();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline char *video_drm_get_id(int fd)
|
||||
@ -486,6 +491,11 @@ static inline void video_drm_free_name(char *name)
|
||||
{
|
||||
}
|
||||
|
||||
bool video_drm_available(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* UTERM_VIDEO_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user