All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit
@ 2018-09-10 15:34 Ville Syrjala
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Ville Syrjala @ 2018-09-10 15:34 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Switch all fb size handling to 64bits to accomodate >4GiB
framebuffers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c                     | 32 ++++++++++++++++++--------------
 lib/igt_fb.h                     |  8 ++++----
 lib/igt_kms.c                    |  4 ++--
 lib/igt_kms.h                    |  2 +-
 tests/kms_frontbuffer_tracking.c |  3 ++-
 tests/kms_rotation_crc.c         |  3 ++-
 6 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 1085d25d33ce..7c71e52a472b 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -215,7 +215,7 @@ static unsigned planar_height(struct format_desc_struct *format, unsigned height
 
 static void calc_fb_size_planar(int fd, int width, int height,
 				struct format_desc_struct *format,
-				uint64_t tiling, unsigned *size_ret,
+				uint64_t tiling, uint64_t *size_ret,
 				unsigned *stride_ret, unsigned *offsets)
 {
 	int plane;
@@ -251,9 +251,10 @@ static void calc_fb_size_planar(int fd, int width, int height,
 
 static void calc_fb_size_packed(int fd, int width, int height,
 				struct format_desc_struct *format, uint64_t tiling,
-				unsigned *size_ret, unsigned *stride_ret)
+				uint64_t *size_ret, unsigned *stride_ret)
 {
-	unsigned int tile_width, tile_height, stride, size;
+	unsigned int tile_width, tile_height, stride;
+	uint64_t size;
 	int byte_width = width * (format->plane_bpp[0] / 8);
 
 	igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0], &tile_width, &tile_height);
@@ -279,7 +280,7 @@ static void calc_fb_size_packed(int fd, int width, int height,
 			;
 	} else {
 		stride = ALIGN(byte_width, tile_width);
-		size = stride * ALIGN(height, tile_height);
+		size = (uint64_t) stride * ALIGN(height, tile_height);
 	}
 
 	*stride_ret = stride;
@@ -300,7 +301,7 @@ static void calc_fb_size_packed(int fd, int width, int height,
  * specified parameters.
  */
 void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t tiling,
-		      unsigned *size_ret, unsigned *stride_ret)
+		      uint64_t *size_ret, unsigned *stride_ret)
 {
 	struct format_desc_struct *format = lookup_drm_format(drm_format);
 	igt_assert(format);
@@ -368,8 +369,8 @@ static int create_bo_for_fb(int fd, int width, int height,
 			    enum igt_color_encoding color_encoding,
 			    enum igt_color_range color_range,
 			    struct format_desc_struct *format,
-			    uint64_t tiling, unsigned size, unsigned stride,
-			    unsigned *size_ret, unsigned *stride_ret,
+			    uint64_t tiling, uint64_t size, unsigned stride,
+			    uint64_t *size_ret, unsigned *stride_ret,
 			    uint32_t *offsets, bool *is_dumb)
 {
 	int bo;
@@ -380,7 +381,8 @@ static int create_bo_for_fb(int fd, int width, int height,
 		memset(offsets, 0, ARRAY_SIZE(format->plane_bpp) * sizeof(*offsets));
 
 	if (tiling || size || stride || igt_format_is_yuv(format->drm_id)) {
-		unsigned calculated_size, calculated_stride;
+		uint64_t calculated_size;
+		unsigned int calculated_stride;
 
 		if (format->num_planes > 1)
 			calc_fb_size_planar(fd, width, height, format, tiling,
@@ -474,7 +476,7 @@ static int create_bo_for_fb(int fd, int width, int height,
  */
 int igt_create_bo_with_dimensions(int fd, int width, int height,
 				  uint32_t format, uint64_t modifier,
-				  unsigned stride, unsigned *size_ret,
+				  unsigned stride, uint64_t *size_ret,
 				  unsigned *stride_ret, bool *is_dumb)
 {
 	return create_bo_for_fb(fd, width, height,
@@ -819,7 +821,7 @@ void igt_paint_image(cairo_t *cr, const char *filename,
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
 			   uint32_t format, uint64_t tiling,
-			   struct igt_fb *fb, unsigned bo_size,
+			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride)
 {
 	/* FIXME allow the caller to pass these in */
@@ -833,7 +835,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 	memset(fb, 0, sizeof(*fb));
 
-	igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%d)\n",
+	igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%"PRIu64")\n",
 		  __func__, width, height, format, tiling, bo_size);
 	fb->gem_handle = create_bo_for_fb(fd, width, height,
 					  color_encoding, color_range,
@@ -1191,8 +1193,9 @@ static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
 }
 
 struct fb_blit_linear {
+	uint64_t size;
 	uint32_t handle;
-	unsigned size, stride;
+	unsigned int stride;
 	uint8_t *map;
 	bool is_dumb;
 	uint32_t offsets[4];
@@ -1371,8 +1374,9 @@ struct fb_convert_blit_upload {
 	struct igt_fb *fb;
 
 	struct {
+		uint64_t size;
 		uint8_t *map;
-		unsigned stride, size;
+		unsigned stride;
 	} rgb24;
 
 	struct fb_blit_linear linear;
@@ -1787,7 +1791,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->fd = fd;
 	blit->fb = fb;
 	blit->rgb24.stride = ALIGN(fb->width * 4, 16);
-	blit->rgb24.size = ALIGN(blit->rgb24.stride * fb->height, sysconf(_SC_PAGESIZE));
+	blit->rgb24.size = ALIGN((uint64_t) blit->rgb24.stride * fb->height, sysconf(_SC_PAGESIZE));
 	blit->rgb24.map = mmap(NULL, blit->rgb24.size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 	igt_assert(blit->rgb24.map != MAP_FAILED);
 
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index d28bc0c4110a..2343fe505f28 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -72,7 +72,7 @@ typedef struct igt_fb {
 	enum igt_color_range color_range;
 	unsigned int stride;
 	uint64_t tiling;
-	unsigned int size;
+	uint64_t size;
 	cairo_surface_t *cairo_surface;
 	unsigned int domain;
 	unsigned int num_planes;
@@ -105,11 +105,11 @@ enum igt_text_align {
 void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret);
 void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t tiling,
-		      unsigned *size_ret, unsigned *stride_ret);
+		      uint64_t *size_ret, unsigned *stride_ret);
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
 			   uint32_t format, uint64_t tiling,
-			   struct igt_fb *fb, unsigned bo_size,
+			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride);
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
 			   uint64_t tiling, struct igt_fb *fb);
@@ -135,7 +135,7 @@ int igt_dirty_fb(int fd, struct igt_fb *fb);
 
 int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format,
 				  uint64_t modifier, unsigned stride,
-				  unsigned *stride_ret, unsigned *size_ret,
+				  uint64_t *size_ret, unsigned *stride_ret,
 				  bool *is_dumb);
 
 uint64_t igt_fb_mod_to_tiling(uint64_t modifier);
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 62d8468415c6..4563bfd9d25b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -592,7 +592,7 @@ uint32_t kmstest_find_crtc_for_connector(int fd, drmModeRes *res,
  * Returns: The file-private handle of the created buffer object
  */
 uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp,
-			     unsigned *stride, unsigned *size)
+			     unsigned *stride, uint64_t *size)
 {
 	struct drm_mode_create_dumb create;
 
@@ -604,7 +604,7 @@ uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp,
 	create.handle = 0;
 	do_ioctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &create);
 	igt_assert(create.handle);
-	igt_assert(create.size >= width * height * bpp / 8);
+	igt_assert(create.size >= (uint64_t) width * height * bpp / 8);
 
 	if (stride)
 		*stride = create.pitch;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3a12f2782eed..3862efa28be0 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -218,7 +218,7 @@ uint32_t kmstest_find_crtc_for_connector(int fd, drmModeRes *res,
 					 uint32_t crtc_blacklist_idx_mask);
 
 uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp,
-			     unsigned *stride, unsigned *size);
+			     unsigned *stride, uint64_t *size);
 
 void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
 			      unsigned prot);
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index e9abceb66843..b33f3128a931 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -465,7 +465,8 @@ static void create_fb(enum pixel_format pformat, int width, int height,
 		      uint64_t tiling, int plane, struct igt_fb *fb)
 {
 	uint32_t format;
-	unsigned int size, stride;
+	uint64_t size;
+	unsigned int stride;
 	uint64_t tiling_for_size;
 
 	switch (pformat) {
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5ed0c0b36adc..f73c6a399cb8 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -403,7 +403,8 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	int fd = data->gfx_fd;
 	drmModeModeInfo *mode;
 	struct igt_fb fb[MAX_FENCES+1] = {};
-	unsigned int stride, size, w, h;
+	uint64_t size;
+	unsigned int stride, w, h;
 	uint64_t total_aperture_size, total_fbs_size;
 	int i;
 
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers
  2018-09-10 15:34 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Ville Syrjala
@ 2018-09-10 15:34 ` Ville Syrjala
  2018-09-10 15:45   ` Chris Wilson
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two() Ville Syrjala
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Ville Syrjala @ 2018-09-10 15:34 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The blitter stride is limited to <32k. Fall back to gtt mmap if we're
about to exceed that.

This won't work for Yf as the fence doesn't know about Yf. So for that
case we'd need to use cpu mmap and (de)tile manually. For now just
pretend that there is no problem.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 7c71e52a472b..26720a7bc2ac 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1795,8 +1795,9 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->rgb24.map = mmap(NULL, blit->rgb24.size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 	igt_assert(blit->rgb24.map != MAP_FAILED);
 
-	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
+	if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+	     fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
+	    fb->stride < 32768) {
 		setup_linear_mapping(fd, fb, &blit->linear);
 	} else {
 		blit->linear.handle = 0;
@@ -1853,8 +1854,9 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 	if (fb->cairo_surface == NULL) {
 		if (igt_format_is_yuv(fb->drm_format))
 			create_cairo_surface__convert(fd, fb);
-		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-		    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+			  fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
+			 fb->stride < 32768)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two()
  2018-09-10 15:34 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Ville Syrjala
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
@ 2018-09-10 15:34 ` Ville Syrjala
  2018-09-10 15:42   ` Chris Wilson
  2018-09-10 16:32 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Chris Wilson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Ville Syrjala @ 2018-09-10 15:34 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a helper to round a value to the next power of two size.

And since we need fls() to implement that, reuse that elsewhere
as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_aux.h          |  6 ++++++
 lib/igt_fb.c           | 12 ++++--------
 tests/gem_exec_reuse.c | 12 +-----------
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index ef89faa9bd30..192c3ad88658 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -287,4 +287,10 @@ void igt_lsof(const char *dpath);
 
 #define is_power_of_two(x)  (((x) & ((x)-1)) == 0)
 
+#define igt_fls(x) ((x) ? __builtin_choose_expr(sizeof(x) == 8, \
+						64 - __builtin_clzll(x), \
+						32 - __builtin_clz(x)) : 0)
+
+#define roundup_power_of_two(x) ((x) != 0 ? 1 << igt_fls((x) - 1) : 0)
+
 #endif /* IGT_AUX_H */
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 26720a7bc2ac..4af1881de959 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -261,8 +261,6 @@ static void calc_fb_size_packed(int fd, int width, int height,
 
 	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
-		int v;
-
 		/* Round the tiling up to the next power-of-two and the region
 		 * up to the next pot fence size so that this works on all
 		 * generations.
@@ -271,13 +269,11 @@ static void calc_fb_size_packed(int fd, int width, int height,
 		 * tiled. But then that failure is expected.
 		 */
 
-		v = byte_width;
-		for (stride = 512; stride < v; stride *= 2)
-			;
+		stride = max(byte_width, 512);
+		stride = roundup_power_of_two(stride);
 
-		v = stride * height;
-		for (size = 1024*1024; size < v; size *= 2)
-			;
+		size = max((uint64_t) stride * height, 1024*1024);
+		size = roundup_power_of_two(size);
 	} else {
 		stride = ALIGN(byte_width, tile_width);
 		size = (uint64_t) stride * ALIGN(height, tile_height);
diff --git a/tests/gem_exec_reuse.c b/tests/gem_exec_reuse.c
index 8ee38d2b6f20..df220be7bab8 100644
--- a/tests/gem_exec_reuse.c
+++ b/tests/gem_exec_reuse.c
@@ -56,16 +56,6 @@ static void noop(struct noop *n,
 	gem_execbuf(n->fd, &execbuf);
 }
 
-static int fls(uint64_t x)
-{
-	int t;
-
-	for (t = 0; x >> t; t++)
-		;
-
-	return t;
-}
-
 static bool allow_unlimited_files(void)
 {
 	struct rlimit rlim;
@@ -151,7 +141,7 @@ igt_main
 		if (max < gtt_size)
 			gtt_size = max;
 
-		no.nhandles = 1 << (fls(gtt_size) - 1);
+		no.nhandles = 1 << (igt_fls(gtt_size) - 1);
 		intel_require_memory(no.nhandles, 4096, CHECK_RAM);
 
 		no.max_age = no.nhandles / 2;
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two()
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two() Ville Syrjala
@ 2018-09-10 15:42   ` Chris Wilson
  2018-09-10 15:55     ` Ville Syrjälä
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Wilson @ 2018-09-10 15:42 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Quoting Ville Syrjala (2018-09-10 16:34:07)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a helper to round a value to the next power of two size.
> 
> And since we need fls() to implement that, reuse that elsewhere
> as well.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Looks reasonable. There should be a few more fls around, it tends to be
useful.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

> ---
>  lib/igt_aux.h          |  6 ++++++
>  lib/igt_fb.c           | 12 ++++--------
>  tests/gem_exec_reuse.c | 12 +-----------
>  3 files changed, 11 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index ef89faa9bd30..192c3ad88658 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -287,4 +287,10 @@ void igt_lsof(const char *dpath);
>  
>  #define is_power_of_two(x)  (((x) & ((x)-1)) == 0)
>  
> +#define igt_fls(x) ((x) ? __builtin_choose_expr(sizeof(x) == 8, \
> +                                               64 - __builtin_clzll(x), \
> +                                               32 - __builtin_clz(x)) : 0)

Though I wonder if __builtin_types_compatible_p(typeof(x), long long)
would be better (then we could have the long long; long; int cascade).
I've failed every time I tried to use types_compatible, maybe you'll
have better luck :)
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
@ 2018-09-10 15:45   ` Chris Wilson
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2018-09-10 15:45 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Quoting Ville Syrjala (2018-09-10 16:34:06)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The blitter stride is limited to <32k. Fall back to gtt mmap if we're
> about to exceed that.

True. I was going to say that fb->tiling implied you could use 128k, but
realised that you wanted to blit to linear. A comment would have saved a
moment's confusion/objection.
 
> This won't work for Yf as the fence doesn't know about Yf. So for that
> case we'd need to use cpu mmap and (de)tile manually. For now just
> pretend that there is no problem.

Throw in a warning? If it doesn't cause the test to fail, our test
didn't need all those pixels :)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two()
  2018-09-10 15:42   ` Chris Wilson
@ 2018-09-10 15:55     ` Ville Syrjälä
  0 siblings, 0 replies; 9+ messages in thread
From: Ville Syrjälä @ 2018-09-10 15:55 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Mon, Sep 10, 2018 at 04:42:12PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjala (2018-09-10 16:34:07)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Add a helper to round a value to the next power of two size.
> > 
> > And since we need fls() to implement that, reuse that elsewhere
> > as well.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Looks reasonable. There should be a few more fls around, it tends to be
> useful.

Right. There were some under tools IIRC, implemented in inline asm. 
Didn't bother figuring out what they're used for so I just changed
the name in igt_aux.h to igt_fls() to avoid the clash and moved on.

> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> > ---
> >  lib/igt_aux.h          |  6 ++++++
> >  lib/igt_fb.c           | 12 ++++--------
> >  tests/gem_exec_reuse.c | 12 +-----------
> >  3 files changed, 11 insertions(+), 19 deletions(-)
> > 
> > diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> > index ef89faa9bd30..192c3ad88658 100644
> > --- a/lib/igt_aux.h
> > +++ b/lib/igt_aux.h
> > @@ -287,4 +287,10 @@ void igt_lsof(const char *dpath);
> >  
> >  #define is_power_of_two(x)  (((x) & ((x)-1)) == 0)
> >  
> > +#define igt_fls(x) ((x) ? __builtin_choose_expr(sizeof(x) == 8, \
> > +                                               64 - __builtin_clzll(x), \
> > +                                               32 - __builtin_clz(x)) : 0)
> 
> Though I wonder if __builtin_types_compatible_p(typeof(x), long long)
> would be better (then we could have the long long; long; int cascade).
> I've failed every time I tried to use types_compatible, maybe you'll
> have better luck :)
> -Chris

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit
  2018-09-10 15:34 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Ville Syrjala
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
  2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two() Ville Syrjala
@ 2018-09-10 16:32 ` Chris Wilson
  2018-09-10 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
  2018-09-10 19:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2018-09-10 16:32 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev

Quoting Ville Syrjala (2018-09-10 16:34:05)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Switch all fb size handling to 64bits to accomodate >4GiB
> framebuffers.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Without doing an exhaustive check on what is missing, the fact that we
change an outparam to uint64_t* gives a lot of confidence in the
compiler catching missed conversions.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_fb: Make fb size 64bit
  2018-09-10 15:34 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Ville Syrjala
                   ` (2 preceding siblings ...)
  2018-09-10 16:32 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Chris Wilson
@ 2018-09-10 17:25 ` Patchwork
  2018-09-10 19:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-09-10 17:25 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/3] lib/igt_fb: Make fb size 64bit
URL   : https://patchwork.freedesktop.org/series/49435/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4791 -> IGTPW_1819 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49435/revisions/1/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1819 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@amdgpu/amd_basic@userptr:
      fi-kbl-8809g:       NOTRUN -> INCOMPLETE (fdo#107402)

    igt@drv_selftest@live_guc:
      fi-cfl-guc:         PASS -> DMESG-WARN (fdo#107258)

    igt@gem_exec_suspend@basic-s3:
      fi-skl-caroline:    NOTRUN -> INCOMPLETE (fdo#107556, fdo#104108)
      fi-kbl-soraka:      NOTRUN -> INCOMPLETE (fdo#107774, fdo#107556)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362, fdo#103191)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    
    ==== Possible fixes ====

    igt@amdgpu/amd_basic@cs-sdma:
      fi-skl-6700k2:      FAIL (fdo#107888) -> SKIP +7

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> PASS

    igt@kms_psr@primary_page_flip:
      fi-whl-u:           FAIL (fdo#107336) -> PASS

    
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
  fdo#107258 https://bugs.freedesktop.org/show_bug.cgi?id=107258
  fdo#107336 https://bugs.freedesktop.org/show_bug.cgi?id=107336
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107402 https://bugs.freedesktop.org/show_bug.cgi?id=107402
  fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556
  fdo#107774 https://bugs.freedesktop.org/show_bug.cgi?id=107774
  fdo#107888 https://bugs.freedesktop.org/show_bug.cgi?id=107888


== Participating hosts (46 -> 47) ==

  Additional (5): fi-kbl-soraka fi-skl-caroline fi-blb-e6850 fi-glk-dsi fi-kbl-8809g 
  Missing    (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4636 -> IGTPW_1819

  CI_DRM_4791: 07cf212bc704357ee60aba52ec40bab538222040 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1819: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1819/
  IGT_4636: 40de31df52ffed5e392d607a83e3aea4efb150e6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1819/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/3] lib/igt_fb: Make fb size 64bit
  2018-09-10 15:34 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Ville Syrjala
                   ` (3 preceding siblings ...)
  2018-09-10 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
@ 2018-09-10 19:56 ` Patchwork
  4 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-09-10 19:56 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/3] lib/igt_fb: Make fb size 64bit
URL   : https://patchwork.freedesktop.org/series/49435/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4636_full -> IGTPW_1819_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1819_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1819_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49435/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1819_full:

  === IGT changes ===

    ==== Warnings ====

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

    igt@pm_rc6_residency@rc6-accuracy:
      shard-snb:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1819_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_big:
      shard-hsw:          PASS -> INCOMPLETE (fdo#103540)

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-snb:          NOTRUN -> FAIL (fdo#107749)

    igt@kms_setmode@basic:
      shard-kbl:          PASS -> FAIL (fdo#99912)

    igt@perf_pmu@rc6-runtime-pm:
      shard-apl:          PASS -> FAIL (fdo#105010)

    igt@testdisplay:
      shard-glk:          PASS -> INCOMPLETE (fdo#103359, k.org#198133, fdo#107093)

    
    ==== Possible fixes ====

    igt@gem_exec_reuse@baggage:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-snb:          FAIL (fdo#106641) -> PASS

    igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
      shard-hsw:          FAIL (fdo#105767) -> PASS

    igt@kms_cursor_legacy@cursor-vs-flip-legacy:
      shard-hsw:          FAIL (fdo#103355) -> PASS

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

    
  fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#105010 https://bugs.freedesktop.org/show_bug.cgi?id=105010
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#107093 https://bugs.freedesktop.org/show_bug.cgi?id=107093
  fdo#107749 https://bugs.freedesktop.org/show_bug.cgi?id=107749
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4636 -> IGTPW_1819
    * Linux: CI_DRM_4787 -> CI_DRM_4791

  CI_DRM_4787: 6dc8457a2f2093eecb9c6cbb7306fd25bb1664e6 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4791: 07cf212bc704357ee60aba52ec40bab538222040 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1819: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1819/
  IGT_4636: 40de31df52ffed5e392d607a83e3aea4efb150e6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1819/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-09-10 19:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 15:34 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Ville Syrjala
2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
2018-09-10 15:45   ` Chris Wilson
2018-09-10 15:34 ` [igt-dev] [PATCH i-g-t 3/3] lib: Add roundup_power_of_two() Ville Syrjala
2018-09-10 15:42   ` Chris Wilson
2018-09-10 15:55     ` Ville Syrjälä
2018-09-10 16:32 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Make fb size 64bit Chris Wilson
2018-09-10 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2018-09-10 19:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.