Re: [PATCH 11/15] drm/i915: Add NV12 to primary plane programming.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > > +		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@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux