> > > > +               if (fb->pixel_format == DRM_FORMAT_NV12) {
> > > > +                       int height_in_mem = 
> > > > (fb->offsets[1]/fb->pitches[0]);
> > > > +                       /*
> > > > +                        * If UV starts from middle of a page, then UV 
> > > > start
> > > should
> > > > +                        * be programmed to beginning of that page. And 
> > > > offset
> > > into that
> > > > +                        * page to be programmed into y-offset
> > > > +                        */
> > > > +                       tile_row_adjustment = height_in_mem % 
> > > > tile_height;
> > > > +                       aux_dist = fb->pitches[0] * (height_in_mem -
> > > tile_row_adjustment);
> > > > +                       aux_x_offset = DIV_ROUND_UP(x, 2);
> > > > +                       aux_y_offset = DIV_ROUND_UP(y, 2) +
> > > tile_row_adjustment;
> > > > +                       /* 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;
        }


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to