From patchwork Sun Feb 17 13:42:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Urja Rannikko X-Patchwork-Id: 10817033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D973922 for ; Sun, 17 Feb 2019 13:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1673E207A7 for ; Sun, 17 Feb 2019 13:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A2102A39A; Sun, 17 Feb 2019 13:44:10 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 0296B207A7 for ; Sun, 17 Feb 2019 13:44:09 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=BpFBn6U6z5kPdwgRB6OzdxalZ2YJ2mHXdNW+ITb/cZY=; b=uKUSQ8pK+ZYNM/ seX1v6WNSjeHXsKlxKNpCnIH55GiA6FYzy1xo7UCdLN4IJ5Fy/wkBifbrgQhgHSuaYPfLNQVLK1NS h+1YnL9cMbzfaW6o1Pm20Q/mcjo54zaRQJ+M19hUbMr1v93gBAVXmKsc7kxN4WzLIDmzOoRy8cF1H Zbq6fYFT1ffnoxOAbYeHdjtmpH0mpZJhYcnPSr65tljBYC+FoqlxLZGprDoLg7ZoejHMWoRRppPkx DIUgoAJqYVXN6/tmfyPZQpE3PFHhnEfW3InSIbDfUeEnJeJZ/hOQoquV8XBhAiev4XrWD4U5VQ1Mu 3fHk/2J9LUSdC9vePmvw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gvMjk-0000xH-Vh; Sun, 17 Feb 2019 13:44:04 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gvMji-0000wo-67; Sun, 17 Feb 2019 13:44:03 +0000 Received: by mail-wm1-x342.google.com with SMTP id n19so2508086wmi.1; Sun, 17 Feb 2019 05:44:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JTP8k9O3Q/sR9rZJ8rE1e/scP/wpNjSPaZ+AmzE47J8=; b=a0Xhnoiw+rIG8j/hxhEe4jXBSzTTEqLhBpyh8FZGDb5Aay2yVCnlEhG49Ssn50pgvY ol/ANuXY+eIQMd9nyPEXZABbKDyr8+Jj4MtCSj2Xte68ibciInljoF57HXmyVjEtIZeQ UqCxHIanhN4irkb6bo2uIhfipxbYPiW5St/phAhHWcPS4iaiH880QZWu1EvOhQ7eir8f DKc9+YeBbTpGhWx3579xx7eKs/id7feyxMHThEbP9RQTbmpX5WiCC4YJgCxadyngHcZ5 RIZXg5PgRgtkEIu/wdd89O5QOeGZWKvX3ktb1kOAZgNaI7/goxGA/nwfqt4dtu3aEzIR rGAw== 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:mime-version :content-transfer-encoding; bh=JTP8k9O3Q/sR9rZJ8rE1e/scP/wpNjSPaZ+AmzE47J8=; b=lWpFm0zV5yKlKSva4+w6TqSPt7WEXafuQgthgr8CrCeOpSYP9XXfZNrXof3+FXrn90 YtTqzj10Fi1RKhLOKnl7Mg52ti88WViZ51g1zhJTRR2WSge5+Ln4Nn5a+kKAP4LArVva B2jZCpzR8b7gx87nyaQnC1ckYeHtn9gQdy46V9PZCy23/fglUXEwovkLrIKkyGm2KN+O XKH/XnXkwEAyKsIbSn+CPZOxHvlKbVyJ+LYGdS+Scqj14wb+1drusRdoU6xEGPjKDemk x5XOtkB+YXvq35zK6xbQclTGdON+tEfvjLZFBLrkhBFXsMOFAcb4Pb2yz0e+KdoU23Pw xI0w== X-Gm-Message-State: AHQUAub9ng6qynDEZagNZuIFeHVMo3LYC+1KW1sgG2Sj57xXZtbofJRI Q/IeuhFmys0nUN3vOG9TsANvGdY1yQ== X-Google-Smtp-Source: AHgI3IaTAIytusszPddf5Ks15k8HO7gM++gsrTFRHX57D6fJstaVMs5XoSnGUKC0WJR7QVMoenM4JA== X-Received: by 2002:a1c:c102:: with SMTP id r2mr12175821wmf.126.1550411039841; Sun, 17 Feb 2019 05:43:59 -0800 (PST) Received: from localhost.localdomain (esm-84-240-79-214.netplaza.fi. [84.240.79.214]) by smtp.gmail.com with ESMTPSA id y22sm42233954wrd.45.2019.02.17.05.43.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Feb 2019 05:43:59 -0800 (PST) From: Urja Rannikko To: linux-rockchip@lists.infradead.org Subject: [PATCH] drm/rockchip: vop: Dither down to RGB666 if output bpc is 6 Date: Sun, 17 Feb 2019 13:42:27 +0000 Message-Id: <20190217134255.6287-1-urjaman@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190217_054402_228441_88FF3422 X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Urja Rannikko , heiko@sntech.de, linux-arm-kernel@lists.infradead.org, hjc@rock-chips.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Tested to fix banding on the 6-bit panel of the ASUS C201. Signed-off-by: Urja Rannikko --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 0c35a88e33dd..96ba1b4cd07b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -896,6 +896,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, u16 vsync_len = adjusted_mode->vsync_end - adjusted_mode->vsync_start; u16 vact_st = adjusted_mode->vtotal - adjusted_mode->vsync_start; u16 vact_end = vact_st + vdisplay; + uint32_t dither_bits = 0; uint32_t pin_pol, val; int ret; @@ -951,10 +952,15 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) s->output_mode = ROCKCHIP_OUT_MODE_P888; - if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && s->output_bpc == 8) - VOP_REG_SET(vop, common, pre_dither_down, 1); - else - VOP_REG_SET(vop, common, pre_dither_down, 0); + /* dither_down includes the bit for pre_dither_down */ + if (s->output_bpc) { /* Only dither if bpc known. */ + if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && s->output_bpc <= 8) + dither_bits = 0x1; + /* Enable allegro dither to RGB666 */ + if (s->output_bpc == 6) + dither_bits |= 0x6; + } + VOP_REG_SET(vop, common, dither_down, dither_bits); VOP_REG_SET(vop, common, out_mode, s->output_mode);