diff options
author | Praveen Paneri <praveen.paneri@intel.com> | 2017-07-18 22:52:57 +0530 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2017-07-25 12:07:50 -0300 |
commit | 4437e21f8a29ebb44cd8ca89ed76b9d784e252db (patch) | |
tree | ea923973cd8c7ae6bc6628c3715401193c1184df /lib/igt_fb.c | |
parent | 4bb45416a7a55d860ecaf656767ee15fe8128237 (diff) |
lib/igt_fb: Add helper function for tile_to_mod
igt_get_fb_tile_size function takes modifer as an argument
This helper function will let users to convert tiling to
modifier and use igt_get_fb_tile_size()
v2: Improved code comment (Paulo)
v3 (from Paulo): Simple rebase.
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r-- | lib/igt_fb.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c index c6291e62..fbdfca8a 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -217,6 +217,32 @@ uint64_t igt_fb_mod_to_tiling(uint64_t modifier) } } +/** + * igt_fb_tiling_to_mod: + * @tiling: DRM framebuffer tiling + * + * This function converts a DRM framebuffer tiling to its corresponding + * modifier constant. + * + * Returns: + * A modifier constant + */ +uint64_t igt_fb_tiling_to_mod(uint64_t tiling) +{ + switch (tiling) { + case I915_TILING_NONE: + return LOCAL_DRM_FORMAT_MOD_NONE; + case I915_TILING_X: + return LOCAL_I915_FORMAT_MOD_X_TILED; + case I915_TILING_Y: + return LOCAL_I915_FORMAT_MOD_Y_TILED; + case I915_TILING_Yf: + return LOCAL_I915_FORMAT_MOD_Yf_TILED; + default: + igt_assert(0); + } +} + /* helpers to create nice-looking framebuffers */ static int create_bo_for_fb(int fd, int width, int height, uint32_t format, uint64_t tiling, unsigned size, unsigned stride, |