Message ID | 1493390254-5232-3-git-send-email-praveen.paneri@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Em Sex, 2017-04-28 às 20:07 +0530, Praveen Paneri escreveu: > 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() > > Signed-off-by: Praveen Paneri <praveen.paneri@intel.com> > --- > lib/igt_fb.c | 26 ++++++++++++++++++++++++++ > lib/igt_fb.h | 1 + > 2 files changed, 27 insertions(+) > > diff --git a/lib/igt_fb.c b/lib/igt_fb.c > index 9ba1e3b..27baf79 100644 > --- a/lib/igt_fb.c > +++ b/lib/igt_fb.c > @@ -216,6 +216,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 tiling constant A modifier constant. Besides this, the patch looks good. > + */ > +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, > diff --git a/lib/igt_fb.h b/lib/igt_fb.h > index 414cb3d..a01671b 100644 > --- a/lib/igt_fb.h > +++ b/lib/igt_fb.h > @@ -131,6 +131,7 @@ int igt_create_bo_with_dimensions(int fd, int > width, int height, uint32_t format > bool *is_dumb); > > uint64_t igt_fb_mod_to_tiling(uint64_t modifier); > +uint64_t igt_fb_tiling_to_mod(uint64_t tiling); > > /* cairo-based painting */ > cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);
diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 9ba1e3b..27baf79 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -216,6 +216,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 tiling 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, diff --git a/lib/igt_fb.h b/lib/igt_fb.h index 414cb3d..a01671b 100644 --- a/lib/igt_fb.h +++ b/lib/igt_fb.h @@ -131,6 +131,7 @@ int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format bool *is_dumb); uint64_t igt_fb_mod_to_tiling(uint64_t modifier); +uint64_t igt_fb_tiling_to_mod(uint64_t tiling); /* cairo-based painting */ cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);
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() Signed-off-by: Praveen Paneri <praveen.paneri@intel.com> --- lib/igt_fb.c | 26 ++++++++++++++++++++++++++ lib/igt_fb.h | 1 + 2 files changed, 27 insertions(+)