[Intel-gfx] [PATCH 7/7] lib: add igt_draw

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 1 16:15:13 PDT 2015


On Wed, Apr 01, 2015 at 07:40:59PM -0300, Paulo Zanoni wrote:
> +static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
> +			      uint32_t color)
> +{
> +	uint32_t *ptr;
> +	uint32_t tiling, swizzle;
> +
> +	gem_get_tiling(fd, buf->handle, &tiling, &swizzle);
> +
> +	/* We didn't implement suport for the older tiling methods yet. */
> +	if (tiling != I915_TILING_NONE)
> +		igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);

But you now do! You need something like:

static void get_tiling_and_swizzle(int fd,
				   struct buf_data *buf,
				   int *tiling, int *swizzle)
{
	struct local_i915_gem_get_tiling_v2 {
		uint32_t handle;
		uint32_t tiling_mode;
		uint32_t swizzle_mode;
		uint32_t phys_swizzle_mode;
	} tiling;
#define LOCAL_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct local_i915_gem_get_tiling_v2)

	memset(&tiling, 0, sizeof(tiling));
	tiling.handle = buf->handle;
	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_TILING, &tiling);
	igt_require(tiling.phys_swizzle == tiling.swizzle_mode ||
		    intel_gen(intel_get_drm_devid(fd)) >= 5); /* old kernel? */

	*tiling = tiling.tilling_mode;
	*swizzle = tiling.swizzle_mode;
}

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list