From patchwork Fri Mar 10 04:32:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9614693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE05D60415 for ; Fri, 10 Mar 2017 04:41:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDE4028653 for ; Fri, 10 Mar 2017 04:41:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B28ED286EF; Fri, 10 Mar 2017 04:41:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58843286F3 for ; Fri, 10 Mar 2017 04:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Rv9mIJNHbsF3LXhgoT5CaKR/ptp72aquKVuy28nwBxo=; b=r5VVwokxbU1cQco074dvECJGHY S/wL3vHwuE5STE4A/0MJ0Lf59dh9RqhSW300nnMHz7nnmMF8362lkQFoxXyNqiWjMqOjioJdYvCAU O5WZyL4kh3yVLLdsiDSiaEI8mR5EHI1Ny7VfDLS3G2zeRc2AfEn+lWShGOp5v6p61JGlgnWOLQxnP /WpZjHe1DBd28KhD7rj3u0H6ew/yqEIHMTe9ss4X8Qt0Jo5Zp9V+hZADAEYXXNxyl5ehUruThazk9 FQFg+MWFnQU4Zbue5+sc0Rx1AF6HKBsZcTuQ/qSwILwzS7aRnbSV4CgAqbd0mJ02VwMVx83P1yTQw vzUEgUMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cmCMO-0004Qt-Cc; Fri, 10 Mar 2017 04:41:00 +0000 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCIQ-00016S-79 for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2017 04:36:58 +0000 Received: by mail-qk0-x232.google.com with SMTP id 1so151537577qkl.3 for ; Thu, 09 Mar 2017 20:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lXyNEETdYJ+70QboKu6jOwz2zDKT8RyXrwEAC0/wlH8=; b=DjV4FwNok5/rLxekdhusfsVYc+ufuG3CN+us6xSfwns40Zag5oPB3W2ef0JKUDsd6+ hVX0cFXgT3j8ZDvL91dTcB+2w+K5JNESA8iE/HJcLH8YIZj5fv3FYeq9xYAOTIm1NNR8 ZRlc8hXbCCAtdpYdtkjZ5PxixZ7uKUUQiP5pQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lXyNEETdYJ+70QboKu6jOwz2zDKT8RyXrwEAC0/wlH8=; b=EopEuCfAkC4pgQIl45MRy+8jQHUQKaZOt2EP2/QVvATTuaI72sAn0sbiohKEL/TNMb glI7sJGzpvO0zTtYIY3fAr52f0iBwfIlUYu7SjQe2y+cEtSY5H1JFHUobz5X8ec0NlNh yWywxkVpFztmEot66qPbpJ8iYHcDxGrNpK3b7vUkXAzvmo34mmGlGUFdgdaJC+y6M9+5 eTxEBqJ3rERiXcgs7Dx9imKzxjMBEm/eFgEZySqN/JJNut0B6DgHf6eDgntyKWWqaDxI ZNtujCrfPJxZ1O+ujAl4LrQs1Ga4UC5EEKhUwz+NSbwVLgG44q5LHiHaZ2gfcveMKEZh HcFw== X-Gm-Message-State: AMke39lAOLm8RgwW6543KjXhKBUFmYLfN9DG/wPLOPg0g2mzmKnvUTI7qv4s+T83iCm9mYOh X-Received: by 10.200.48.174 with SMTP id v43mr18339462qta.263.1489120593057; Thu, 09 Mar 2017 20:36:33 -0800 (PST) Received: from boxwood.roam.corp.google.com (cpe-75-189-128-87.nc.res.rr.com. [75.189.128.87]) by smtp.gmail.com with ESMTPSA id n19sm5697731qtn.35.2017.03.09.20.36.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 20:36:32 -0800 (PST) From: Sean Paul To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 13/41] drm/rockchip: pre dither down when output bpc is 8bit Date: Thu, 9 Mar 2017 23:32:28 -0500 Message-Id: <20170310043305.17216-14-seanpaul@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog In-Reply-To: <20170310043305.17216-1-seanpaul@chromium.org> References: <20170310043305.17216-1-seanpaul@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_203654_558492_F70DD3AF X-CRM114-Status: GOOD ( 13.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Heiko Stuebner , linux-arm-kernel@lists.infradead.org, Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mark Yao Some encoder have a crc verification check, crc check fail if input and output data is not equal. That means encoder input and output need use same color depth, vop can output 10bit data to encoder, but some panel only support 8bit depth, that would make crc check die. So pre dither down vop data to 8bit if panel's bpc is 8. Signed-off-by: Mark Yao Signed-off-by: Sean Paul --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 4 ++++ drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++++ drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 6 ++++-- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index f44756029478..b6c6d6d09d7e 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -225,6 +225,7 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, { struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); struct rockchip_dp_device *dp = to_dp(encoder); + struct drm_display_info *di = &conn_state->connector->display_info; int ret; /* @@ -248,6 +249,9 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, s->output_mode = ROCKCHIP_OUT_MODE_P888; } + s->output_bpc = di->bpc; + s->output_type = DRM_MODE_CONNECTOR_eDP; + return 0; } diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index 1844951118da..a966d1d37378 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -36,6 +36,7 @@ struct rockchip_crtc_state { struct drm_crtc_state base; int output_type; int output_mode; + int output_bpc; }; #define to_rockchip_crtc_state(s) \ container_of(s, struct rockchip_crtc_state, base) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index aa5c528c59fc..ea3fff4170d9 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -968,6 +968,10 @@ static void vop_crtc_enable(struct drm_crtc *crtc) DRM_DEV_ERROR(vop->dev, "unsupported connector_type [%d]\n", s->output_type); } + if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && s->output_bpc == 8) + VOP_CTRL_SET(vop, pre_dither_down, 1); + else + VOP_CTRL_SET(vop, pre_dither_down, 0); VOP_CTRL_SET(vop, out_mode, s->output_mode); VOP_CTRL_SET(vop, htotal_pw, (htotal << 16) | hsync_len); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h index 5a4faa85dbd2..9a1eb83271eb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h @@ -47,6 +47,7 @@ struct vop_ctrl { struct vop_reg mipi_en; struct vop_reg dp_en; struct vop_reg out_mode; + struct vop_reg pre_dither_down; struct vop_reg dither_down; struct vop_reg dither_up; struct vop_reg pin_pol; diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c index 91fbc7b52147..e645a9621721 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c @@ -212,7 +212,8 @@ static const struct vop_ctrl rk3288_ctrl_data = { .hdmi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 13), .edp_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 14), .mipi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 15), - .dither_down = VOP_REG(RK3288_DSP_CTRL1, 0xf, 1), + .pre_dither_down = VOP_REG(RK3288_DSP_CTRL1, 0x1, 1), + .dither_down = VOP_REG(RK3288_DSP_CTRL1, 0x7, 2), .dither_up = VOP_REG(RK3288_DSP_CTRL1, 0x1, 6), .data_blank = VOP_REG(RK3288_DSP_CTRL0, 0x1, 19), .out_mode = VOP_REG(RK3288_DSP_CTRL0, 0xf, 0), @@ -289,7 +290,8 @@ static const struct vop_ctrl rk3399_ctrl_data = { .hdmi_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 13), .edp_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 14), .mipi_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 15), - .dither_down = VOP_REG(RK3399_DSP_CTRL1, 0xf, 1), + .pre_dither_down = VOP_REG(RK3399_DSP_CTRL1, 0x1, 1), + .dither_down = VOP_REG(RK3399_DSP_CTRL1, 0x7, 2), .dither_up = VOP_REG(RK3399_DSP_CTRL1, 0x1, 6), .data_blank = VOP_REG(RK3399_DSP_CTRL0, 0x1, 19), .out_mode = VOP_REG(RK3399_DSP_CTRL0, 0xf, 0),