drm/hisilicon: Enforce 128-byte stride alignment to fix the hardware limitation
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
This commit is contained in:
parent
b812e5b4aa
commit
9c9a8468de
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue