From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 3/3] lib/fb: Clear framebuffer on amdgpu
Date: Fri, 8 Mar 2019 09:36:03 -0500 [thread overview]
Message-ID: <20190308143603.3620-3-nicholas.kazlauskas@amd.com> (raw)
In-Reply-To: <20190308143603.3620-1-nicholas.kazlauskas@amd.com>
IGT expects buffers returned from DRM_IOCTL_MODE_MAP_DUMB to be
cleared, but amdgpu retains the contents previously in memory
in the buffer - clear it on amdgpu by with a memset to 0.
While there's a clear_yuv_buffer directly below this that should take
care of the YUV format case for us, it has an assert to ensure that
the buffer contents were previously cleared. We'll fail that assert
if we don't clear it every time.
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
---
lib/igt_fb.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index f49becbd..084fed1e 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -595,6 +595,15 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
}
}
+static void clear_buffer(struct igt_fb *fb)
+{
+ void *ptr;
+
+ ptr = igt_fb_map_buffer(fb->fd, fb);
+ memset(ptr, 0, fb->size);
+ igt_fb_unmap_buffer(fb, ptr);
+}
+
static void clear_yuv_buffer(struct igt_fb *fb)
{
bool full_range = fb->color_range == IGT_COLOR_YCBCR_FULL_RANGE;
@@ -715,6 +724,14 @@ static int create_bo_for_fb(struct igt_fb *fb)
bpp, strides, &fb->size);
out:
+ /*
+ * IGT expects buffers returned from DRM_IOCTL_MODE_MAP_DUMB to be
+ * cleared, but amdgpu retains the contents previously in memory
+ * in the buffer - clear it on amdgpu.
+ */
+ if (is_amdgpu_device(fd))
+ clear_buffer(fb);
+
if (igt_format_is_yuv(fb->drm_format))
clear_yuv_buffer(fb);
--
2.17.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-08 14:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 14:36 [igt-dev] [PATCH i-g-t 1/3] lib/drmtest: Add helpers to check and require amdgpu Nicholas Kazlauskas
2019-03-08 14:36 ` [igt-dev] [PATCH i-g-t 2/3] lib/debugfs: Don't do CRC sanity checks on amdgpu Nicholas Kazlauskas
2019-03-08 14:36 ` Nicholas Kazlauskas [this message]
2019-03-08 14:40 ` [igt-dev] [PATCH i-g-t 3/3] lib/fb: Clear framebuffer " Chris Wilson
2019-03-08 15:00 ` Kazlauskas, Nicholas
2019-03-08 15:08 ` Chris Wilson
2019-03-08 15:10 ` Kazlauskas, Nicholas
2019-03-08 17:45 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/drmtest: Add helpers to check and require amdgpu Patchwork
2019-03-08 21:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190308143603.3620-3-nicholas.kazlauskas@amd.com \
--to=nicholas.kazlauskas@amd.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox