From patchwork Mon Sep 23 12:54:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6buE5a626ZKX?= X-Patchwork-Id: 11156821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C179C14ED for ; Mon, 23 Sep 2019 12:55:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A8CE320867 for ; Mon, 23 Sep 2019 12:55:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8CE320867 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AA3A6E8D5; Mon, 23 Sep 2019 12:55:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.200]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EB796E8D4 for ; Mon, 23 Sep 2019 12:55:02 +0000 (UTC) Received: from hjc?rock-chips.com (unknown [192.168.167.174]) by regular1.263xmail.com (Postfix) with ESMTP id D7EDA327; Mon, 23 Sep 2019 20:54:59 +0800 (CST) X-263anti-spam: KSV:0;BIG:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ADDR-CHECKED4: 1 X-ABS-CHECKED: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P29405T140104878241536S1569243297686069_; Mon, 23 Sep 2019 20:54:58 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <7f510e2dec1a5fec4a829d4e2f2a610e> X-RL-SENDER: hjc@rock-chips.com X-SENDER: hjc@rock-chips.com X-LOGIN-NAME: hjc@rock-chips.com X-FST-TO: dri-devel@lists.freedesktop.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Sandy Huang To: dri-devel@lists.freedesktop.org, Tomi Valkeinen , David Airlie , Daniel Vetter Subject: [PATCH 36/36] drm/omapdrm: use bpp instead of cpp for drm_format_info Date: Mon, 23 Sep 2019 20:54:56 +0800 Message-Id: <1569243296-183701-1-git-send-email-hjc@rock-chips.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" cpp[BytePerPlane] can't describe the 10bit data format correctly, So we use bpp[BitPerPlane] to instead cpp. Signed-off-by: Sandy Huang --- drivers/gpu/drm/omapdrm/omap_fb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 1b8b510..d18aafa 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c @@ -87,7 +87,7 @@ static u32 get_linear_addr(struct drm_framebuffer *fb, u32 offset; offset = fb->offsets[n] - + (x * format->cpp[n] / (n == 0 ? 1 : format->hsub)) + + (x * format->bpp[n] / 8 / (n == 0 ? 1 : format->hsub)) + (y * fb->pitches[n] / (n == 0 ? 1 : format->vsub)); return plane->dma_addr + offset; @@ -206,7 +206,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, } /* convert to pixels: */ - info->screen_width /= format->cpp[0]; + info->screen_width /= format->bpp[0] / 8; if (fb->format->format == DRM_FORMAT_NV12) { plane = &omap_fb->planes[1]; @@ -382,10 +382,10 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, goto fail; } - if (pitch % format->cpp[0]) { + if (pitch % (format->bpp[0] / 8)) { dev_dbg(dev->dev, "buffer pitch (%u bytes) is not a multiple of pixel size (%u bytes)\n", - pitch, format->cpp[0]); + pitch, format->bpp[0] / 8); ret = -EINVAL; goto fail; }