mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									672e88acb7
								
							
						
					
					
						commit
						e36091d1c7
					
				
							
								
								
									
										20
									
								
								lib/igt_fb.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								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;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								lib/igt_fb.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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 */
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,7 @@
 | 
			
		||||
#include <xf86drmMode.h>
 | 
			
		||||
 | 
			
		||||
#include "igt_fb.h"
 | 
			
		||||
#include "ioctl_wrappers.h"
 | 
			
		||||
 | 
			
		||||
/* Low-level helpers with kmstest_ prefix */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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 */
 | 
			
		||||
 | 
			
		||||
@ -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]);
 | 
			
		||||
 | 
			
		||||
@ -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]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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. */
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user