diff options
author | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2018-02-02 11:32:40 +0100 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2018-02-12 13:13:07 +0100 |
commit | c60cf3b51244334117c69db1f4665ff52815de03 (patch) | |
tree | d7d9acfae339678c5f3bf659ae9cc343b0af5711 /lib/igt_fb.c | |
parent | aa5068c58947f31252cad69d80686e40bbce29db (diff) |
lib/igt_fb: Add igt_fb_supported_format()
This makes it possible to iterate whether a format is supported or not,
without each driver having to open code it.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r-- | lib/igt_fb.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 35a928b9..0389b1c1 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1719,3 +1719,21 @@ void igt_get_all_cairo_formats(const uint32_t **formats, int *format_count) *formats = drm_formats; *format_count = n_formats; } + +/** + * igt_fb_supported_format: + * @drm_format: drm fourcc to test. + * + * This functions returns whether @drm_format can be succesfully created by + * igt_create_fb() and drawn to by igt_get_cairo_ctx(). + */ +bool igt_fb_supported_format(uint32_t drm_format) +{ + struct format_desc_struct *f; + + for_each_format(f) + if (f->drm_id == drm_format) + return f->cairo_id != CAIRO_FORMAT_INVALID; + + return false; +} |