* [PATCH i-g-t v3 00/13] Testing the Y tiled display
@ 2015-03-03 14:10 Tvrtko Ursulin
2015-03-03 14:10 ` [PATCH i-g-t 01/13] tests/kms_addfb: Add support for fb modifiers Tvrtko Ursulin
` (13 more replies)
0 siblings, 14 replies; 17+ messages in thread
From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Starting with Skylake the display engine can scan out Y tiled objects. (Both
legacy Y tiled, and the new Yf format.)
This series takes the original work by Damien Lespiau and converts it to use the
new frame buffer modifiers instead of object set/get tiling. Some patches needed
to be dropped, some added and some refactored.
v2: Refactored for fb modifier changes.
v3:
* Addressing review comments.
* Added Y(f) tiling sub tests to kms_flip_tiling.
Damien Lespiau (7):
lib: Extract igt_buf_write_to_png() from gem_render_copy
lib/skl: Add gen9 specific igt_blitter_fast_copy()
lib: Don't give a struct igt_buf * to fast_copy_pitch()
lib: Split two helpers to build fast copy's dword0 and dword1
lib: Provide a raw version of the gen9 fast copy blits
lib: Allow the creation of Ys/Yf tiled FBs
testdisplay/skl: Add command line options for Yb/Yf tiled fbs
Tvrtko Ursulin (6):
tests/kms_addfb: Add support for fb modifiers
tests/kms_addfb: Y tiled testcases
tiling: Convert framebuffer helpers to use fb modifiers
lib: Add support for new extension to the ADDFB2 ioctl.
lib/igt_fb: Use new ADDFB2 extension for new tiling modes
tests/kms_flip_tiling: Exercise Y tiling modes on Gen9+
lib/igt_fb.c | 163 +++++++++++++++++++++----
lib/igt_fb.h | 10 +-
lib/igt_kms.h | 1 +
lib/intel_batchbuffer.c | 282 ++++++++++++++++++++++++++++++++++++++++++++
lib/intel_batchbuffer.h | 37 ++++++
lib/intel_reg.h | 18 +++
lib/ioctl_wrappers.c | 49 ++++++++
lib/ioctl_wrappers.h | 41 +++++++
tests/gem_render_copy.c | 24 +---
tests/kms_3d.c | 2 +-
tests/kms_addfb.c | 145 ++++++++++++++++++++++-
tests/kms_cursor_crc.c | 8 +-
tests/kms_fbc_crc.c | 4 +-
tests/kms_fence_pin_leak.c | 4 +-
tests/kms_flip.c | 8 +-
tests/kms_flip_event_leak.c | 4 +-
tests/kms_flip_tiling.c | 33 +++++-
tests/kms_mmio_vs_cs_flip.c | 12 +-
tests/kms_pipe_crc_basic.c | 2 +-
tests/kms_plane.c | 8 +-
tests/kms_psr_sink_crc.c | 8 +-
tests/kms_pwrite_crc.c | 4 +-
tests/kms_render.c | 8 +-
tests/kms_rotation_crc.c | 4 +-
tests/kms_setmode.c | 2 +-
tests/kms_sink_crc_basic.c | 6 +-
tests/kms_universal_plane.c | 18 +--
tests/pm_lpsp.c | 2 +-
tests/pm_rpm.c | 26 ++--
tests/testdisplay.c | 20 +++-
30 files changed, 831 insertions(+), 122 deletions(-)
--
2.3.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH i-g-t 01/13] tests/kms_addfb: Add support for fb modifiers 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin @ 2015-03-03 14:10 ` Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy Tvrtko Ursulin ` (12 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Just a few basic tests to make sure fb modifiers can be used and behave sanely when mixed with the old set_tiling API. v2: * Review feedback from Daniel Vetter: 1. Move cap detection into the subtest so skipping works. 2. Added some gtkdoc comments. 3. Two more test cases. 4. Removed unused parts for now. v3: * Removed two tests which do not make sense any more after the fb modifier rewrite. v4: * Moved gtkdoc comments into .c file. * Moved all initialization into fixtures. * Rebased for fb modifier changes. v5: * Added bad modifier subtest. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/ioctl_wrappers.c | 23 ++++++++++++++++ lib/ioctl_wrappers.h | 30 +++++++++++++++++++++ tests/kms_addfb.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 66c90de..5cbb873 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1142,3 +1142,26 @@ off_t prime_get_size(int dma_buf_fd) return ret; } + +/** + * igt_require_fb_modifiers: + * @fd: Open DRM file descriptor. + * + * Requires presence of DRM_CAP_ADDFB2_MODIFIERS. + */ +void igt_require_fb_modifiers(int fd) +{ + static bool has_modifiers, cap_modifiers_tested; + + if (!cap_modifiers_tested) { + uint64_t cap_modifiers; + int ret; + + ret = drmGetCap(fd, LOCAL_DRM_CAP_ADDFB2_MODIFIERS, &cap_modifiers); + igt_assert(ret == 0 || errno == EINVAL); + has_modifiers = ret == 0 && cap_modifiers == 1; + cap_modifiers_tested = true; + } + + igt_require(has_modifiers); +} diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 7c0c87e..3c85e8b 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -135,4 +135,34 @@ int prime_handle_to_fd(int fd, uint32_t handle); uint32_t prime_fd_to_handle(int fd, int dma_buf_fd); off_t prime_get_size(int dma_buf_fd); +/* addfb2 fb modifiers */ +struct local_drm_mode_fb_cmd2 { + uint32_t fb_id; + uint32_t width, height; + uint32_t pixel_format; + uint32_t flags; + uint32_t handles[4]; + uint32_t pitches[4]; + uint32_t offsets[4]; + uint64_t modifier[4]; +}; + +#define LOCAL_DRM_MODE_FB_MODIFIERS (1<<1) + +#define LOCAL_DRM_FORMAT_MOD_VENDOR_INTEL 0x01 + +#define local_fourcc_mod_code(vendor, val) \ + ((((uint64_t)LOCAL_DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | \ + (val & 0x00ffffffffffffffL)) + +#define LOCAL_DRM_FORMAT_MOD_NONE (0) +#define LOCAL_I915_FORMAT_MOD_X_TILED local_fourcc_mod_code(INTEL, 1) + +#define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \ + struct local_drm_mode_fb_cmd2) + +#define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10 + +void igt_require_fb_modifiers(int fd); + #endif /* IOCTL_WRAPPERS_H */ diff --git a/tests/kms_addfb.c b/tests/kms_addfb.c index 756589e..58a23ea 100644 --- a/tests/kms_addfb.c +++ b/tests/kms_addfb.c @@ -213,6 +213,79 @@ static void size_tests(int fd) } } +static void addfb25_tests(int fd) +{ + struct local_drm_mode_fb_cmd2 f = {}; + + igt_fixture { + gem_bo = gem_create(fd, 1024*1024*4); + igt_assert(gem_bo); + + memset(&f, 0, sizeof(f)); + + f.width = 1024; + f.height = 1024; + f.pixel_format = DRM_FORMAT_XRGB8888; + f.pitches[0] = 1024*4; + f.modifier[0] = LOCAL_DRM_FORMAT_MOD_NONE; + + f.handles[0] = gem_bo; + } + + igt_subtest("addfb25-modifier-no-flag") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL); + } + + igt_fixture { + f.flags = LOCAL_DRM_MODE_FB_MODIFIERS; + } + + igt_subtest("addfb25-bad-modifier") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = ~0; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL); + } + + igt_fixture { + gem_set_tiling(fd, gem_bo, I915_TILING_X, 1024*4); + } + + igt_subtest("addfb25-X-tiled-mismatch") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = LOCAL_DRM_FORMAT_MOD_NONE; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL); + } + + igt_subtest("addfb25-X-tiled") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == 0); + igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0); + f.fb_id = 0; + } + + igt_subtest("addfb25-framebuffer-vs-set-tiling") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == 0); + igt_assert(__gem_set_tiling(fd, gem_bo, I915_TILING_X, 512*4) == -EBUSY); + igt_assert(__gem_set_tiling(fd, gem_bo, I915_TILING_X, 1024*4) == -EBUSY); + igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0); + f.fb_id = 0; + } + + igt_fixture { + gem_close(fd, gem_bo); + } +} + int fd; igt_main @@ -224,6 +297,8 @@ igt_main size_tests(fd); + addfb25_tests(fd); + igt_fixture close(fd); } -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 01/13] tests/kms_addfb: Add support for fb modifiers Tvrtko Ursulin @ 2015-03-03 14:10 ` Tvrtko Ursulin 2015-03-03 16:03 ` Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 03/13] tests/kms_addfb: Y tiled testcases Tvrtko Ursulin ` (11 subsequent siblings) 13 siblings, 1 reply; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> Now that the Android build has cairo, we can put cairo-dependant code back into lib/ v2: Document image format. (Daniel Vetter) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- lib/intel_batchbuffer.c | 26 ++++++++++++++++++++++++++ lib/intel_batchbuffer.h | 2 ++ tests/gem_render_copy.c | 24 +++--------------------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index c70f6d8..d3efc1e 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -31,6 +31,8 @@ #include <string.h> #include <assert.h> +#include <cairo.h> + #include "drm.h" #include "drmtest.h" #include "intel_batchbuffer.h" @@ -458,6 +460,30 @@ unsigned igt_buf_height(struct igt_buf *buf) } /** + * igt_buf_write_to_png: + * @buf: an i-g-t buffer object + * + * Writes the content of @buf as a PNG file. + * Buffer is interpreted as in RGBX format. + */ +void igt_buf_write_to_png(struct igt_buf *buf, const char *filename) +{ + cairo_surface_t *surface; + cairo_status_t ret; + + drm_intel_bo_map(buf->bo, 0); + surface = cairo_image_surface_create_for_data(buf->bo->virtual, + CAIRO_FORMAT_RGB24, + igt_buf_width(buf), + igt_buf_height(buf), + buf->stride); + ret = cairo_surface_write_to_png(surface, filename); + igt_assert(ret == CAIRO_STATUS_SUCCESS); + cairo_surface_destroy(surface); + drm_intel_bo_unmap(buf->bo); +} + +/** * igt_get_render_copyfunc: * @devid: pci device id * diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index 12f7be1..e2afc3b 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -210,6 +210,8 @@ struct igt_buf { unsigned igt_buf_width(struct igt_buf *buf); unsigned igt_buf_height(struct igt_buf *buf); +void igt_buf_write_to_png(struct igt_buf *buf, const char *filename); + /** * igt_render_copyfunc_t: * @batch: batchbuffer object diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c index df1ac88..76f8c63 100644 --- a/tests/gem_render_copy.c +++ b/tests/gem_render_copy.c @@ -31,7 +31,6 @@ #include <stdbool.h> #include <unistd.h> -#include <cairo.h> #include <stdlib.h> #include <sys/ioctl.h> #include <stdio.h> @@ -71,23 +70,6 @@ typedef struct { static int opt_dump_png = false; static int check_all_pixels = false; -static void scratch_buf_write_to_png(struct igt_buf *buf, const char *filename) -{ - cairo_surface_t *surface; - cairo_status_t ret; - - drm_intel_bo_map(buf->bo, 0); - surface = cairo_image_surface_create_for_data(buf->bo->virtual, - CAIRO_FORMAT_RGB24, - igt_buf_width(buf), - igt_buf_height(buf), - buf->stride); - ret = cairo_surface_write_to_png(surface, filename); - igt_assert(ret == CAIRO_STATUS_SUCCESS); - cairo_surface_destroy(surface); - drm_intel_bo_unmap(buf->bo); -} - static void scratch_buf_init(data_t *data, struct igt_buf *buf, int width, int height, int stride, uint32_t color) { @@ -165,8 +147,8 @@ int main(int argc, char **argv) scratch_buf_check(&data, &dst, WIDTH / 2, HEIGHT / 2, DST_COLOR); if (opt_dump_png) { - scratch_buf_write_to_png(&src, "source.png"); - scratch_buf_write_to_png(&dst, "destination.png"); + igt_buf_write_to_png(&src, "source.png"); + igt_buf_write_to_png(&dst, "destination.png"); } if (opt_dump_aub) { @@ -188,7 +170,7 @@ int main(int argc, char **argv) &dst, WIDTH / 2, HEIGHT / 2); if (opt_dump_png) - scratch_buf_write_to_png(&dst, "result.png"); + igt_buf_write_to_png(&dst, "result.png"); if (opt_dump_aub) { drm_intel_gem_bo_aub_dump_bmp(dst.bo, -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy 2015-03-03 14:10 ` [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy Tvrtko Ursulin @ 2015-03-03 16:03 ` Tvrtko Ursulin 2015-03-03 16:12 ` Gore, Tim 0 siblings, 1 reply; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 16:03 UTC (permalink / raw) To: Intel-gfx, Damien Lespiau On 03/03/2015 02:10 PM, Tvrtko Ursulin wrote: > From: Damien Lespiau <damien.lespiau@intel.com> > > Now that the Android build has cairo, we can put cairo-dependant code > back into lib/ Looks like we'll have to drop this one - Cairo is not available in Android after all. I looked at the following patches and couldn't see anything actually needing this so dropping looks safe. Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy 2015-03-03 16:03 ` Tvrtko Ursulin @ 2015-03-03 16:12 ` Gore, Tim 0 siblings, 0 replies; 17+ messages in thread From: Gore, Tim @ 2015-03-03 16:12 UTC (permalink / raw) To: Tvrtko Ursulin, Intel-gfx@lists.freedesktop.org, Lespiau, Damien > -----Original Message----- > From: Tvrtko Ursulin [mailto:tvrtko.ursulin@linux.intel.com] > Sent: Tuesday, March 03, 2015 4:04 PM > To: Intel-gfx@lists.freedesktop.org; Lespiau, Damien > Cc: Ceraolo Spurio, Daniele; Gore, Tim > Subject: Re: [Intel-gfx] [PATCH i-g-t 02/13] lib: Extract > igt_buf_write_to_png() from gem_render_copy > > > On 03/03/2015 02:10 PM, Tvrtko Ursulin wrote: > > From: Damien Lespiau <damien.lespiau@intel.com> > > > > Now that the Android build has cairo, we can put cairo-dependant code > > back into lib/ > > Looks like we'll have to drop this one - Cairo is not available in Android after > all. > > I looked at the following patches and couldn't see anything actually needing > this so dropping looks safe. > > Tvrtko IF you want to move cairo dependent code into the igt library you can put it in igt_fb.c, since this is excluded in Android builds unless the ANDROID_HAS_CAIRO env var is set. (igt_kms is likewise excluded in this case) Tim _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH i-g-t 03/13] tests/kms_addfb: Y tiled testcases 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 01/13] tests/kms_addfb: Add support for fb modifiers Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy Tvrtko Ursulin @ 2015-03-03 14:10 ` Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 04/13] lib/skl: Add gen9 specific igt_blitter_fast_copy() Tvrtko Ursulin ` (10 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> v2: Moved all init into fixtures. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/ioctl_wrappers.h | 2 ++ tests/kms_addfb.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 3c85e8b..99fc7fd 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -157,6 +157,8 @@ struct local_drm_mode_fb_cmd2 { #define LOCAL_DRM_FORMAT_MOD_NONE (0) #define LOCAL_I915_FORMAT_MOD_X_TILED local_fourcc_mod_code(INTEL, 1) +#define LOCAL_I915_FORMAT_MOD_Y_TILED local_fourcc_mod_code(INTEL, 2) +#define LOCAL_I915_FORMAT_MOD_Yf_TILED local_fourcc_mod_code(INTEL, 3) #define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \ struct local_drm_mode_fb_cmd2) diff --git a/tests/kms_addfb.c b/tests/kms_addfb.c index 58a23ea..28afdf0 100644 --- a/tests/kms_addfb.c +++ b/tests/kms_addfb.c @@ -38,6 +38,7 @@ #include "ioctl_wrappers.h" #include "drmtest.h" #include "drm_fourcc.h" +#include "intel_chipset.h" uint32_t gem_bo; uint32_t gem_bo_small; @@ -286,12 +287,77 @@ static void addfb25_tests(int fd) } } +static void addfb25_ytile(int fd, int gen) +{ + struct local_drm_mode_fb_cmd2 f = {}; + int shouldret; + + igt_fixture { + gem_bo = gem_create(fd, 1024*1024*4); + igt_assert(gem_bo); + gem_bo_small = gem_create(fd, 1024*1023*4); + igt_assert(gem_bo_small); + + shouldret = gen >= 9 ? 0 : -1; + + memset(&f, 0, sizeof(f)); + + f.width = 1024; + f.height = 1024; + f.pixel_format = DRM_FORMAT_XRGB8888; + f.pitches[0] = 1024*4; + f.flags = LOCAL_DRM_MODE_FB_MODIFIERS; + f.modifier[0] = LOCAL_DRM_FORMAT_MOD_NONE; + + f.handles[0] = gem_bo; + } + + igt_subtest("addfb25-Y-tiled") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = LOCAL_I915_FORMAT_MOD_Y_TILED; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == shouldret); + if (!shouldret) + igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0); + f.fb_id = 0; + } + + igt_subtest("addfb25-Yf-tiled") { + igt_require_fb_modifiers(fd); + + f.modifier[0] = LOCAL_I915_FORMAT_MOD_Yf_TILED; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == shouldret); + if (!shouldret) + igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0); + f.fb_id = 0; + } + + igt_subtest("addfb25-Y-tiled-small") { + igt_require_fb_modifiers(fd); + igt_require(gen >= 9); + + f.modifier[0] = LOCAL_I915_FORMAT_MOD_Y_TILED; + f.height = 1023; + f.handles[0] = gem_bo_small; + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL); + f.fb_id = 0; + } + + igt_fixture { + gem_close(fd, gem_bo); + gem_close(fd, gem_bo_small); + } +} + int fd; +int gen; igt_main { - igt_fixture + igt_fixture { fd = drm_open_any_master(); + gen = intel_gen(intel_get_drm_devid(fd)); + } pitch_tests(fd); @@ -299,6 +365,8 @@ igt_main addfb25_tests(fd); + addfb25_ytile(fd, gen); + igt_fixture close(fd); } -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 04/13] lib/skl: Add gen9 specific igt_blitter_fast_copy() 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (2 preceding siblings ...) 2015-03-03 14:10 ` [PATCH i-g-t 03/13] tests/kms_addfb: Y tiled testcases Tvrtko Ursulin @ 2015-03-03 14:10 ` Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 05/13] lib: Don't give a struct igt_buf * to fast_copy_pitch() Tvrtko Ursulin ` (9 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> v2: Adjust for BB handling changes. (Tvrtko Ursulin) Correct XY_FAST_COPY_DST_TILING_Yf. (Tvrtko Ursulin) v3: New tiling modes are not defined in the kernel any more. (Tvrtko Ursulin) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/intel_batchbuffer.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/intel_batchbuffer.h | 17 ++++++++ lib/intel_reg.h | 18 ++++++++ 3 files changed, 141 insertions(+) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index d3efc1e..9b8ae0d 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -483,6 +483,112 @@ void igt_buf_write_to_png(struct igt_buf *buf, const char *filename) drm_intel_bo_unmap(buf->bo); } +/* + * pitches are in bytes if the surfaces are linear, number of dwords + * otherwise + */ +static uint32_t fast_copy_pitch(struct igt_buf *buf) +{ + if (buf->tiling != I915_TILING_NONE) + return buf->stride / 4; + else + return buf->stride; +} + +/** + * igt_blitter_fast_copy: + * @batch: batchbuffer object + * @context: libdrm hardware context to use + * @src: source i-g-t buffer object + * @src_x: source pixel x-coordination + * @src_y: source pixel y-coordination + * @width: width of the copied rectangle + * @height: height of the copied rectangle + * @dst: destination i-g-t buffer object + * @dst_x: destination pixel x-coordination + * @dst_y: destination pixel y-coordination + * + * Copy @src into @dst using the gen9 fast copy blitter comamnd. + * + * The source and destination surfaces cannot overlap. + */ +void igt_blitter_fast_copy(struct intel_batchbuffer *batch, + struct igt_buf *src, unsigned src_x, unsigned src_y, + unsigned width, unsigned height, + struct igt_buf *dst, unsigned dst_x, unsigned dst_y) +{ + uint32_t src_pitch, dst_pitch; + uint32_t dword0 = 0, dword1 = 0; + + src_pitch = fast_copy_pitch(src); + dst_pitch = fast_copy_pitch(dst); + +#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) + assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) && + CHECK_RANGE(dst_x) && CHECK_RANGE(dst_y) && + CHECK_RANGE(width) && CHECK_RANGE(height) && + CHECK_RANGE(src_x + width) && CHECK_RANGE(src_y + height) && + CHECK_RANGE(dst_x + width) && CHECK_RANGE(dst_y + height) && + CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch)); +#undef CHECK_RANGE + + dword0 |= XY_FAST_COPY_BLT; + + switch (src->tiling) { + case I915_TILING_X: + dword0 |= XY_FAST_COPY_SRC_TILING_X; + break; + case I915_TILING_Y: + case I915_TILING_Yf: + dword0 |= XY_FAST_COPY_SRC_TILING_Yb_Yf; + break; + case I915_TILING_Ys: + dword0 |= XY_FAST_COPY_SRC_TILING_Ys; + break; + case I915_TILING_NONE: + default: + break; + } + + switch (dst->tiling) { + case I915_TILING_X: + dword0 |= XY_FAST_COPY_DST_TILING_X; + break; + case I915_TILING_Y: + case I915_TILING_Yf: + dword0 |= XY_FAST_COPY_DST_TILING_Yb_Yf; + break; + case I915_TILING_Ys: + dword0 |= XY_FAST_COPY_DST_TILING_Ys; + break; + case I915_TILING_NONE: + default: + break; + } + + if (src->tiling == I915_TILING_Yf) + dword1 |= XY_FAST_COPY_SRC_TILING_Yf; + if (dst->tiling == I915_TILING_Yf) + dword1 |= XY_FAST_COPY_DST_TILING_Yf; + + dword1 |= XY_FAST_COPY_COLOR_DEPTH_32; + + BEGIN_BATCH(10, 2); + OUT_BATCH(dword0); + OUT_BATCH(dword1 | dst_pitch); + OUT_BATCH((dst_y << 16) | dst_x); /* dst x1,y1 */ + OUT_BATCH(((dst_y + height) << 16) | (dst_x + width)); /* dst x2,y2 */ + OUT_RELOC(dst->bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0); + OUT_BATCH(0); /* dst address upper bits */ + OUT_BATCH((src_y << 16) | src_x); /* src x1,y1 */ + OUT_BATCH(src_pitch); + OUT_RELOC(src->bo, I915_GEM_DOMAIN_RENDER, 0, 0); + OUT_BATCH(0); /* src address upper bits */ + ADVANCE_BATCH(); + + intel_batchbuffer_flush(batch); +} + /** * igt_get_render_copyfunc: * @devid: pci device id diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index e2afc3b..0f22cd6 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -186,6 +186,18 @@ void intel_copy_bo(struct intel_batchbuffer *batch, long int size); /** + * Yf/Ys tiling + * + * Tiling mode in the I915_TILING_... namespace for new tiling modes which are + * defined in the kernel. (They are not fenceable so the kernel does not need + * to know about them.) + * + * They are to be used the the blitting routines below. + */ +#define I915_TILING_Yf 3 +#define I915_TILING_Ys 4 + +/** * igt_buf: * @bo: underlying libdrm buffer object * @stride: stride of the buffer @@ -212,6 +224,11 @@ unsigned igt_buf_height(struct igt_buf *buf); void igt_buf_write_to_png(struct igt_buf *buf, const char *filename); +void igt_blitter_fast_copy(struct intel_batchbuffer *batch, + struct igt_buf *src, unsigned src_x, unsigned src_y, + unsigned width, unsigned height, + struct igt_buf *dst, unsigned dst_x, unsigned dst_y); + /** * igt_render_copyfunc_t: * @batch: batchbuffer object diff --git a/lib/intel_reg.h b/lib/intel_reg.h index ade1c0c..0ffa803 100644 --- a/lib/intel_reg.h +++ b/lib/intel_reg.h @@ -2514,6 +2514,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21) #define XY_MONO_SRC_BLT_WRITE_RGB (1<<20) +#define XY_FAST_COPY_BLT ((2<<29)|(0x42<<22)|0x8) +/* dword 0 */ +#define XY_FAST_COPY_SRC_TILING_LINEAR (0 << 20) +#define XY_FAST_COPY_SRC_TILING_X (1 << 20) +#define XY_FAST_COPY_SRC_TILING_Yb_Yf (2 << 20) +#define XY_FAST_COPY_SRC_TILING_Ys (3 << 20) +#define XY_FAST_COPY_SRC_HORIZONTAL_ALIGNMENT(n) (n << 17) +#define XY_FAST_COPY_SRC_VERTICAL_ALIGNMENT(n) (n << 15) +#define XY_FAST_COPY_DST_TILING_X (1 << 13) +#define XY_FAST_COPY_DST_TILING_Yb_Yf (2 << 13) +#define XY_FAST_COPY_DST_TILING_Ys (3 << 13) +#define XY_FAST_COPY_DST_HORIZONTAL_ALIGNMENT(n) (n << 10) +#define XY_FAST_COPY_DST_VERTICAL_ALIGNMENT(n) (n << 8) +/* 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_32 (3 << 24) + #define MI_STORE_DWORD_IMM ((0x20<<23)|2) #define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */ -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 05/13] lib: Don't give a struct igt_buf * to fast_copy_pitch() 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (3 preceding siblings ...) 2015-03-03 14:10 ` [PATCH i-g-t 04/13] lib/skl: Add gen9 specific igt_blitter_fast_copy() Tvrtko Ursulin @ 2015-03-03 14:10 ` Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 06/13] lib: Split two helpers to build fast copy's dword0 and dword1 Tvrtko Ursulin ` (8 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> So we can use this function in a "raw" (ie without igt_buf) version. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- lib/intel_batchbuffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 9b8ae0d..f964d12 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -487,12 +487,12 @@ void igt_buf_write_to_png(struct igt_buf *buf, const char *filename) * pitches are in bytes if the surfaces are linear, number of dwords * otherwise */ -static uint32_t fast_copy_pitch(struct igt_buf *buf) +static uint32_t fast_copy_pitch(unsigned int stride, enum i915_tiling tiling) { - if (buf->tiling != I915_TILING_NONE) - return buf->stride / 4; + if (tiling != I915_TILING_NONE) + return stride / 4; else - return buf->stride; + return stride; } /** @@ -520,8 +520,8 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch, uint32_t src_pitch, dst_pitch; uint32_t dword0 = 0, dword1 = 0; - src_pitch = fast_copy_pitch(src); - dst_pitch = fast_copy_pitch(dst); + src_pitch = fast_copy_pitch(src->stride, src->tiling); + dst_pitch = fast_copy_pitch(dst->stride, src->tiling); #define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) && -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 06/13] lib: Split two helpers to build fast copy's dword0 and dword1 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (4 preceding siblings ...) 2015-03-03 14:10 ` [PATCH i-g-t 05/13] lib: Don't give a struct igt_buf * to fast_copy_pitch() Tvrtko Ursulin @ 2015-03-03 14:10 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 07/13] lib: Provide a raw version of the gen9 fast copy blits Tvrtko Ursulin ` (7 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:10 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> Again, these helpers will be useful for a raw version of the gen9 fast copy. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- lib/intel_batchbuffer.c | 96 +++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 39 deletions(-) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index f964d12..1eeabe4 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -495,46 +495,14 @@ static uint32_t fast_copy_pitch(unsigned int stride, enum i915_tiling tiling) return stride; } -/** - * igt_blitter_fast_copy: - * @batch: batchbuffer object - * @context: libdrm hardware context to use - * @src: source i-g-t buffer object - * @src_x: source pixel x-coordination - * @src_y: source pixel y-coordination - * @width: width of the copied rectangle - * @height: height of the copied rectangle - * @dst: destination i-g-t buffer object - * @dst_x: destination pixel x-coordination - * @dst_y: destination pixel y-coordination - * - * Copy @src into @dst using the gen9 fast copy blitter comamnd. - * - * The source and destination surfaces cannot overlap. - */ -void igt_blitter_fast_copy(struct intel_batchbuffer *batch, - struct igt_buf *src, unsigned src_x, unsigned src_y, - unsigned width, unsigned height, - struct igt_buf *dst, unsigned dst_x, unsigned dst_y) +static uint32_t fast_copy_dword0(unsigned int src_tiling, + unsigned int dst_tiling) { - uint32_t src_pitch, dst_pitch; - uint32_t dword0 = 0, dword1 = 0; - - src_pitch = fast_copy_pitch(src->stride, src->tiling); - dst_pitch = fast_copy_pitch(dst->stride, src->tiling); - -#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) - assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) && - CHECK_RANGE(dst_x) && CHECK_RANGE(dst_y) && - CHECK_RANGE(width) && CHECK_RANGE(height) && - CHECK_RANGE(src_x + width) && CHECK_RANGE(src_y + height) && - CHECK_RANGE(dst_x + width) && CHECK_RANGE(dst_y + height) && - CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch)); -#undef CHECK_RANGE + uint32_t dword0 = 0; dword0 |= XY_FAST_COPY_BLT; - switch (src->tiling) { + switch (src_tiling) { case I915_TILING_X: dword0 |= XY_FAST_COPY_SRC_TILING_X; break; @@ -550,7 +518,7 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch, break; } - switch (dst->tiling) { + switch (dst_tiling) { case I915_TILING_X: dword0 |= XY_FAST_COPY_DST_TILING_X; break; @@ -566,13 +534,63 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch, break; } - if (src->tiling == I915_TILING_Yf) + return dword0; +} + +static uint32_t fast_copy_dword1(unsigned int src_tiling, + unsigned int dst_tiling) +{ + uint32_t dword1 = 0; + + if (src_tiling == I915_TILING_Yf) dword1 |= XY_FAST_COPY_SRC_TILING_Yf; - if (dst->tiling == I915_TILING_Yf) + if (dst_tiling == I915_TILING_Yf) dword1 |= XY_FAST_COPY_DST_TILING_Yf; dword1 |= XY_FAST_COPY_COLOR_DEPTH_32; + return dword1; +} + +/** + * igt_blitter_fast_copy: + * @batch: batchbuffer object + * @context: libdrm hardware context to use + * @src: source i-g-t buffer object + * @src_x: source pixel x-coordination + * @src_y: source pixel y-coordination + * @width: width of the copied rectangle + * @height: height of the copied rectangle + * @dst: destination i-g-t buffer object + * @dst_x: destination pixel x-coordination + * @dst_y: destination pixel y-coordination + * + * Copy @src into @dst using the gen9 fast copy blitter comamnd. + * + * The source and destination surfaces cannot overlap. + */ +void igt_blitter_fast_copy(struct intel_batchbuffer *batch, + struct igt_buf *src, unsigned src_x, unsigned src_y, + unsigned width, unsigned height, + struct igt_buf *dst, unsigned dst_x, unsigned dst_y) +{ + uint32_t src_pitch, dst_pitch; + uint32_t dword0, dword1; + + 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); + +#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) + assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) && + CHECK_RANGE(dst_x) && CHECK_RANGE(dst_y) && + CHECK_RANGE(width) && CHECK_RANGE(height) && + CHECK_RANGE(src_x + width) && CHECK_RANGE(src_y + height) && + CHECK_RANGE(dst_x + width) && CHECK_RANGE(dst_y + height) && + CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch)); +#undef CHECK_RANGE + BEGIN_BATCH(10, 2); OUT_BATCH(dword0); OUT_BATCH(dword1 | dst_pitch); -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 07/13] lib: Provide a raw version of the gen9 fast copy blits 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (5 preceding siblings ...) 2015-03-03 14:10 ` [PATCH i-g-t 06/13] lib: Split two helpers to build fast copy's dword0 and dword1 Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 08/13] tiling: Convert framebuffer helpers to use fb modifiers Tvrtko Ursulin ` (6 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> So we can use it with bare kernel types, without going through libdrm bos. v2: Don't forget the object handle. (Tvrtko) Correct surface pitch calculation. (Tvrtko) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/intel_batchbuffer.c | 134 +++++++++++++++++++++++++++++++++++++++++++++++- lib/intel_batchbuffer.h | 18 +++++++ 2 files changed, 151 insertions(+), 1 deletion(-) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 1eeabe4..2733b14 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -41,6 +41,8 @@ #include "intel_reg.h" #include "rendercopy.h" #include "media_fill.h" +#include "ioctl_wrappers.h" + #include <i915_drm.h> /** @@ -487,7 +489,7 @@ void igt_buf_write_to_png(struct igt_buf *buf, const char *filename) * pitches are in bytes if the surfaces are linear, number of dwords * otherwise */ -static uint32_t fast_copy_pitch(unsigned int stride, enum i915_tiling tiling) +static uint32_t fast_copy_pitch(unsigned int stride, unsigned int tiling) { if (tiling != I915_TILING_NONE) return stride / 4; @@ -552,6 +554,136 @@ static uint32_t fast_copy_dword1(unsigned int src_tiling, return dword1; } +static void +fill_relocation(struct drm_i915_gem_relocation_entry *reloc, + uint32_t gem_handle, uint32_t offset, /* in dwords */ + uint32_t read_domains, uint32_t write_domains) +{ + reloc->target_handle = gem_handle; + reloc->delta = 0; + reloc->offset = offset * sizeof(uint32_t); + reloc->presumed_offset = 0; + reloc->read_domains = read_domains; + reloc->write_domain = write_domains; +} + +static void +fill_object(struct drm_i915_gem_exec_object2 *obj, uint32_t gem_handle, + struct drm_i915_gem_relocation_entry *relocs, uint32_t count) +{ + memset(obj, 0, sizeof(*obj)); + obj->handle = gem_handle; + obj->relocation_count = count; + obj->relocs_ptr = (uint64_t)relocs; +} + +static void exec_blit(int fd, + struct drm_i915_gem_exec_object2 *objs, uint32_t count, + uint32_t batch_len /* in dwords */) +{ + struct drm_i915_gem_execbuffer2 exec; + + exec.buffers_ptr = (uint64_t)objs; + exec.buffer_count = count; + exec.batch_start_offset = 0; + exec.batch_len = batch_len * 4; + exec.DR1 = exec.DR4 = 0; + exec.num_cliprects = 0; + exec.cliprects_ptr = 0; + exec.flags = I915_EXEC_BLT; + i915_execbuffer2_set_context_id(exec, 0); + exec.rsvd2 = 0; + + gem_execbuf(fd, &exec); +} + +/** + * igt_blitter_fast_copy__raw: + * @fd: file descriptor of the i915 driver + * @src_handle: GEM handle of the source buffer + * @src_stride: Stride (in bytes) of the source buffer + * @src_tiling: Tiling mode of the source buffer + * @src_x: X coordinate of the source region to copy + * @src_y: Y coordinate of the source region to copy + * @width: Width of the region to copy + * @height: Height of the region to copy + * @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 + * @dst_x: X coordinate of destination + * @dst_y: Y coordinate of destination + * + * Like igt_blitter_fast_copy(), but talking to the kernel directly. + */ +void igt_blitter_fast_copy__raw(int fd, + /* src */ + uint32_t src_handle, + unsigned int src_stride, + unsigned int src_tiling, + unsigned int src_x, unsigned src_y, + + /* size */ + unsigned int width, unsigned int height, + + /* dst */ + uint32_t dst_handle, + unsigned int dst_stride, + unsigned int dst_tiling, + unsigned int dst_x, unsigned dst_y) +{ + uint32_t batch[12]; + struct drm_i915_gem_exec_object2 objs[3]; + struct drm_i915_gem_relocation_entry relocs[2]; + uint32_t batch_handle; + uint32_t dword0, dword1; + uint32_t src_pitch, dst_pitch; + int i = 0; + + 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); + +#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) + assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) && + CHECK_RANGE(dst_x) && CHECK_RANGE(dst_y) && + CHECK_RANGE(width) && CHECK_RANGE(height) && + CHECK_RANGE(src_x + width) && CHECK_RANGE(src_y + height) && + CHECK_RANGE(dst_x + width) && CHECK_RANGE(dst_y + height) && + CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch)); +#undef CHECK_RANGE + + batch[i++] = dword0; + batch[i++] = dword1 | dst_pitch; + batch[i++] = (dst_y << 16) | dst_x; /* dst x1,y1 */ + batch[i++] = ((dst_y + height) << 16) | (dst_x + width); /* dst x2,y2 */ + batch[i++] = 0; /* dst address lower bits */ + batch[i++] = 0; /* dst address upper bits */ + batch[i++] = (src_y << 16) | src_x; /* src x1,y1 */ + batch[i++] = src_pitch; + batch[i++] = 0; /* src address lower bits */ + batch[i++] = 0; /* src address upper bits */ + batch[i++] = MI_BATCH_BUFFER_END; + batch[i++] = MI_NOOP; + + igt_assert(i == ARRAY_SIZE(batch)); + + batch_handle = gem_create(fd, 4096); + gem_write(fd, batch_handle, 0, batch, sizeof(batch)); + + fill_relocation(&relocs[0], dst_handle, 4, + I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER); + fill_relocation(&relocs[1], src_handle, 8, I915_GEM_DOMAIN_RENDER, 0); + + fill_object(&objs[0], dst_handle, NULL, 0); + fill_object(&objs[1], src_handle, NULL, 0); + fill_object(&objs[2], batch_handle, relocs, 2); + + exec_blit(fd, objs, 3, ARRAY_SIZE(batch)); + + gem_close(fd, batch_handle); +} + /** * igt_blitter_fast_copy: * @batch: batchbuffer object diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index 0f22cd6..7f39b84 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -3,6 +3,8 @@ #include <stdint.h> #include <intel_bufmgr.h> +#include <i915_drm.h> + #include "igt_core.h" #include "intel_reg.h" @@ -229,6 +231,22 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch, unsigned width, unsigned height, struct igt_buf *dst, unsigned dst_x, unsigned dst_y); +void igt_blitter_fast_copy__raw(int fd, + /* src */ + uint32_t src_handle, + unsigned int src_stride, + unsigned int src_tiling, + unsigned int src_x, unsigned src_y, + + /* size */ + unsigned int width, unsigned int height, + + /* dst */ + uint32_t dst_handle, + unsigned int dst_stride, + unsigned int dst_tiling, + unsigned int dst_x, unsigned dst_y); + /** * igt_render_copyfunc_t: * @batch: batchbuffer object -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 08/13] tiling: Convert framebuffer helpers to use fb modifiers 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (6 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 07/13] lib: Provide a raw version of the gen9 fast copy blits Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 09/13] lib: Add support for new extension to the ADDFB2 ioctl Tvrtko Ursulin ` (5 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> This converts the IGT API only, underneath legacy set_tiling is still used. v2: One got away in kms_flip. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/igt_fb.c | 20 ++++++++++---------- lib/igt_fb.h | 10 +++++----- lib/igt_kms.h | 1 + tests/kms_3d.c | 2 +- tests/kms_cursor_crc.c | 8 +++++--- tests/kms_fbc_crc.c | 4 ++-- tests/kms_fence_pin_leak.c | 4 ++-- tests/kms_flip.c | 8 ++++---- tests/kms_flip_event_leak.c | 4 ++-- tests/kms_flip_tiling.c | 7 ++++--- tests/kms_mmio_vs_cs_flip.c | 12 ++++++------ tests/kms_pipe_crc_basic.c | 2 +- tests/kms_plane.c | 8 ++++---- tests/kms_psr_sink_crc.c | 8 +++++--- tests/kms_pwrite_crc.c | 4 ++-- tests/kms_render.c | 8 ++++---- tests/kms_rotation_crc.c | 4 ++-- tests/kms_setmode.c | 2 +- tests/kms_sink_crc_basic.c | 6 ++++-- tests/kms_universal_plane.c | 18 +++++++++--------- tests/pm_lpsp.c | 2 +- tests/pm_rpm.c | 26 ++++++++++++++------------ tests/testdisplay.c | 4 ++-- 23 files changed, 91 insertions(+), 81 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 9b41301..853b2f9 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -75,7 +75,7 @@ static struct format_desc_struct { /* helpers to create nice-looking framebuffers */ static int create_bo_for_fb(int fd, int width, int height, int bpp, - unsigned int tiling, unsigned bo_size, + uint64_t tiling, unsigned bo_size, uint32_t *gem_handle_ret, unsigned *size_ret, unsigned *stride_ret) @@ -84,7 +84,7 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp, int size, ret = 0; unsigned stride; - if (tiling) { + if (tiling != LOCAL_DRM_FORMAT_MOD_NONE) { int v; /* Round the tiling up to the next power-of-two and the @@ -112,8 +112,8 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp, bo_size = size; gem_handle = gem_create(fd, bo_size); - if (tiling) - ret = __gem_set_tiling(fd, gem_handle, tiling, stride); + if (tiling != LOCAL_DRM_FORMAT_MOD_NONE) + ret = __gem_set_tiling(fd, gem_handle, I915_TILING_X, stride); *stride_ret = stride; *size_ret = size; @@ -385,7 +385,7 @@ void igt_paint_image(cairo_t *cr, const char *filename, * @width: width of the framebuffer in pixel * @height: height of the framebuffer in pixel * @format: drm fourcc pixel format code - * @tiling: tiling layout of the framebuffer + * @tiling: tiling layout of the framebuffer (as framebuffer modifier) * @fb: pointer to an #igt_fb structure * @bo_size: size of the backing bo (0 for minimum needed size) * @@ -401,7 +401,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, unsigned int tiling, + uint32_t format, uint64_t tiling, struct igt_fb *fb, unsigned bo_size) { uint32_t handles[4]; @@ -417,7 +417,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height, bpp = igt_drm_format_to_bpp(format); - igt_debug("%s(width=%d, height=%d, format=0x%x [bpp=%d], tiling=%d, size=%d\n", + igt_debug("%s(width=%d, height=%d, format=0x%x [bpp=%d], tiling=%llx, size=%d\n", __func__, width, height, format, bpp, tiling, bo_size); do_or_die(create_bo_for_fb(fd, width, height, bpp, tiling, bo_size, &fb->gem_handle, &fb->size, &fb->stride)); @@ -460,7 +460,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height, * The kms id of the created framebuffer. */ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, - unsigned int tiling, struct igt_fb *fb) + uint64_t tiling, struct igt_fb *fb) { return igt_create_fb_with_bo_size(fd, width, height, format, tiling, fb, 0); } @@ -489,7 +489,7 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, * failure. */ unsigned int igt_create_color_fb(int fd, int width, int height, - uint32_t format, unsigned int tiling, + uint32_t format, uint64_t tiling, double r, double g, double b, struct igt_fb *fb /* out */) { @@ -583,7 +583,7 @@ static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout, * failure. */ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode, - uint32_t format, unsigned int tiling) + uint32_t format, uint64_t tiling) { struct stereo_fb_layout layout; cairo_t *cr; diff --git a/lib/igt_fb.h b/lib/igt_fb.h index d9fb6bb..bafafcd 100644 --- a/lib/igt_fb.h +++ b/lib/igt_fb.h @@ -51,7 +51,7 @@ struct igt_fb { int width; int height; unsigned stride; - unsigned tiling; + uint64_t tiling; unsigned size; cairo_surface_t *cairo_surface; }; @@ -67,16 +67,16 @@ enum igt_text_align { unsigned int igt_create_fb_with_bo_size(int fd, int width, int height, - uint32_t format, unsigned int tiling, + uint32_t format, uint64_t tiling, struct igt_fb *fb, unsigned bo_size); unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, - unsigned int tiling, struct igt_fb *fb); + uint64_t tiling, struct igt_fb *fb); unsigned int igt_create_color_fb(int fd, int width, int height, - uint32_t format, unsigned int tiling, + uint32_t format, uint64_t tiling, double r, double g, double b, struct igt_fb *fb /* out */); unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode, - uint32_t format, unsigned int tiling); + uint32_t format, uint64_t tiling); void igt_remove_fb(int fd, struct igt_fb *fb); /* cairo-based painting */ diff --git a/lib/igt_kms.h b/lib/igt_kms.h index a1483a4..565df14 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -35,6 +35,7 @@ #include <xf86drmMode.h> #include "igt_fb.h" +#include "ioctl_wrappers.h" /* Low-level helpers with kmstest_ prefix */ diff --git a/tests/kms_3d.c b/tests/kms_3d.c index 6588d9d..fdc05b1 100644 --- a/tests/kms_3d.c +++ b/tests/kms_3d.c @@ -103,7 +103,7 @@ igt_simple_main /* create stereo framebuffer */ fb_id = igt_create_stereo_fb(drm_fd, &connector->modes[i], igt_bpp_depth_to_drm_format(32, 32), - I915_TILING_NONE); + LOCAL_DRM_FORMAT_MOD_NONE); ret = drmModeSetCrtc(drm_fd, config.crtc->crtc_id, fb_id, 0, 0, &connector->connector_id, 1, diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 64fea12..98c2867 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -279,7 +279,7 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 0.0, &data->primary_fb); @@ -384,7 +384,8 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) * with non-square cursors). */ fb_id = igt_create_color_fb(data->drm_fd, cur_w, cur_h + 1, - DRM_FORMAT_ARGB8888, I915_TILING_NONE, + DRM_FORMAT_ARGB8888, + LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 1.0, 1.0, &data->fb); @@ -419,7 +420,8 @@ static void test_cursor_size(data_t *data) * smaller ones to see that the size is applied correctly */ fb_id = igt_create_fb(data->drm_fd, cursor_max_size, cursor_max_size, - DRM_FORMAT_ARGB8888, I915_TILING_NONE, &data->fb); + DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE, + &data->fb); igt_assert(fb_id); /* Use a solid white rectangle as the cursor */ diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index 32c3d98..b6de218 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -324,12 +324,12 @@ static bool prepare_test(data_t *data, enum test_mode test_mode) data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_X, + LOCAL_I915_FORMAT_MOD_X_TILED, 0.0, 0.0, 0.0, &data->fb[0]); igt_assert(data->fb_id[0]); data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_X, + LOCAL_I915_FORMAT_MOD_X_TILED, 0.1, 0.1, 0.1, &data->fb[1]); igt_assert(data->fb_id[1]); diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c index 7f530e6..4d3d37a 100644 --- a/tests/kms_fence_pin_leak.c +++ b/tests/kms_fence_pin_leak.c @@ -131,12 +131,12 @@ static bool run_single_test(data_t *data, enum pipe pipe, igt_output_t *output) igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_X, /* need a fence so must be tiled */ + LOCAL_I915_FORMAT_MOD_X_TILED , /* need a fence so must be tiled */ 0.0, 0.0, 0.0, &fb[0]); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_X, /* need a fence so must be tiled */ + LOCAL_I915_FORMAT_MOD_X_TILED, /* need a fence so must be tiled */ 0.0, 0.0, 0.0, &fb[1]); diff --git a/tests/kms_flip.c b/tests/kms_flip.c index cae02e9..223ac0a 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1325,7 +1325,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, char test_name[128]; unsigned elapsed; unsigned bo_size = 0; - unsigned int tiling; + uint64_t tiling; int i; switch (crtc_count) { @@ -1357,9 +1357,9 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, if (o->flags & TEST_PAN) o->fb_width *= 2; - tiling = I915_TILING_NONE; + tiling = LOCAL_DRM_FORMAT_MOD_NONE; if (o->flags & TEST_FENCE_STRESS) - tiling = I915_TILING_X; + tiling = LOCAL_I915_FORMAT_MOD_X_TILED; /* 256 MB is usually the maximum mappable aperture, * (make it 4x times that to ensure failure) */ @@ -1374,7 +1374,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, tiling, &o->fb_info[1], bo_size); o->fb_ids[2] = igt_create_fb(drm_fd, o->fb_width, o->fb_height, igt_bpp_depth_to_drm_format(o->bpp, o->depth), - I915_TILING_X, &o->fb_info[2]); + LOCAL_I915_FORMAT_MOD_X_TILED, &o->fb_info[2]); igt_assert(o->fb_ids[0]); igt_assert(o->fb_ids[1]); if (o->flags & TEST_FB_BAD_TILING) diff --git a/tests/kms_flip_event_leak.c b/tests/kms_flip_event_leak.c index ea4ce4c..4c1004c 100644 --- a/tests/kms_flip_event_leak.c +++ b/tests/kms_flip_event_leak.c @@ -67,7 +67,7 @@ static bool test(data_t *data, enum pipe pipe, igt_output_t *output) igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - true, /* tiled */ + LOCAL_I915_FORMAT_MOD_X_TILED, 0.0, 0.0, 0.0, &fb[0]); igt_plane_set_fb(primary, &fb[0]); @@ -83,7 +83,7 @@ static bool test(data_t *data, enum pipe pipe, igt_output_t *output) igt_create_color_fb(fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - true, /* tiled */ + LOCAL_I915_FORMAT_MOD_X_TILED, 0.0, 0.0, 0.0, &fb[1]); ret = drmModePageFlip(fd, output->config.crtc->crtc_id, fb[1].fb_id, DRM_MODE_PAGE_FLIP_EVENT, diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c index 9bc085b..9adf143 100644 --- a/tests/kms_flip_tiling.c +++ b/tests/kms_flip_tiling.c @@ -84,7 +84,8 @@ test_flip_changes_tiling(data_t *data, igt_output_t *output) while (width < mode->hdisplay) width *= 2; fb_id = igt_create_fb(data->drm_fd, width, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_NONE, &linear); + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, + &linear); /* fill it with a pattern that will look wrong if tiling is wrong */ fill_linear_fb(&linear, data, mode); @@ -96,8 +97,8 @@ test_flip_changes_tiling(data_t *data, igt_output_t *output) /* allocate a tiled buffer and set the crtc with it */ igt_create_color_fb(data->drm_fd, width, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_X, 0.0, 0.0, 0.0, - &tiled); + DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_X_TILED, + 0.0, 0.0, 0.0, &tiled); igt_plane_set_fb(primary, &tiled); igt_display_commit(&data->display); diff --git a/tests/kms_mmio_vs_cs_flip.c b/tests/kms_mmio_vs_cs_flip.c index 00557aa..1deddd2 100644 --- a/tests/kms_mmio_vs_cs_flip.c +++ b/tests/kms_mmio_vs_cs_flip.c @@ -218,17 +218,17 @@ test_plane(data_t *data, igt_output_t *output, enum pipe pipe, enum igt_plane pl mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 0.0, 0.0, &red_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 1.0, 0.0, &green_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &blue_fb); @@ -368,17 +368,17 @@ test_crtc(data_t *data, igt_output_t *output, enum pipe pipe) mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay+1, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 0.0, 0.0, &red_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay+1, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &blue_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay+1, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 1.0, 0.0, &green_fb); diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c index a658b39..bbedd58 100644 --- a/tests/kms_pipe_crc_basic.c +++ b/tests/kms_pipe_crc_basic.c @@ -138,7 +138,7 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output, igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, colors[c].r, colors[c].g, colors[c].b, diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 8a08f20..412a3cc 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -79,7 +79,7 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, fb_color->red, fb_color->green, fb_color->blue, &fb); igt_plane_set_fb(primary, &fb); @@ -131,7 +131,7 @@ create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode, fb_id = igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, fb); igt_assert(fb_id); @@ -180,7 +180,7 @@ test_plane_position_with_output(data_t *data, igt_create_color_fb(data->drm_fd, 64, 64, /* width, height */ DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 1.0, 0.0, &sprite_fb); igt_plane_set_fb(sprite, &sprite_fb); @@ -249,7 +249,7 @@ create_fb_for_mode__panning(data_t *data, drmModeModeInfo *mode, fb_id = igt_create_fb(data->drm_fd, mode->hdisplay * 2, mode->vdisplay * 2, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, + LOCAL_DRM_FORMAT_MOD_NONE, fb); igt_assert(fb_id); diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 9256640..4689273 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -91,7 +91,7 @@ static void create_cursor_fb(data_t *data) uint32_t fb_id; fb_id = igt_create_fb(data->drm_fd, 64, 64, - DRM_FORMAT_ARGB8888, I915_TILING_NONE, + DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_white); igt_assert(fb_id); @@ -421,7 +421,8 @@ static void run_test(data_t *data) igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_X, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, 0.0, 1.0, 0.0, &data->fb_green); @@ -444,7 +445,8 @@ static void run_test(data_t *data) case PRIMARY: igt_create_color_fb(data->drm_fd, white_h, white_v, - DRM_FORMAT_XRGB8888, I915_TILING_X, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, 1.0, 1.0, 1.0, &data->fb_white); break; diff --git a/tests/kms_pwrite_crc.c b/tests/kms_pwrite_crc.c index aa1d3a3..a8e40ef 100644 --- a/tests/kms_pwrite_crc.c +++ b/tests/kms_pwrite_crc.c @@ -65,7 +65,7 @@ static void test(data_t *data) /* create a non-white fb where we can pwrite later */ igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_NONE, fb); + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, fb); cr = igt_get_cairo_ctx(data->drm_fd, fb); igt_paint_test_pattern(cr, fb->width, fb->height); @@ -123,7 +123,7 @@ static bool prepare_crtc(data_t *data) /* create a white reference fb and flip to it */ igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_NONE, + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 1.0, 1.0, &data->fb[0]); data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); diff --git a/tests/kms_render.c b/tests/kms_render.c index a3487dd..0434c0f 100644 --- a/tests/kms_render.c +++ b/tests/kms_render.c @@ -125,12 +125,12 @@ static int test_format(const char *test_name, width = mode->hdisplay; height = mode->vdisplay; - if (!igt_create_fb(drm_fd, width, height, format, I915_TILING_NONE, - &fb[0])) + if (!igt_create_fb(drm_fd, width, height, format, + LOCAL_DRM_FORMAT_MOD_NONE, &fb[0])) goto err1; - if (!igt_create_fb(drm_fd, width, height, format, I915_TILING_NONE, - &fb[1])) + if (!igt_create_fb(drm_fd, width, height, format, + LOCAL_DRM_FORMAT_MOD_NONE, &fb[1])) goto err2; if (drmModeSetCrtc(drm_fd, cconf->crtc->crtc_id, fb[0].fb_id, diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index 7f09df3..a57692e 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -97,14 +97,14 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, fb_id = igt_create_fb(data->gfx_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, &data->fb); igt_assert(fb_id); fb_cursor_id = igt_create_fb(data->gfx_fd, 128, 128, DRM_FORMAT_ARGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_cursor); igt_assert(fb_cursor_id); diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index 8e6afbf..e29904f 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -186,7 +186,7 @@ static void create_fb_for_crtc(struct crtc_config *crtc, fb_id = igt_create_fb(drm_fd, crtc->mode.hdisplay, crtc->mode.vdisplay, igt_bpp_depth_to_drm_format(bpp, depth), - I915_TILING_NONE, fb_info); + LOCAL_DRM_FORMAT_MOD_NONE, fb_info); igt_assert(fb_id > 0); } diff --git a/tests/kms_sink_crc_basic.c b/tests/kms_sink_crc_basic.c index 41accf4..d2cc7ed 100644 --- a/tests/kms_sink_crc_basic.c +++ b/tests/kms_sink_crc_basic.c @@ -144,13 +144,15 @@ static void run_test(data_t *data) igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_X, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, 0.0, 1.0, 0.0, &data->fb_green); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_X, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, 1.0, 0.0, 0.0, &data->fb_red); diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c index 077a948..2c8bae0 100644 --- a/tests/kms_universal_plane.c +++ b/tests/kms_universal_plane.c @@ -68,22 +68,22 @@ functional_test_init(functional_test_t *test, igt_output_t *output, enum pipe pi mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 0.0, &test->black_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &test->blue_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 1.0, 0.0, &test->yellow_fb); igt_create_color_fb(data->drm_fd, 100, 100, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 0.0, 0.0, &test->red_fb); @@ -310,19 +310,19 @@ sanity_test_init(sanity_test_t *test, igt_output_t *output, enum pipe pipe) mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &test->blue_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay + 100, mode->vdisplay + 100, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &test->oversized_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay - 100, mode->vdisplay - 100, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &test->undersized_fb); @@ -434,12 +434,12 @@ pageflip_test_init(pageflip_test_t *test, igt_output_t *output, enum pipe pipe) mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 1.0, 0.0, 0.0, &test->red_fb); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - false, /* tiled */ + LOCAL_DRM_FORMAT_MOD_NONE, 0.0, 0.0, 1.0, &test->blue_fb); } diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c index 4c6b3d6..242bf94 100644 --- a/tests/pm_lpsp.c +++ b/tests/pm_lpsp.c @@ -85,7 +85,7 @@ static uint32_t create_fb(int drm_fd, int width, int height) uint32_t buffer_id; buffer_id = igt_create_fb(drm_fd, width, height, DRM_FORMAT_XRGB8888, - I915_TILING_NONE, &fb); + LOCAL_DRM_FORMAT_MOD_NONE, &fb); cr = igt_get_cairo_ctx(drm_fd, &fb); igt_paint_test_pattern(cr, width, height); cairo_destroy(cr); diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index db8f427..c53ea92 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -285,7 +285,8 @@ static bool init_modeset_params_for_type(struct mode_set_data *data, return false; igt_create_fb(drm_fd, mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_NONE, ¶ms->fb); + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, + ¶ms->fb); cr = igt_get_cairo_ctx(drm_fd, ¶ms->fb); igt_paint_test_pattern(cr, mode->hdisplay, mode->vdisplay); cairo_destroy(cr); @@ -1508,12 +1509,12 @@ static void cursor_subtest(bool dpms) igt_require(default_mode_params); crtc_id = default_mode_params->crtc_id; - igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, I915_TILING_NONE, - &cursor_fb1); - igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, I915_TILING_NONE, - &cursor_fb2); - igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, I915_TILING_X, - &cursor_fb3); + igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, + LOCAL_DRM_FORMAT_MOD_NONE, &cursor_fb1); + igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, + LOCAL_DRM_FORMAT_MOD_NONE, &cursor_fb2); + igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, &cursor_fb3); fill_igt_fb(&cursor_fb1, 0xFF00FFFF); fill_igt_fb(&cursor_fb2, 0xFF00FF00); @@ -1620,7 +1621,7 @@ static void test_one_plane(bool dpms, uint32_t plane_id, uint32_t crtc_id; struct igt_fb plane_fb1, plane_fb2; int32_t crtc_x = 0, crtc_y = 0; - unsigned int tiling; + uint64_t tiling; disable_all_screens_and_wait(&ms_data); @@ -1632,19 +1633,19 @@ static void test_one_plane(bool dpms, uint32_t plane_id, plane_format = DRM_FORMAT_XRGB8888; plane_w = 64; plane_h = 64; - tiling = I915_TILING_X; + tiling = LOCAL_I915_FORMAT_MOD_X_TILED; break; case PLANE_PRIMARY: plane_format = DRM_FORMAT_XRGB8888; plane_w = default_mode_params->mode->hdisplay; plane_h = default_mode_params->mode->vdisplay; - tiling = I915_TILING_X; + tiling = LOCAL_I915_FORMAT_MOD_X_TILED; break; case PLANE_CURSOR: plane_format = DRM_FORMAT_ARGB8888; plane_w = 64; plane_h = 64; - tiling = I915_TILING_NONE; + tiling = LOCAL_DRM_FORMAT_MOD_NONE; break; default: igt_assert(0); @@ -1763,7 +1764,8 @@ static void fences_subtest(bool dpms) params.connector_id = default_mode_params->connector_id; params.mode = default_mode_params->mode; igt_create_fb(drm_fd, params.mode->hdisplay, params.mode->vdisplay, - DRM_FORMAT_XRGB8888, I915_TILING_X, ¶ms.fb); + DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_X_TILED, + ¶ms.fb); /* Even though we passed "true" as the tiling argument, double-check * that the fb is really tiled. */ diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 68bb21f..64ce4d7 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -81,7 +81,7 @@ drmModeRes *resources; int drm_fd, modes; int test_all_modes = 0, test_preferred_mode = 0, force_mode = 0, test_plane, test_stereo_modes; -unsigned int tiling = I915_TILING_NONE; +uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE; int sleep_between_modes = 5; int do_dpms = 0; /* This aliases to DPMS_ON */ uint32_t depth = 24, stride, bpp; @@ -695,7 +695,7 @@ int main(int argc, char **argv) test_preferred_mode = 1; break; case 't': - tiling = I915_TILING_X; + tiling = LOCAL_I915_FORMAT_MOD_X_TILED; break; case 'r': qr_code = 1; -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 09/13] lib: Add support for new extension to the ADDFB2 ioctl. 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (7 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 08/13] tiling: Convert framebuffer helpers to use fb modifiers Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 10/13] lib/igt_fb: Use new ADDFB2 extension for new tiling modes Tvrtko Ursulin ` (4 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> New functionality accessesed via the __kms_addfb wrapper. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/ioctl_wrappers.c | 26 ++++++++++++++++++++++++++ lib/ioctl_wrappers.h | 9 +++++++++ 2 files changed, 35 insertions(+) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 5cbb873..baebf5c 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1165,3 +1165,29 @@ void igt_require_fb_modifiers(int fd) igt_require(has_modifiers); } + +int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height, + uint32_t stride, uint32_t pixel_format, uint64_t modifier, + uint32_t flags, uint32_t *buf_id) +{ + struct local_drm_mode_fb_cmd2 f; + int ret; + + igt_require_fb_modifiers(fd); + + memset(&f, 0, sizeof(f)); + + f.width = width; + f.height = height; + f.pixel_format = pixel_format; + f.flags = flags; + f.handles[0] = handle; + f.pitches[0] = stride; + f.modifier[0] = modifier; + + ret = drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f); + + *buf_id = f.fb_id; + + return ret < 0 ? -errno : ret; +} diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 99fc7fd..ced7ef3 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -167,4 +167,13 @@ struct local_drm_mode_fb_cmd2 { void igt_require_fb_modifiers(int fd); +/** + * __kms_addfb: + * + * Creates a framebuffer object. + */ +int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height, + uint32_t stride, uint32_t pixel_format, uint64_t modifier, + uint32_t flags, uint32_t *buf_id); + #endif /* IOCTL_WRAPPERS_H */ -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 10/13] lib/igt_fb: Use new ADDFB2 extension for new tiling modes 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (8 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 09/13] lib: Add support for new extension to the ADDFB2 ioctl Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 11/13] lib: Allow the creation of Ys/Yf tiled FBs Tvrtko Ursulin ` (3 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/igt_fb.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 853b2f9..c54907e 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -404,16 +404,10 @@ 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) { - uint32_t handles[4]; - uint32_t pitches[4]; - uint32_t offsets[4]; uint32_t fb_id; int bpp; memset(fb, 0, sizeof(*fb)); - memset(handles, 0, sizeof(handles)); - memset(pitches, 0, sizeof(pitches)); - memset(offsets, 0, sizeof(offsets)); bpp = igt_drm_format_to_bpp(format); @@ -422,14 +416,30 @@ igt_create_fb_with_bo_size(int fd, int width, int height, do_or_die(create_bo_for_fb(fd, width, height, bpp, tiling, bo_size, &fb->gem_handle, &fb->size, &fb->stride)); - handles[0] = fb->gem_handle; - pitches[0] = fb->stride; - igt_debug("%s(handle=%d, pitch=%d)\n", - __func__, handles[0], pitches[0]); - do_or_die(drmModeAddFB2(fd, width, height, format, - handles, pitches, offsets, - &fb_id, 0)); + __func__, fb->gem_handle, fb->stride); + + if (tiling != LOCAL_DRM_FORMAT_MOD_NONE && + tiling != LOCAL_I915_FORMAT_MOD_X_TILED) { + do_or_die(__kms_addfb(fd, fb->gem_handle, width, height, + fb->stride, format, tiling, + LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id)); + } else { + uint32_t handles[4]; + uint32_t pitches[4]; + uint32_t offsets[4]; + + memset(handles, 0, sizeof(handles)); + memset(pitches, 0, sizeof(pitches)); + memset(offsets, 0, sizeof(offsets)); + + handles[0] = fb->gem_handle; + pitches[0] = fb->stride; + + do_or_die(drmModeAddFB2(fd, width, height, format, + handles, pitches, offsets, + &fb_id, 0)); + } fb->width = width; fb->height = height; -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 11/13] lib: Allow the creation of Ys/Yf tiled FBs 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (9 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 10/13] lib/igt_fb: Use new ADDFB2 extension for new tiling modes Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 12/13] testdisplay/skl: Add command line options for Yb/Yf tiled fbs Tvrtko Ursulin ` (2 subsequent siblings) 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> There's no fencing for those tiling layouts, so we create a linear bo for cairo to play with, and when cairo is finished with it, we do a fast copy blit to the fb BO with its final tiling. v2: Move to correct domain after CPU is done with the object (-EINVAL). (Tvrtko Ursulin) Correct arguments passed in to framebuffer creation (segfault). (Tvrtko Ursulin) Pass zero stride to kernel as it expects for Yf&Ys. (Tvrtko Ursulin) v3: Rebase for gem_mmap__cpu changes. (Tvrtko Ursulin) v4: Rebase for addfb2.5. (Tvrtko Ursulin) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/igt_fb.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index c54907e..5c92fac 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -112,7 +112,7 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp, bo_size = size; gem_handle = gem_create(fd, bo_size); - if (tiling != LOCAL_DRM_FORMAT_MOD_NONE) + if (tiling == LOCAL_I915_FORMAT_MOD_X_TILED) ret = __gem_set_tiling(fd, gem_handle, I915_TILING_X, stride); *stride_ret = stride; @@ -629,6 +629,104 @@ static cairo_format_t drm_format_to_cairo(uint32_t drm_format) drm_format, igt_format_str(drm_format)); } +struct fb_blit_upload { + int fd; + struct igt_fb *fb; + struct { + uint32_t handle; + unsigned size, stride; + uint8_t *map; + } linear; +}; + +static void destroy_cairo_surface__blit(void *arg) +{ + struct fb_blit_upload *blit = arg; + struct igt_fb *fb = blit->fb; + unsigned int obj_tiling = I915_TILING_NONE; + + munmap(blit->linear.map, blit->linear.size); + fb->cairo_surface = NULL; + + gem_set_domain(blit->fd, blit->linear.handle, + I915_GEM_DOMAIN_GTT, 0); + + switch (fb->tiling) { + case LOCAL_I915_FORMAT_MOD_X_TILED: + obj_tiling = I915_TILING_X; + break; + case LOCAL_I915_FORMAT_MOD_Y_TILED: + obj_tiling = I915_TILING_Y; + break; + case LOCAL_I915_FORMAT_MOD_Yf_TILED: + obj_tiling = I915_TILING_Yf; + break; + } + + igt_blitter_fast_copy__raw(blit->fd, + blit->linear.handle, + blit->linear.stride, + I915_TILING_NONE, + 0, 0, /* src_x, src_y */ + fb->width, fb->height, + fb->gem_handle, + fb->stride, + obj_tiling, + 0, 0 /* dst_x, dst_y */); + + gem_sync(blit->fd, blit->linear.handle); + gem_close(blit->fd, blit->linear.handle); + + free(blit); +} + +static void create_cairo_surface__blit(int fd, struct igt_fb *fb) +{ + struct fb_blit_upload *blit; + cairo_format_t cairo_format; + int bpp, ret; + + blit = malloc(sizeof(*blit)); + igt_assert(blit); + + /* + * We create a linear BO that we'll map for the CPU to write to (using + * cairo). This linear bo will be then blitted to its final + * destination, tiling it at the same time. + */ + bpp = igt_drm_format_to_bpp(fb->drm_format); + ret = create_bo_for_fb(fd, fb->width, fb->height, bpp, + LOCAL_DRM_FORMAT_MOD_NONE, 0, + &blit->linear.handle, + &blit->linear.size, + &blit->linear.stride); + + igt_assert(ret == 0); + + blit->fd = fd; + blit->fb = fb; + blit->linear.map = gem_mmap__cpu(fd, + blit->linear.handle, + 0, + blit->linear.size, + PROT_READ | PROT_WRITE); + igt_assert(blit->linear.map); + + gem_set_domain(fd, blit->linear.handle, + I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); + + cairo_format = drm_format_to_cairo(fb->drm_format); + fb->cairo_surface = + cairo_image_surface_create_for_data(blit->linear.map, + cairo_format, + fb->width, fb->height, + blit->linear.stride); + + cairo_surface_set_user_data(fb->cairo_surface, + (cairo_user_data_key_t *)create_cairo_surface__blit, + blit, destroy_cairo_surface__blit); +} + static void destroy_cairo_surface__gtt(void *arg) { struct igt_fb *fb = arg; @@ -651,8 +749,13 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb) static cairo_surface_t *get_cairo_surface(int fd, struct igt_fb *fb) { - if (fb->cairo_surface == NULL) - create_cairo_surface__gtt(fd, fb); + if (fb->cairo_surface == NULL) { + if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED || + fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) + create_cairo_surface__blit(fd, fb); + else + create_cairo_surface__gtt(fd, fb); + } gem_set_domain(fd, fb->gem_handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 12/13] testdisplay/skl: Add command line options for Yb/Yf tiled fbs 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (10 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 11/13] lib: Allow the creation of Ys/Yf tiled FBs Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 13/13] tests/kms_flip_tiling: Exercise Y tiling modes on Gen9+ Tvrtko Ursulin 2015-03-12 14:36 ` [PATCH i-g-t v3 00/13] Testing the Y tiled display Damien Lespiau 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- tests/testdisplay.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 64ce4d7..dab9e12 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -51,6 +51,7 @@ #include <cairo.h> #include <errno.h> +#include <getopt.h> #include <math.h> #include <stdint.h> #include <stdbool.h> @@ -71,8 +72,10 @@ #include <stdlib.h> #include <signal.h> -#define SUBTEST_OPTS 1 +#define SUBTEST_OPTS 1 #define HELP_DESCRIPTION 2 +#define Yb_OPT 3 +#define Yf_OPT 4 static int tio_fd; struct termios saved_tio; @@ -544,7 +547,7 @@ int update_display(void) return 1; } -static char optstr[] = "3hiaf:s:d:p:mrto:j:"; +static char optstr[] = "3hiaf:s:d:p:mrto:j:y"; static void __attribute__((noreturn)) usage(char *name, char opt) { @@ -645,6 +648,8 @@ int main(int argc, char **argv) {"run-subtest", 1, 0, SUBTEST_OPTS}, {"help-description", 0, 0, HELP_DESCRIPTION}, {"help", 0, 0, 'h'}, + {"yb", 0, 0, Yb_OPT}, + {"yf", 0, 0, Yf_OPT}, { 0, 0, 0, 0 } }; @@ -697,6 +702,13 @@ int main(int argc, char **argv) case 't': tiling = LOCAL_I915_FORMAT_MOD_X_TILED; break; + case 'y': + case Yb_OPT: + tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; + break; + case Yf_OPT: + tiling = LOCAL_I915_FORMAT_MOD_Yf_TILED; + break; case 'r': qr_code = 1; break; -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH i-g-t 13/13] tests/kms_flip_tiling: Exercise Y tiling modes on Gen9+ 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (11 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 12/13] testdisplay/skl: Add command line options for Yb/Yf tiled fbs Tvrtko Ursulin @ 2015-03-03 14:11 ` Tvrtko Ursulin 2015-03-12 14:36 ` [PATCH i-g-t v3 00/13] Testing the Y tiled display Damien Lespiau 13 siblings, 0 replies; 17+ messages in thread From: Tvrtko Ursulin @ 2015-03-03 14:11 UTC (permalink / raw) To: Intel-gfx From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- tests/kms_flip_tiling.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c index 9adf143..9ca12f7 100644 --- a/tests/kms_flip_tiling.c +++ b/tests/kms_flip_tiling.c @@ -33,6 +33,7 @@ #include "igt_debugfs.h" #include "igt_kms.h" #include "ioctl_wrappers.h" +#include "intel_chipset.h" IGT_TEST_DESCRIPTION("Test that a page flip from a tiled buffer to a linear" " one works correctly."); @@ -40,6 +41,7 @@ IGT_TEST_DESCRIPTION("Test that a page flip from a tiled buffer to a linear" typedef struct { int drm_fd; igt_display_t display; + int gen; } data_t; /* @@ -61,7 +63,7 @@ fill_linear_fb(struct igt_fb *fb, data_t *data, drmModeModeInfo *mode) } static void -test_flip_changes_tiling(data_t *data, igt_output_t *output) +test_flip_changes_tiling(data_t *data, igt_output_t *output, uint64_t tiling) { struct igt_fb linear, tiled; drmModeModeInfo *mode; @@ -97,7 +99,7 @@ test_flip_changes_tiling(data_t *data, igt_output_t *output) /* allocate a tiled buffer and set the crtc with it */ igt_create_color_fb(data->drm_fd, width, mode->vdisplay, - DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_X_TILED, + DRM_FORMAT_XRGB8888, tiling, 0.0, 0.0, 0.0, &tiled); igt_plane_set_fb(primary, &tiled); igt_display_commit(&data->display); @@ -132,6 +134,7 @@ igt_main igt_fixture { data.drm_fd = drm_open_any_master(); + data.gen = intel_gen(intel_get_drm_devid(data.drm_fd)); kmstest_set_vt_graphics_mode(); @@ -141,7 +144,26 @@ igt_main igt_subtest_f("flip-changes-tiling") { for_each_connected_output(&data.display, output) - test_flip_changes_tiling(&data, output); + test_flip_changes_tiling(&data, output, + LOCAL_I915_FORMAT_MOD_X_TILED); + } + + igt_subtest_f("flip-changes-tiling-Y") { + igt_require_fb_modifiers(data.drm_fd); + igt_require(data.gen >= 9); + + for_each_connected_output(&data.display, output) + test_flip_changes_tiling(&data, output, + LOCAL_I915_FORMAT_MOD_Y_TILED); + } + + igt_subtest_f("flip-changes-tiling-Yf") { + igt_require_fb_modifiers(data.drm_fd); + igt_require(data.gen >= 9); + + for_each_connected_output(&data.display, output) + test_flip_changes_tiling(&data, output, + LOCAL_I915_FORMAT_MOD_Yf_TILED); } igt_fixture { -- 2.3.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH i-g-t v3 00/13] Testing the Y tiled display 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin ` (12 preceding siblings ...) 2015-03-03 14:11 ` [PATCH i-g-t 13/13] tests/kms_flip_tiling: Exercise Y tiling modes on Gen9+ Tvrtko Ursulin @ 2015-03-12 14:36 ` Damien Lespiau 13 siblings, 0 replies; 17+ messages in thread From: Damien Lespiau @ 2015-03-12 14:36 UTC (permalink / raw) To: Tvrtko Ursulin; +Cc: Intel-gfx On Tue, Mar 03, 2015 at 02:10:53PM +0000, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Starting with Skylake the display engine can scan out Y tiled objects. (Both > legacy Y tiled, and the new Yf format.) > > This series takes the original work by Damien Lespiau and converts it to use the > new frame buffer modifiers instead of object set/get tiling. Some patches needed > to be dropped, some added and some refactored. > > v2: Refactored for fb modifier changes. > > v3: > * Addressing review comments. > * Added Y(f) tiling sub tests to kms_flip_tiling. Pushed this series (but patch 2). Thanks! -- Damien _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2015-03-12 14:36 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-03-03 14:10 [PATCH i-g-t v3 00/13] Testing the Y tiled display Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 01/13] tests/kms_addfb: Add support for fb modifiers Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 02/13] lib: Extract igt_buf_write_to_png() from gem_render_copy Tvrtko Ursulin 2015-03-03 16:03 ` Tvrtko Ursulin 2015-03-03 16:12 ` Gore, Tim 2015-03-03 14:10 ` [PATCH i-g-t 03/13] tests/kms_addfb: Y tiled testcases Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 04/13] lib/skl: Add gen9 specific igt_blitter_fast_copy() Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 05/13] lib: Don't give a struct igt_buf * to fast_copy_pitch() Tvrtko Ursulin 2015-03-03 14:10 ` [PATCH i-g-t 06/13] lib: Split two helpers to build fast copy's dword0 and dword1 Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 07/13] lib: Provide a raw version of the gen9 fast copy blits Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 08/13] tiling: Convert framebuffer helpers to use fb modifiers Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 09/13] lib: Add support for new extension to the ADDFB2 ioctl Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 10/13] lib/igt_fb: Use new ADDFB2 extension for new tiling modes Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 11/13] lib: Allow the creation of Ys/Yf tiled FBs Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 12/13] testdisplay/skl: Add command line options for Yb/Yf tiled fbs Tvrtko Ursulin 2015-03-03 14:11 ` [PATCH i-g-t 13/13] tests/kms_flip_tiling: Exercise Y tiling modes on Gen9+ Tvrtko Ursulin 2015-03-12 14:36 ` [PATCH i-g-t v3 00/13] Testing the Y tiled display Damien Lespiau
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox