summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-07-17 18:50:13 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-09-25 16:27:00 +0300
commit42359edda12e5ebf715f2a978944a18baaba6490 (patch)
treece77e77c37ef48be4baa77e9e27b5779724695ea /tests
parentb7298a71744fa5a07acdcdd804f4876153d3c977 (diff)
lib/kms: Pass strides[] to __kms_addfb
Make __kms_addfb() usable with planar formats by passing in the stride for each plane. v2: Handle strides[1] for planar formats in kms_available_modes_crc Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_available_modes_crc.c15
-rw-r--r--tests/kms_draw_crc.c6
-rw-r--r--tests/prime_vgem.c8
3 files changed, 17 insertions, 12 deletions
diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index b67b4f83..e77bd80f 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -253,7 +253,8 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
drmModeModeInfo *mode;
uint64_t w, h;
signed ret, gemsize = 0;
- unsigned tile_width, tile_height, stride;
+ unsigned tile_width, tile_height;
+ uint32_t strides[4] = {};
uint32_t offsets[4] = {};
uint64_t tiling;
int bpp = 0;
@@ -294,24 +295,24 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
igt_get_fb_tile_size(data->gfx_fd, tiling, bpp,
&tile_width, &tile_height);
- stride = ALIGN(w * bpp / 8, tile_width);
- gemsize = data->size = stride * ALIGN(h, tile_height);
+ strides[0] = ALIGN(w * bpp / 8, tile_width);
+ gemsize = data->size = strides[0] * ALIGN(h, tile_height);
if (fillers[i].bpp == P010 || fillers[i].bpp == NV12) {
offsets[1] = data->size;
+ strides[1] = strides[0];
gemsize = data->size * 2;
}
data->gem_handle = gem_create(data->gfx_fd, gemsize);
ret = __gem_set_tiling(data->gfx_fd, data->gem_handle,
- igt_fb_mod_to_tiling(tiling), stride);
+ igt_fb_mod_to_tiling(tiling), strides[0]);
igt_assert_eq(ret, 0);
ret = __kms_addfb(data->gfx_fd, data->gem_handle, w, h,
- stride, format, tiling,
- offsets, LOCAL_DRM_MODE_FB_MODIFIERS,
- &data->fb.fb_id);
+ format, tiling, strides, offsets,
+ LOCAL_DRM_MODE_FB_MODIFIERS, &data->fb.fb_id);
if(ret < 0) {
igt_info("Creating fb for format %s failed, return code %d\n",
diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index 86dcf392..fb10d7cc 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -156,14 +156,14 @@ static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
static bool format_is_supported(uint32_t format, uint64_t modifier)
{
uint32_t gem_handle, fb_id;
- unsigned int stride;
+ unsigned int strides[4] = {};
int ret;
gem_handle = igt_create_bo_with_dimensions(drm_fd, 64, 64,
format, modifier,
- 0, NULL, &stride, NULL);
+ 0, NULL, &strides[0], NULL);
ret = __kms_addfb(drm_fd, gem_handle, 64, 64,
- stride, format, modifier, NULL,
+ format, modifier, strides, NULL,
LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
drmModeRmFB(drm_fd, fb_id);
gem_close(drm_fd, gem_handle);
diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index b821fbb8..b95fd4f5 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -750,6 +750,7 @@ static void test_flip(int i915, int vgem, unsigned hang)
signal(SIGHUP, sighandler);
for (int i = 0; i < 2; i++) {
+ uint32_t strides[4] = {};
int fd;
bo[i].width = 1024;
@@ -762,9 +763,12 @@ static void test_flip(int i915, int vgem, unsigned hang)
igt_assert(handle[i]);
close(fd);
+ strides[0] = bo[i].pitch;
+
do_or_die(__kms_addfb(i915, handle[i],
- bo[i].width, bo[i].height, bo[i].pitch,
- DRM_FORMAT_XRGB8888, I915_TILING_NONE, NULL,
+ bo[i].width, bo[i].height,
+ DRM_FORMAT_XRGB8888, I915_TILING_NONE,
+ strides, NULL,
LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id[i]));
igt_assert(fb_id[i]);
}