On Wed, Sep 09, 2015 at 05:12:06PM +0000, Konduru, Chandra wrote:
> > > > > > > +                 /* For tile-Yf, uv-subplane tile width is 2x of 
> > > > > > > Y-
> > subplane
> > > > > > */
> > > > > > > +                 aux_stride = fb->modifier[0] ==
> > > > > > I915_FORMAT_MOD_Yf_TILED ?
> > > > > > > +                         stride / 2 : stride;
> > > > > >
> > > > > > The 2x part was rather well hidden in the spec. How do we deal with
> > > > > > cases when the Y stride is an odd number of tiles?
> > > > >
> > > > > It should be a round up division to take care of that scenario.
> > > >
> > > > That would stil lresult in a corrupted picture I think. So I was
> > > > thinking that we should just refuse to create NCV12 framebuffers with a
> > > > poorly aligned stride.
> > > >
> > > I added a check in intel_framebuffer_init() which should catch them:
> > >         if (mode_cmd->pitches[0] != mode_cmd->pitches[1]) {
> > >             DRM_DEBUG("y and uv subplanes have different pitches\n");
> > >             return -EINVAL;
> > >         }
> > 
> > That won't catch the case I'm worried about. We would also need to make
> > sure pitches[1] is aligned to the UV tile width.
> 
> If caller is following tile/row/pitch alignments properly for sub-planes of 
> NV12 Yf buffer, above check will catch. 
> But are you referring a case where userland isn't following tile/row size 
> alignments properly? In that case, above may not catch. But
> isn't that is the case even with other FB formats if user land not
> following tile/row/pitch alignments?

We reject any attempt to create a framebuffer with a poorly aligned
stride.

Hmm. Actually I suppose we should just handle it in 
intel_fb_stride_alignment(). Eg.:

case Yf:
        if (cpp != 1 || pixel_format == DRM_FORMAT_NV12)
                return 128;
        else
                return 64;

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to