drm: Remove users of drm_format_info_plane_cpp
authorMaxime Ripard <maxime.ripard@bootlin.com>
Thu, 16 May 2019 10:31:52 +0000 (12:31 +0200)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Mon, 20 May 2019 11:35:56 +0000 (13:35 +0200)
drm_format_info_plane_cpp() basically just returns the cpp array content
found in the drm_format_info structure.

Since it's pretty trivial, let's remove the function and have the users use
the array directly

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c0a78c87cd0410a1819edad2794ad06543c85bb5.1558002671.git-series.maxime.ripard@bootlin.com
17 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
drivers/gpu/drm/arm/malidp_hw.c
drivers/gpu/drm/arm/malidp_planes.c
drivers/gpu/drm/drm_client.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/drm_format_helper.c
drivers/gpu/drm/i915/intel_sprite.c
drivers/gpu/drm/mediatek/mtk_drm_fb.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
drivers/gpu/drm/msm/msm_fb.c
drivers/gpu/drm/radeon/radeon_fb.c
drivers/gpu/drm/rockchip/rockchip_drm_fb.c
drivers/gpu/drm/stm/ltdc.c
drivers/gpu/drm/tegra/fb.c
drivers/gpu/drm/zte/zx_plane.c
include/drm/drm_fourcc.h

index 6edae6458be884c209271bf592ff794e262b31b1..2e2869299a847df043f2c81e4b989f02ec185d37 100644 (file)
@@ -133,7 +133,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
        u32 cpp;
 
        info = drm_get_format_info(adev->ddev, mode_cmd);
-       cpp = drm_format_info_plane_cpp(info, 0);
+       cpp = info->cpp[0];
 
        /* need to align pitch with crtc limits */
        mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp,
index 1c9e869f4c528be260e7fcf632fd6732911e956b..53391c0f87eb1364f6378126a9df187abefbbd30 100644 (file)
@@ -383,7 +383,7 @@ static void malidp500_modeset(struct malidp_hw_device *hwdev, struct videomode *
 int malidp_format_get_bpp(u32 fmt)
 {
        const struct drm_format_info *info = drm_format_info(fmt);
-       int bpp = drm_format_info_plane_cpp(info, 0) * 8;
+       int bpp = info->cpp[0] * 8;
 
        if (bpp == 0) {
                switch (fmt) {
index 361c029883758063b8e2f6235ef1499ccfe61685..07ceb4ee14e394dada0bc1d21390f6a985eabc78 100644 (file)
@@ -227,7 +227,7 @@ bool malidp_format_mod_supported(struct drm_device *drm,
 
        if (modifier & AFBC_SPLIT) {
                if (!info->is_yuv) {
-                       if (drm_format_info_plane_cpp(info, 0) <= 2) {
+                       if (info->cpp[0] <= 2) {
                                DRM_DEBUG_KMS("RGB formats <= 16bpp are not supported with SPLIT\n");
                                return false;
                        }
index 169d8eeaa66262d5f5899617aee55122173809c5..5abcd83da6a6b5a29a739494631212d00438292b 100644 (file)
@@ -259,7 +259,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
 
        dumb_args.width = width;
        dumb_args.height = height;
-       dumb_args.bpp = drm_format_info_plane_cpp(info, 0) * 8;
+       dumb_args.bpp = info->cpp[0] * 8;
        ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
        if (ret)
                goto err_delete;
index e2d9a6da14a5de96bf676dd57523eeaccf0fd2ce..302cf5f8bcce240369b64bb4e219c6cd768b67c8 100644 (file)
@@ -813,7 +813,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
                                          struct drm_clip_rect *clip)
 {
        struct drm_framebuffer *fb = fb_helper->fb;
-       unsigned int cpp = drm_format_info_plane_cpp(fb->format, 0);
+       unsigned int cpp = fb->format->cpp[0];
        size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
        void *src = fb_helper->fbdev->screen_buffer + offset;
        void *dst = fb_helper->buffer->vaddr + offset;
index 8ad66aa1362a6b47b47bb3f97ed4bb66863fb555..0897cb9aeaff91bf2432bf3ce73b5c89bd81e115 100644 (file)
@@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
 void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
                   struct drm_rect *clip)
 {
-       unsigned int cpp = drm_format_info_plane_cpp(fb->format, 0);
+       unsigned int cpp = fb->format->cpp[0];
        size_t len = (clip->x2 - clip->x1) * cpp;
        unsigned int y, lines = clip->y2 - clip->y1;
 
@@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
                           struct drm_framebuffer *fb,
                           struct drm_rect *clip)
 {
-       unsigned int cpp = drm_format_info_plane_cpp(fb->format, 0);
+       unsigned int cpp = fb->format->cpp[0];
        unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
        size_t len = (clip->x2 - clip->x1) * cpp;
        unsigned int y, lines = clip->y2 - clip->y1;
index e35601b1f8787cd80e838a1d48c6dd6d74acbd6d..c1647c0cc217d7d83378c527cefb463e9429d8e3 100644 (file)
@@ -326,7 +326,7 @@ skl_plane_max_stride(struct intel_plane *plane,
                     unsigned int rotation)
 {
        const struct drm_format_info *info = drm_format_info(pixel_format);
-       int cpp = drm_format_info_plane_cpp(info, 0);
+       int cpp = info->cpp[0];
 
        /*
         * "The stride in bytes must not exceed the
index 0d5334a5a9a74ddf013acc599159fa42195fc8c2..b5e2f230da00678ccdf9cc31efc4e477e8d11b37 100644 (file)
@@ -104,7 +104,7 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
        if (!gem)
                return ERR_PTR(-ENOENT);
 
-       bpp = drm_format_info_plane_cpp(info, 0);
+       bpp = info->cpp[0];
        size = (height - 1) * cmd->pitches[0] + width * bpp;
        size += cmd->offsets[0];
 
index 59b24e0c5070fa861b7466fd155cb73b9e1fcc12..c3751c95b4524f2fb300694d0ae41db1641909bc 100644 (file)
@@ -801,7 +801,7 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
        width = mdp5_crtc->cursor.width;
        height = mdp5_crtc->cursor.height;
 
-       stride = width * drm_format_info_plane_cpp(info, 0);
+       stride = width * info->cpp[0];
 
        get_roi(crtc, &roi_w, &roi_h);
 
index 1ca294694597597f3c0e4f0b103b1ab43034a831..2834837f4d3e10d6d1e340a02daf679a587f8d62 100644 (file)
@@ -158,7 +158,7 @@ uint32_t mdp5_smp_calculate(struct mdp5_smp *smp,
        for (i = 0; i < nplanes; i++) {
                int n, fetch_stride, cpp;
 
-               cpp = drm_format_info_plane_cpp(info, i);
+               cpp = info->cpp[i];
                fetch_stride = width * cpp / (i ? hsub : 1);
 
                n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size);
index 29e45f2144b5a991fba269c9b1f370cea3b86cfc..68fa2c8f61e6592b99ae006bb14d288627a8d245 100644 (file)
@@ -181,7 +181,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
                unsigned int min_size;
 
                min_size = (height - 1) * mode_cmd->pitches[i]
-                        + width * drm_format_info_plane_cpp(info, i)
+                        + width * info->cpp[i]
                         + mode_cmd->offsets[i];
 
                if (bos[i]->size < min_size) {
index dbf596fc4339f4e125e2c994ee4e0dcd55380baa..287e3f92102ae03221dbf3d792e8cb52ad87d6af 100644 (file)
@@ -137,7 +137,7 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
        u32 cpp;
 
        info = drm_get_format_info(rdev->ddev, mode_cmd);
-       cpp = drm_format_info_plane_cpp(info, 0);
+       cpp = info->cpp[0];
 
        /* need to align pitch with crtc limits */
        mode_cmd->pitches[0] = radeon_align_pitch(rdev, mode_cmd->width, cpp,
index 57873c99ae2981bd3584420a8515c55211cb28de..31030cf81bc9752b43aa5a7986841b248a1e68df 100644 (file)
@@ -98,7 +98,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 
                min_size = (height - 1) * mode_cmd->pitches[i] +
                        mode_cmd->offsets[i] +
-                       width * drm_format_info_plane_cpp(info, i);
+                       width * info->cpp[i];
 
                if (obj->size < min_size) {
                        drm_gem_object_put_unlocked(obj);
index e7abe54b9746b3ba878b7be0232afea17d8d82ad..14eb8c40953b21b0c554d377289789729b297437 100644 (file)
@@ -784,7 +784,7 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane,
 
        /* Configures the color frame buffer pitch in bytes & line length */
        pitch_in_bytes = fb->pitches[0];
-       line_length = drm_format_info_plane_cpp(fb->format, 0) *
+       line_length = fb->format->cpp[0] *
                      (x1 - x0 + 1) + (ldev->caps.bus_width >> 3) - 1;
        val = ((pitch_in_bytes << 16) | line_length);
        reg_update_bits(ldev->regs, LTDC_L1CFBLR + lofs,
index d1042196a30faab0dd0dc65b2623746b16af0475..57cc26e1da015d5f2c04419aa91136ae9c4d4257 100644 (file)
@@ -149,7 +149,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
                        goto unreference;
                }
 
-               bpp = drm_format_info_plane_cpp(info, i);
+               bpp = info->cpp[i];
 
                size = (height - 1) * cmd->pitches[i] +
                       width * bpp + cmd->offsets[i];
index d97a4dff515d92bac3f58907986a986b8740fbaf..706452f9b276b3c1a34e1158bdd86d66c5c6dba9 100644 (file)
@@ -222,7 +222,7 @@ static void zx_vl_plane_atomic_update(struct drm_plane *plane,
                cma_obj = drm_fb_cma_get_gem_obj(fb, i);
                paddr = cma_obj->paddr + fb->offsets[i];
                paddr += src_y * fb->pitches[i];
-               paddr += src_x * drm_format_info_plane_cpp(fb->format, i);
+               paddr += src_x * fb->format->cpp[i];
                zx_writel(paddr_reg, paddr);
                paddr_reg += 4;
        }
index 4ef8ccb5d23607f4899c0ff40976c13f8bbac8f5..405466692bd23e93ab6cad05bf9ab765e223d841 100644 (file)
@@ -260,23 +260,6 @@ drm_format_info_is_yuv_sampling_444(const struct drm_format_info *info)
        return info->is_yuv && info->hsub == 1 && info->vsub == 1;
 }
 
-/**
- * drm_format_info_plane_cpp - determine the bytes per pixel value
- * @format: pixel format info
- * @plane: plane index
- *
- * Returns:
- * The bytes per pixel value for the specified plane.
- */
-static inline
-int drm_format_info_plane_cpp(const struct drm_format_info *info, int plane)
-{
-       if (!info || plane >= info->num_planes)
-               return 0;
-
-       return info->cpp[plane];
-}
-
 /**
  * drm_format_info_plane_width - width of the plane given the first plane
  * @format: pixel format info