On Wed, Sep 09, 2015 at 02:30:58AM +0300, Konduru, Chandra wrote: > > > > > + 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; > } 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. -- Ville Syrjälä Intel OTC --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx