]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/hisilicon: Enforce 128-byte stride alignment to fix the hardware limitation
authorTian Tao <tiantao6@hisilicon.com>
Fri, 6 Mar 2020 03:43:01 +0000 (11:43 +0800)
committerXinliang Liu <xinliang.liu@linaro.org>
Fri, 3 Apr 2020 01:56:31 +0000 (01:56 +0000)
because the hardware limitation,The initial color depth must set to 32bpp
and must set the FB Offset of the display hardware to 128Byte alignment,
which is used to solve the display problem at 800x600 and 1440x900
resolution under 16bpp.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
Acked-by: Xinliang Liu <xinliang.liu@linaro.org>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1583466184-7060-4-git-send-email-tiantao6@hisilicon.com
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c

index 55b46a7150a5e1b08983ef73f6beee24478ec282..cc70e836522f05532e12707194012f505c774933 100644 (file)
@@ -94,6 +94,10 @@ static int hibmc_plane_atomic_check(struct drm_plane *plane,
                return -EINVAL;
        }
 
+       if (state->fb->pitches[0] % 128 != 0) {
+               DRM_DEBUG_ATOMIC("wrong stride with 128-byte aligned\n");
+               return -EINVAL;
+       }
        return 0;
 }
 
@@ -119,11 +123,8 @@ static void hibmc_plane_atomic_update(struct drm_plane *plane,
        writel(gpu_addr, priv->mmio + HIBMC_CRT_FB_ADDRESS);
 
        reg = state->fb->width * (state->fb->format->cpp[0]);
-       /* now line_pad is 16 */
-       reg = PADDING(16, reg);
 
-       line_l = state->fb->width * state->fb->format->cpp[0];
-       line_l = PADDING(16, line_l);
+       line_l = state->fb->pitches[0];
        writel(HIBMC_FIELD(HIBMC_CRT_FB_WIDTH_WIDTH, reg) |
               HIBMC_FIELD(HIBMC_CRT_FB_WIDTH_OFFS, line_l),
               priv->mmio + HIBMC_CRT_FB_WIDTH);
index 222356a4f9a84d019d6fa6df5780ac98911fa105..79a180ae4509f30c35a0c32ec8895c15533c938e 100644 (file)
@@ -94,7 +94,7 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
        priv->dev->mode_config.max_height = 1200;
 
        priv->dev->mode_config.fb_base = priv->fb_base;
-       priv->dev->mode_config.preferred_depth = 24;
+       priv->dev->mode_config.preferred_depth = 32;
        priv->dev->mode_config.prefer_shadow = 1;
 
        priv->dev->mode_config.funcs = (void *)&hibmc_mode_funcs;
@@ -307,7 +307,7 @@ static int hibmc_load(struct drm_device *dev)
        /* reset all the states of crtc/plane/encoder/connector */
        drm_mode_config_reset(dev);
 
-       ret = drm_fbdev_generic_setup(dev, 16);
+       ret = drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
        if (ret) {
                DRM_ERROR("failed to initialize fbdev: %d\n", ret);
                goto err;
index 99397ac3b363723d3aa3e4cc579ca438fd9d52c7..322bd542e89d933174966dde854523235b268a53 100644 (file)
@@ -50,7 +50,7 @@ void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
 int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
                      struct drm_mode_create_dumb *args)
 {
-       return drm_gem_vram_fill_create_dumb(file, dev, 0, 16, args);
+       return drm_gem_vram_fill_create_dumb(file, dev, 0, 128, args);
 }
 
 const struct drm_mode_config_funcs hibmc_mode_funcs = {