drm/omap: remove align_pitch()
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 18 Apr 2016 15:18:37 +0000 (18:18 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 6 Jun 2016 07:14:27 +0000 (10:14 +0300)
The previous commit removed aligning the pitch to SGX's pitch
requirement from align_pitch(). What's left is effectively a function
that returns width * bytespp.

To clean up the driver, we can remove the function and have the
calculation inline in the two places which call align_pitch().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/gpu/drm/omapdrm/omap_drv.h
drivers/gpu/drm/omapdrm/omap_fbdev.c
drivers/gpu/drm/omapdrm/omap_gem.c

index edc796fc8279838082347dc196f779ef85c72da2..1eaade04eadeeb0ea83fe88e45939dd3ea85eb53 100644 (file)
@@ -239,14 +239,6 @@ struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
 struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
                struct dma_buf *buffer);
 
-static inline int align_pitch(int pitch, int width, int bpp)
-{
-       int bytespp = (bpp + 7) / 8;
-       /* in case someone tries to feed us a completely bogus stride: */
-       pitch = max(pitch, width * bytespp);
-       return pitch;
-}
-
 /* map crtc to vblank mask */
 uint32_t pipe2vbl(struct drm_crtc *crtc);
 struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder);
index 89da41ac64d2548508f774e2819e7a986e16087a..372673712843fe03c972debaa026011f7599fed9 100644 (file)
@@ -125,9 +125,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
        mode_cmd.width = sizes->surface_width;
        mode_cmd.height = sizes->surface_height;
 
-       mode_cmd.pitches[0] = align_pitch(
-                       mode_cmd.width * ((sizes->surface_bpp + 7) / 8),
-                       mode_cmd.width, sizes->surface_bpp);
+       mode_cmd.pitches[0] = mode_cmd.width *
+               DIV_ROUND_UP(sizes->surface_bpp, 8);
 
        fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
        if (fbdev->ywrap_enabled) {
index 03698b6c806c6c63eabc10b7b304f9fb1a3bb43c..ea94aadb279d4eb02cb51ecc1a7e2011d76fe32a 100644 (file)
@@ -661,7 +661,8 @@ int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
 {
        union omap_gem_size gsize;
 
-       args->pitch = align_pitch(0, args->width, args->bpp);
+       args->pitch = args->width * DIV_ROUND_UP(args->bpp, 8);
+
        args->size = PAGE_ALIGN(args->pitch * args->height);
 
        gsize = (union omap_gem_size){