On 19/09/16 15:27, Laurent Pinchart wrote: > The driver stores in a custom structure named format several pieces of > information about the format that are available in the DRM core. Remove > them and get the information from the DRM core instead. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > --- > @@ -128,13 +122,13 @@ static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { > }; > > static uint32_t get_linear_addr(struct plane *plane, > - const struct format *format, int n, int x, int y) > + const struct drm_format_info *format, int n, int x, int y) > { > uint32_t offset; > > - offset = plane->offset + > - (x * format->planes[n].stride_bpp) + > - (y * plane->pitch / format->planes[n].sub_y); > + offset = plane->offset > + + (x * format->cpp[n] / (n == 1 ? 1 : format->hsub)) > + + (y * plane->pitch / (n == 1 ? 1 : format->vsub)); n is the plane number? Shouldn't the above be (n == 0 ? 1 : format->hsub)? > @@ -413,28 +410,32 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, > > fb = &omap_fb->base; > omap_fb->format = format; > + omap_fb->dss_format = dss_format; > mutex_init(&omap_fb->lock); > > - for (i = 0; i < n; i++) { > + for (i = 0; i < format->num_planes; i++) { > struct plane *plane = &omap_fb->planes[i]; > - int size, pitch = mode_cmd->pitches[i]; > + unsigned int pitch = mode_cmd->pitches[i]; > + unsigned int hsub = i == 0 ? 1 : format->hsub; > + unsigned int vsub = i == 0 ? 1 : format->vsub; This makes me wonder... Will all drivers do something like the above? It's a bit laborious way to get the pixel subsampling factor, and I presume something like above is quite common so that all the calculations can be more generic (and not specific to a UV plane). Tomi
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel