tiling: Convert framebuffer helpers to use fb modifiers

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>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
Tvrtko Ursulin
2015-03-03 14:11:01 +00:00
committed by Damien Lespiau
parent 672e88acb7
commit e36091d1c7
23 changed files with 91 additions and 81 deletions
+1 -1
View File
@@ -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,
+5 -3
View File
@@ -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 */
+2 -2
View File
@@ -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]);
+2 -2
View File
@@ -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]);
+4 -4
View File
@@ -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)
+2 -2
View File
@@ -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,
+4 -3
View File
@@ -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);
+6 -6
View File
@@ -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);
+1 -1
View File
@@ -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,
+4 -4
View File
@@ -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);
@@ -181,7 +181,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);
@@ -263,7 +263,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);
+5 -3
View File
@@ -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);
@@ -436,7 +436,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);
@@ -459,7 +460,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;
+2 -2
View File
@@ -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);
+4 -4
View File
@@ -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,
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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_lt(0, fb_id);
}
+4 -2
View File
@@ -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);
+9 -9
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+14 -12
View File
@@ -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, &params->fb);
DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
&params->fb);
cr = igt_get_cairo_ctx(drm_fd, &params->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, &params.fb);
DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_X_TILED,
&params.fb);
/* Even though we passed "true" as the tiling argument, double-check
* that the fb is really tiled. */
+2 -2
View File
@@ -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;