Skip to contentSkip to conversation

igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs

PATCH In review Imre Deak 3 participants 5 messages Dec 8, 2017 – Dec 11, 2017 Library code

lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs

When drawing with cairo to Y/Yf tiled FBs we use a temporary linear buffer which is mapped to the CPU, but the fast blit needed for this only expects 32 bpp FBs. Add support for other bpps too.

This is needed for upcoming patches testing non-32bit bpp formats with Y/Yf tiling.

Thanks to Ville for explaining why we need the temporary buffer. (Looks like for Y tiling we could do without, but that's a separate topic.)

Cc Ville Syrjälä <[email protected]>
Cc Chris Wilson <[email protected]>
---
 lib/igt_fb.c            |  2 ++
 lib/intel_batchbuffer.c | 33 +++++++++++++++++++++++++++++----
 lib/intel_batchbuffer.h |  4 ++++
 lib/intel_reg.h         |  4 ++++
 4 files changed, 39 insertions(+), 4 deletions(-)
lib/igt_fb.c +2 -0
index d4eaed71..dcae07df 100644
@@ -1043,6 +1043,7 @@ static void destroy_cairo_surface__blit(void *arg)
 				   I915_TILING_NONE,
 				   0, 0, /* src_x, src_y */
 				   fb->width, fb->height,
+				   igt_drm_format_to_bpp(fb->drm_format),
 				   fb->gem_handle,
 				   fb->stride,
 				   obj_tiling,
@@ -1090,6 +1091,7 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 				   obj_tiling,
 				   0, 0, /* src_x, src_y */
 				   fb->width, fb->height,
+				   igt_drm_format_to_bpp(fb->drm_format),
 				   blit->linear.handle,
 				   blit->linear.stride,
 				   I915_TILING_NONE,
lib/intel_batchbuffer.c +29 -4
index 53449894..9a53b6f8 100644
@@ -519,7 +519,8 @@ static uint32_t fast_copy_dword0(unsigned int src_tiling,
 }
 
 static uint32_t fast_copy_dword1(unsigned int src_tiling,
-				 unsigned int dst_tiling)
+				 unsigned int dst_tiling,
+				 int bpp)
 {
 	uint32_t dword1 = 0;
 
@@ -528,7 +529,25 @@ static uint32_t fast_copy_dword1(unsigned int src_tiling,
 	if (dst_tiling == I915_TILING_Yf)
 		dword1 |= XY_FAST_COPY_DST_TILING_Yf;
 
-	dword1 |= XY_FAST_COPY_COLOR_DEPTH_32;
+	switch (bpp) {
+	case 8:
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_8;
+		break;
+	case 16:
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_16;
+		break;
+	case 32:
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_32;
+		break;
+	case 64:
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_64;
+		break;
+	case 128:
+		dword1 |= XY_FAST_COPY_COLOR_DEPTH_128;
+		break;
+	default:
+		igt_assert(0);
+	}
 
 	return dword1;
 }
@@ -586,6 +605,7 @@ static void exec_blit(int fd,
  * @src_y: Y coordinate of the source region to copy
  * @width: Width of the region to copy
  * @height: Height of the region to copy
+ * @bpp: source and destination bits per pixel
  * @dst_handle: GEM handle of the source buffer
  * @dst_stride: Stride (in bytes) of the destination buffer
  * @dst_tiling: Tiling mode of the destination buffer
@@ -604,6 +624,9 @@ void igt_blitter_fast_copy__raw(int fd,
 				/* size */
 				unsigned int width, unsigned int height,
 
+				/* bpp */
+				int bpp,
+
 				/* dst */
 				uint32_t dst_handle,
 				unsigned int dst_stride,
@@ -621,7 +644,7 @@ void igt_blitter_fast_copy__raw(int fd,
 	src_pitch = fast_copy_pitch(src_stride, src_tiling);
 	dst_pitch = fast_copy_pitch(dst_stride, dst_tiling);
 	dword0 = fast_copy_dword0(src_tiling, dst_tiling);
-	dword1 = fast_copy_dword1(src_tiling, dst_tiling);
+	dword1 = fast_copy_dword1(src_tiling, dst_tiling, bpp);
 
 #define CHECK_RANGE(x)	((x) >= 0 && (x) < (1 << 15))
 	assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
@@ -671,6 +694,7 @@ void igt_blitter_fast_copy__raw(int fd,
  * @src_y: source pixel y-coordination
  * @width: width of the copied rectangle
  * @height: height of the copied rectangle
+ * @bpp: source and destination bits per pixel
  * @dst: destination i-g-t buffer object
  * @dst_x: destination pixel x-coordination
  * @dst_y: destination pixel y-coordination
@@ -682,6 +706,7 @@ void igt_blitter_fast_copy__raw(int fd,
 void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 			   struct igt_buf *src, unsigned src_x, unsigned src_y,
 			   unsigned width, unsigned height,
+			   int bpp,
 			   struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	uint32_t src_pitch, dst_pitch;
@@ -690,7 +715,7 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 	src_pitch = fast_copy_pitch(src->stride, src->tiling);
 	dst_pitch = fast_copy_pitch(dst->stride, src->tiling);
 	dword0 = fast_copy_dword0(src->tiling, dst->tiling);
-	dword1 = fast_copy_dword1(src->tiling, dst->tiling);
+	dword1 = fast_copy_dword1(src->tiling, dst->tiling, bpp);
 
 #define CHECK_RANGE(x)	((x) >= 0 && (x) < (1 << 15))
 	assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
lib/intel_batchbuffer.h +4 -0
index 869747db..6bee4167 100644
@@ -228,6 +228,7 @@ unsigned igt_buf_height(struct igt_buf *buf);
 void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
+			  int bpp,
 			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 
 void igt_blitter_fast_copy__raw(int fd,
@@ -240,6 +241,9 @@ void igt_blitter_fast_copy__raw(int fd,
 				/* size */
 				unsigned int width, unsigned int height,
 
+				/* bpp */
+				int bpp,
+
 				/* dst */
 				uint32_t dst_handle,
 				unsigned int dst_stride,
lib/intel_reg.h +4 -0
index 3a28c08c..f85fb742 100644
@@ -2530,7 +2530,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* dword 1 */
 #define   XY_FAST_COPY_SRC_TILING_Yf			(1 <<  31)
 #define   XY_FAST_COPY_DST_TILING_Yf			(1 <<  30)
+#define   XY_FAST_COPY_COLOR_DEPTH_8			(0  << 24)
+#define   XY_FAST_COPY_COLOR_DEPTH_16			(1  << 24)
 #define   XY_FAST_COPY_COLOR_DEPTH_32			(3  << 24)
+#define   XY_FAST_COPY_COLOR_DEPTH_64			(4  << 24)
+#define   XY_FAST_COPY_COLOR_DEPTH_128			(5  << 24)
 
 #define MI_STORE_DWORD_IMM		((0x20<<23)|2)
 #define   MI_MEM_VIRTUAL	(1 << 22) /* 965+ only */
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs

== Series Details ==

== Series Details ==

Series: igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs
URL : https://patchwork.freedesktop.org/series/35093/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 2fc64acf8a4465d5eab3d6cfec9b3c1b5df30d73 igt/perf_pmu: Tweak wait_for_rc6, yet again

with latest DRM-Tip kernel build CI_DRM_3483
b5f297e08432 drm-tip: 2017y-12m-08d-13h-53m-36s UTC integration manifest

No testlist changes.

Test gem_mmap_gtt:

        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:442s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:387s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:528s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:507s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:506s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:492s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:478s
fi-elk-e7500     total:224  pass:163  dwarn:15  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:178  dwarn:1   dfail:0   fail:1   skip:108 time:278s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:549s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:362s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:259s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:398s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:482s
fi-ivb-3770      total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:452s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:487s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:532s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:534s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:542s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:577s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:522s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:508s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:449s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:552s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:415s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:610s
fi-cnl-y         total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:655s
fi-glk-dsi       total:15   pass:14   dwarn:0   dfail:0   fail:0   skip:0  

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_625/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#2 lore raw
In reply to Imre Deak

Quoting Imre Deak (2017-12-08 14:53:41)

Quoted 7 lines

When drawing with cairo to Y/Yf tiled FBs we use a temporary linear buffer which is mapped to the CPU, but the fast blit needed for this only expects 32 bpp FBs. Add support for other bpps too.

This is needed for upcoming patches testing non-32bit bpp formats with Y/Yf tiling.

Quoted 6 lines

Thanks to Ville for explaining why we need the temporary buffer. (Looks like for Y tiling we could do without, but that's a separate topic.)

Cc Ville Syrjälä <[email protected]>
Cc Chris Wilson <[email protected]>

Lgtm,

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✗ Fi.CI.IGT: warning for igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs

In reply to Imre Deak
== Series Details ==

== Series Details ==

Series: igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs
URL : https://patchwork.freedesktop.org/series/35093/
State : warning

== Summary ==

Test kms_frontbuffer_tracking:

        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                pass       -> FAIL       (shard-snb) fdo#101623
Test drv_suspend:
        Subgroup fence-restore-tiled2untiled-hibernate:
                skip       -> FAIL       (shard-hsw) fdo#103375
        Subgroup fence-restore-tiled2untiled:
                pass       -> SKIP       (shard-snb)
        Subgroup debugfs-reader:
                skip       -> PASS       (shard-hsw)
        Subgroup forcewake:
                skip       -> PASS       (shard-hsw)
Test drv_module_reload:
        Subgroup basic-reload:
                dmesg-warn -> PASS       (shard-snb) fdo#102848
                dmesg-warn -> PASS       (shard-hsw) fdo#102707
Test gem_tiled_swapping:
        Subgroup non-threaded:
                pass       -> INCOMPLETE (shard-hsw) fdo#104009

fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#102848 https://bugs.freedesktop.org/show_bug.cgi?id=102848
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#104009 https://bugs.freedesktop.org/show_bug.cgi?id=104009

shard-hsw        total:2675 pass:1534 dwarn:1   dfail:0   fail:10  skip:1129 time:9141s
shard-snb        total:2679 pass:1306 dwarn:1   dfail:0   fail:12  skip:1360 time:8073s
Blacklisted hosts:
shard-apl        total:2657 pass:1655 dwarn:1   dfail:0   fail:22  skip:977 time:13318s
shard-kbl        total:2603 pass:1742 dwarn:1   dfail:0   fail:23  skip:837 time:10703s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_625/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#4 lore raw

Re: ✗ Fi.CI.IGT: warning for igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs

Quoted 5 lines · Patchwork

== Series Details ==

Series: igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs
URL : https://patchwork.freedesktop.org/series/35093/
State : warning

Thanks for the review, pushed to igt.

Quoted 6 lines

== Summary ==

Test kms_frontbuffer_tracking:

        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                pass       -> FAIL       (shard-snb) fdo#101623

"""
Primary screen: VGA 1024x768, crtc 0
FBC last action not supported
Can't test PSR: no usable eDP screen. Sink CRC not supported: primary screen is not eDP """

Quoted 3 lines

Test drv_suspend:

        Subgroup fence-restore-tiled2untiled-hibernate:
                skip       -> FAIL       (shard-hsw) fdo#103375

"PM: Swap header not found!"

Looks like all (real) hibernate tests fail regardless of the platform right now.

Quoted 2 lines
        Subgroup fence-restore-tiled2untiled:
                pass       -> SKIP       (shard-snb)

"""
rtcwake test failed with 1
This failure could mean that something is
wrong with the rtcwake tool or how your distro is set up. """

Maybe innaccurate RTC clock.

Quoted 11 lines
        Subgroup debugfs-reader:
                skip       -> PASS       (shard-hsw)
        Subgroup forcewake:
                skip       -> PASS       (shard-hsw)
Test drv_module_reload:
        Subgroup basic-reload:
                dmesg-warn -> PASS       (shard-snb) fdo#102848
                dmesg-warn -> PASS       (shard-hsw) fdo#102707
Test gem_tiled_swapping:
        Subgroup non-threaded:
                pass       -> INCOMPLETE (shard-hsw) fdo#104009

Looks like a pre-existing issue. From the above bug a pstore log, although for a different run:

"""

INFO: task gem_tiled_swapp:5950 blocked for more than 60 seconds.
<3>[  984.536743]       Tainted: G     U           4.15.0-rc1-CI-CI_DRM_3434+ #1
<3>[  984.536790] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
<6>[  984.536845] gem_tiled_swapp D    0  5950   3464 0x00000000
<4>[  984.536858] Call Trace:
<4>[  984.536878]  ? __schedule+0x3c3/0xaf0
<4>[  984.536898]  schedule+0x37/0x90
<4>[  984.536910]  io_schedule+0xd/0x30
<4>[  984.536918]  __lock_page+0x107/0x130
<4>[  984.536931]  ? add_to_page_cache_lru+0xc0/0xc0
<4>[  984.536947]  deferred_split_scan+0x25a/0x2b0
<4>[  984.536964]  shrink_slab.part.17+0x201/0x5d0
<4>[  984.536992]  drop_slab_node+0x26/0x50
<4>[  984.537005]  drop_caches_sysctl_handler+0x63/0xb0
<4>[  984.537014]  proc_sys_call_handler.isra.14+0xbd/0xe0
<4>[  984.537032]  __vfs_write+0x1e/0x130
<4>[  984.537041]  ? rcu_read_lock_sched_held+0x6f/0x80
<4>[  984.537048]  ? rcu_sync_lockdep_assert+0x25/0x50
<4>[  984.537056]  ? __sb_start_write+0xd5/0x1f0
<4>[  984.537062]  ? __sb_start_write+0xef/0x1f0
<4>[  984.537075]  vfs_write+0xc0/0x1b0
<4>[  984.537088]  SyS_write+0x40/0xa0
<4>[  984.537100]  entry_SYSCALL_64_fastpath+0x1c/0x89

"""

Quoted 13 lines

fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#102848 https://bugs.freedesktop.org/show_bug.cgi?id=102848
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#104009 https://bugs.freedesktop.org/show_bug.cgi?id=104009

shard-hsw        total:2675 pass:1534 dwarn:1   dfail:0   fail:10  skip:1129 time:9141s
shard-snb        total:2679 pass:1306 dwarn:1   dfail:0   fail:12  skip:1360 time:8073s
Blacklisted hosts:
shard-apl        total:2657 pass:1655 dwarn:1   dfail:0   fail:22  skip:977 time:13318s
shard-kbl        total:2603 pass:1742 dwarn:1   dfail:0   fail:23  skip:837 time:10703s
Quoted 3 lines

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_625/shards.html

_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx