Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6387997ybf; Thu, 5 Mar 2020 19:44:25 -0800 (PST) X-Google-Smtp-Source: ADFU+vu9YZaXRKAwrk4zGoAf1wcTGwc3dOvf8tm12i/oCHyrBrcrrx3ZrlhQB/SvA2ZB4nPwMYCn X-Received: by 2002:aca:1011:: with SMTP id 17mr1278908oiq.72.1583466265841; Thu, 05 Mar 2020 19:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583466265; cv=none; d=google.com; s=arc-20160816; b=dY+MlMgV4W+otgFlwwFhJEnCrUhthjbH33sC9K059BH00hZ/oR5I4VF72qynA6KIal r5LTqhIL+skU21wOehVxNsxOisc3b5voiT/5RDpHZSt4I5h3kuUpoJDNz9C58XuRmQN6 NNeeSFwe970QPDQAVPccSaMFwQLrvixB7sTChj39XpX5bqrJxdHlryfAYReG3pAKRpaG ElfBBXTiYeOErpgRdnaE2YeLt6s9eD1Xg0+xZq7Dtmygq3yZoZH53LCfp5S0c+Am1LP0 D5H6c9ChEtNumeO9YO+i+PqIG0V+tqkevI4mrYmYksSQQl1lJlRLGgCXMR+/XwOC9DZC sNkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=uCx+sAYn4vy3gckI0p+GureIY9pJpLbL6pVSN7WhSio=; b=K1YLXS3p6Ue1mfbM0LRgFU6UAVJmJNe/zWuPOUgZmizSEmDlPZPFhcfQjrmS3I7thH GO7nrpekDsd1d/gMXpI50fq16grgf/kIjOfeRZJevWGGuwI4hxbCDyHPEhgiH9QgJ2ac p84ux/9S0iZ3R89C0V8aUOhZrhfWVeg7cFsunmowHvB2L4/8yGBas84oAumJw0lkHxgS CGTRm94sp3PjW9xHNPyeIDlvx0s9XF0I/DXb0a9rjl1NZPqvvIFbdYmqllBS9d1EbehA tn0Wo/leVJ2Kr4A0ciglzgqHdY4EqWdfgd0zFaWT01X8jH6FL+gP6PEjxJrNNabCAf6G 6DJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si626133otd.209.2020.03.05.19.44.14; Thu, 05 Mar 2020 19:44:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbgCFDnr (ORCPT + 99 others); Thu, 5 Mar 2020 22:43:47 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11180 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726251AbgCFDnn (ORCPT ); Thu, 5 Mar 2020 22:43:43 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 8515FA1DDEA6F237EEE7; Fri, 6 Mar 2020 11:43:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Mar 2020 11:43:33 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH 1/4] drm/hisilicon: Enforce 128-byte stride alignment to fix the hardware limitation Date: Fri, 6 Mar 2020 11:43:01 +0800 Message-ID: <1583466184-7060-4-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> References: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Gong junjie --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 9 +++++---- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 ++-- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c index 55b46a7..cc70e83 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c @@ -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); diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 222356a..79a180a 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -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; diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c index 99397ac..322bd54 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c @@ -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 = { -- 2.7.4