On Thu, Apr 02, 2015 at 12:15:13AM +0100, Chris Wilson wrote:
> 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:

The problem is that the kernel hides bit17 swizzling. I chatted with Paulo
on irc about this and we decided just ignore them all is the simplest
approach.
-Daniel

> 
> 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
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to