From patchwork Tue Sep 24 13:17:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 174276 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp3830594oce; Tue, 24 Sep 2019 06:17:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhPxYkcKSsi2Hm6ckZHZ75MrTbIk5fSTH0PuzjMM098/aQ2TzNo9AO4YKFBgT446WpSMfm X-Received: by 2002:a17:90a:170e:: with SMTP id z14mr2960380pjd.119.1569331043516; Tue, 24 Sep 2019 06:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569331043; cv=none; d=google.com; s=arc-20160816; b=AFTeVFeGcajtSvGI9t4nacEisU6uBDgHk46GFRO6aaPhu1RkzO2vGeOh+T3+Zdx+cd lJ6c23fMfAcf/e+4aA6/uPvifdaHRG4+OPYUKPw3fK7IP5dVTCcycjZN5MTUhrLURC86 yqjT60tszPPKPnWalqhmziwMcwEcaLuPkBOhkB3npjqk5+zNz6L63E8CbHEaVP+fg4xt DGxAzybWXSnj7vJdDPtVReXg/0gbK1yi2x6qxGmIaLypan8DcRPlI+QIweeFwW84RmlB Y31wZincqSBFBzzFsf36LvjyCyNkpA75rPddqohmFzhjN6p3YMAp1EB/fXgoGt1SgQOG A3dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=9uX7c58dzQRJ5ZKhlYl7t/jovC7/VOErDvw+R1LbscA=; b=CGVTkx/p8Ycamc8bf31i6wi1gcjz5DoBYiaVqOpCIfKXOKRrRrF+V9jEUcjUeUPaZo ZsvAgQukQnypW8nq2eWPIY+Jyj8/Hj8QnEslBYRr/VTkwKzhVgcuCwgshKHEdArDOkWd xgnpvBhzkbJ+64GNQGI2p5/g7+pJcN2CmH8LTL9wKuGybOEvr6vw7N20hiYuZ6s+raoi 0kgCxtQJJu3klwAzg6LR8G6XlBDMlHkaFQAgE0C2SEcRL0wATUBVBYGcocGvV5jSeiPu PN1QA406LsPfTYL99A8WLbGh5iuWGdCWajULYnH2Kj0e0q1qWw+Y8FTnvHfAz7T+cRzv yIMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 136si1713510pgc.158.2019.09.24.06.17.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Sep 2019 06:17:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04B426EA31; Tue, 24 Sep 2019 13:17:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id D199A6EA31 for ; Tue, 24 Sep 2019 13:17:19 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8ODHCJI037532; Tue, 24 Sep 2019 08:17:12 -0500 Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8ODHCB4073703 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Sep 2019 08:17:12 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 24 Sep 2019 08:17:05 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 24 Sep 2019 08:17:05 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8ODH94R061580; Tue, 24 Sep 2019 08:17:09 -0500 From: Tomi Valkeinen To: , Andrey Smirnov , Andrzej Hajda , Jyri Sarha Subject: [PATCH] drm/bridge: tc358767: fix max_tu_symbol value Date: Tue, 24 Sep 2019 16:17:02 +0300 Message-ID: <20190924131702.9988-1-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569331032; bh=YC5eXFbAHe/ZMGhIbZ0uTd7mLlx0Uwr2lSGQdf63/pw=; h=From:To:CC:Subject:Date; b=KKkskdeauCnWMbdxj3RmhSE7R6CKyXBkk+5i1A7dSbUeDDo+Xx2YQIxzTf+ynveh6 +CHrI06O9bfh3cVAmDJT2sInjwUj1aMPIJfqAAeT0zyKdmO4CpoxggKZFxCnbiYYf9 R6Tqm6nVdTmogKlwleKSxHsTrr26JIWhEozOwmx0= 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: Tomi Valkeinen , Andrey Gusakov , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" max_tu_symbol was programmed to TU_SIZE_RECOMMENDED - 1, which is not what the spec says. The spec says: roundup ((input active video bandwidth in bytes/output active video bandwidth in bytes) * tu_size) It is not quite clear what the above means, but calculating max_tu_symbol = (input Bps / output Bps) * tu_size seems to work and fixes the issues seen. This fixes artifacts in some videomodes (e.g. 1024x768@60 on 2-lanes & 1.62Gbps was pretty bad for me). Signed-off-by: Tomi Valkeinen Tested-by: Jyri Sarha --- drivers/gpu/drm/bridge/tc358767.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 13ade28a36a8..b6aa1bd47e1d 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -677,6 +677,8 @@ static int tc_set_video_mode(struct tc_data *tc, int upper_margin = mode->vtotal - mode->vsync_end; int lower_margin = mode->vsync_start - mode->vdisplay; int vsync_len = mode->vsync_end - mode->vsync_start; + u32 bits_per_pixel = 24; + u32 in_bw, out_bw; /* * Recommended maximum number of symbols transferred in a transfer unit: @@ -684,7 +686,10 @@ static int tc_set_video_mode(struct tc_data *tc, * (output active video bandwidth in bytes)) * Must be less than tu_size. */ - max_tu_symbol = TU_SIZE_RECOMMENDED - 1; + + in_bw = mode->clock * bits_per_pixel / 8; + out_bw = tc->link.base.num_lanes * tc->link.base.rate; + max_tu_symbol = DIV_ROUND_UP(in_bw * TU_SIZE_RECOMMENDED, out_bw); dev_dbg(tc->dev, "set mode %dx%d\n", mode->hdisplay, mode->vdisplay);