From patchwork Fri Nov 22 18:46:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11258285 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 34196109A for ; Fri, 22 Nov 2019 18:46:42 +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 1BC832071C for ; Fri, 22 Nov 2019 18:46:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BC832071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 702D06F553; Fri, 22 Nov 2019 18:46:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720057.outbound.protection.outlook.com [40.107.72.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id 605016F553; Fri, 22 Nov 2019 18:46:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Onk2sZVinHnmjFgyJbSijX52gFfqMBHvHX1nDbVxvpFmKgyrGMGrVDqUeCk9TVRRTnWmK3/p+5AGHZklC/XJWoHJ1Hl3jz1FWwTX1fBkw2qXg9x2N9bJzZ84dPzVKYcGjSRPeLORg6mzJYoh01A30OSjMytGD2e//jOjVcgQugFxDZ149YXUySTgYzCWySKnehG2qUKx9Qrb37WzTujcLjhsXFWWWh/UeelqaYech5zgHoum3+yXa5DiSVGSWRvHkkJEDqsTQ6Dbdp5shMqWZe80GMzHOjtYEDzs0PkU/9U9DFGSN3XfUokOTDBkQGvX660DTRoja7LPV6kO5WNJ+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DypjvU3KV7wqJxAIsWH8LhAgE33OjE8pzJDCJ5qNn7w=; b=IJL7LkJ/OAzuMYlkOOtDhCTT+x4/9MHAJhQYh5fS9P78tKm+qavmMiKBqO5a1xe19xt9Lmdz1/mY3MqWdz+MK1wezQgJbDRjcWy/3JS49UI4FVtWiWO02WNRZvvrctFc0A47P8vGj+qk8gZrQZWKJrAroeb1S28IkvU1a7vKJ5x2DZ/LP9pB5sQPzEP/dU0zL88Vshy6xCCcS00aEIm5+9Sj6Ak6rVjHCkVXXmJ3ojC78BRxJp344gfUzBc7TCprnuNh7Bc+N3ZaBquVGaiswgcIBrHs1NFM3I2IYImsGB4dxpEjhWLxykWCbrHAmswipP6zzse0Ajg+ZACKr2Uy4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from BN4PR12CA0009.namprd12.prod.outlook.com (2603:10b6:403:2::19) by BL0PR12MB2499.namprd12.prod.outlook.com (2603:10b6:207:43::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Fri, 22 Nov 2019 18:46:36 +0000 Received: from DM6NAM11FT005.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eaa::209) by BN4PR12CA0009.outlook.office365.com (2603:10b6:403:2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2474.17 via Frontend Transport; Fri, 22 Nov 2019 18:46:36 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM6NAM11FT005.mail.protection.outlook.com (10.13.172.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2451.23 via Frontend Transport; Fri, 22 Nov 2019 18:46:35 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 22 Nov 2019 12:46:35 -0600 Received: from mlipski-pc.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 22 Nov 2019 12:46:34 -0600 From: To: Subject: [PATCH v2] drm/dsc: Return unsigned long on compute offset Date: Fri, 22 Nov 2019 13:46:25 -0500 Message-ID: <20191122184625.20151-1-mikita.lipski@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(346002)(136003)(396003)(428003)(189003)(199004)(305945005)(26005)(8936002)(6666004)(356004)(186003)(2876002)(81156014)(86362001)(426003)(50466002)(53416004)(2616005)(81166006)(50226002)(54906003)(2351001)(8676002)(316002)(336012)(36756003)(70586007)(4326008)(478600001)(2870700001)(70206006)(1076003)(5820100001)(7696005)(6916009)(23676004)(47776003)(2906002)(5660300002)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR12MB2499; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0954f7e0-4303-47c4-ea21-08d76f7c4d36 X-MS-TrafficTypeDiagnostic: BL0PR12MB2499: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-Forefront-PRVS: 02296943FF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vAVx5CVF5Fz1aeUf72GmIbrwjDm5USa?= =?utf-8?q?Vw1343JZJE1gp3nTnm/QinzoLDdXisR0Sxfqfs3drjHBt6tGXoLnakuIKy2mUxZRn?= =?utf-8?q?6psdq9yPMMAfe0FHp5j2N1wcOmcdAJgM6V7EQUjnkwTpix5T5ULuO5LxrVzRsePFG?= =?utf-8?q?HC66thwixCZKv2w9vf3wPKj0sHxHCEyto2J6iepzz1dGXIkWBoieSSm00U5GF3AXF?= =?utf-8?q?S6jXosCBC4KcxHbcdspEeml+KYSwzlN8m9SFxmNQDrk9aT0fCEPWWLZ9eUmj69e8L?= =?utf-8?q?/wfvueLAIu0EcEmA3ZI0TxA327XfIw2X9ygjryH4b9lwQm9I584NeexxYQk2trSkW?= =?utf-8?q?jrrw4tIDAtbi3Elnyf75bRM/KmKyGf82h7SfidY4FKOUtvW59auioYqnafc0Huzg1?= =?utf-8?q?u3u3EztY/zD1Xjq3hlIrhHLVUL7d2K1z4DbWdARv/noup/3fQhFb9TAynQrZ21Hdk?= =?utf-8?q?iCt3xZsJj9DP0WwcBz/rum7I3FNQ1fx7hKNXsgXBaga5ysMAzqXHaR4buc8v3L7Pr?= =?utf-8?q?9gdsqmCCHHqUdsi0kyrzKQbs9nZNd9lRHZ8FYptGFGQGB4xnmd/ZdN/01jPUTLKws?= =?utf-8?q?jzAVxwfm97eGKxge1p49iAirTMGlCt1ItNbnc7zq/7BmKlA2S/s8RWzC+w3oiWb4d?= =?utf-8?q?+kahwm3/8MMwBiJAQQR5ZBmGAIlF1vgO98bx75qTZEhi9H1YOTQJArLwe8dv7QfH+?= =?utf-8?q?O8VlNQK73/yJkpnauqhF/uMXzw7mrE7sQ8c8qBSjKBSq/5AfpPN+CJaPE64wQ8DYm?= =?utf-8?q?2z+kCy+6+wSPidw7f3BLk6X+C5uedktJecxhQoJxsMhuGotySVzMNYX9ySxie21Q+?= =?utf-8?q?cDQMga6gCxkSzNCgvaWq4DwfIDVyZLyloqfcjoqsre4hW0zqJ1TKJCSnGZ9x32ER7?= =?utf-8?q?JAF7hFg08Aufx+0kJK1HIBTiR4pFIjzK1zms+lLkVH3SyT2PRBNcTDdcCYYSurUlE?= =?utf-8?q?FagHNpxkqhPow4J/QsrvyDWToAI7PAXWCYCiKJKAcinhL584Eq19oqxZcsgLn2AhP?= =?utf-8?q?nIWm6fdmrM8qCVtRO2/tk2Lu6A0o9W+ls2btHi75q9N2qHgCUB0ag2SPyEZXgA8Gj?= =?utf-8?q?i/DUcJNnmpLjI3SXoZNZmrevpJrEQwWBqCaw1Xe2pHsMydMkOmx9FkVoaxXlFh+ft?= =?utf-8?q?CYZC9wVPfsyT5IFqkD6usBWrDttu+q94ANn72T6BaaIp0kU6kCkY7HFCYbem/I7pX?= =?utf-8?q?Kz3inM0c7vlzpz/AhuBb6V03BJdjfqrExo8DCxOmrRCCqaWHc1GxMF04X8qb7J9tK?= =?utf-8?q?u8tY9srlh6FnrpARRY/GzcOcbLxOpI3BOv4NJhIRNiGcxWBlOXCHkLcGeV9V9tq8U?= =?utf-8?q?rwD+9eNCMERLin/mfgHSBeKX+I9NVdhQWmL0Q0OFy1zfuOBhhlQyDgWyCvpZ/BjlK?= =?utf-8?q?PJIxbT/WV+j?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2019 18:46:35.7386 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0954f7e0-4303-47c4-ea21-08d76f7c4d36 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2499 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DypjvU3KV7wqJxAIsWH8LhAgE33OjE8pzJDCJ5qNn7w=; b=JfKlIHiZavk1cEdMo98DQYCQ4t9R5OthRkHc8f9b2kGH0LX+i6+yZuX0FZKO4l4gFUdtQEuB22hp+WfgUFRHts1chcS2RH10T9YY/VPesQf/agpwBwF/EfsIIgVdfIPlR11HG2Ef23vC1ZvEagnh7CuUcuXOmJobuHDKZVBLEQg= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; 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: Mikita Lipski , dri-devel@lists.freedesktop.org, Nikola Cornij Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Mikita Lipski We shouldn't compare int with unsigned long to find the max value and since we are not expecting negative value returned from compute_offset we should make this function return unsigned long so we can compare the values when computing rc parameters. v2: Modified function parameters to unsigned type for type consistency Cc: Ville Syrjälä Cc: Nikola Cornij Cc: Harry Wentland Signed-off-by: Mikita Lipski --- drivers/gpu/drm/drm_dsc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c index 74f3527f567d..ccce0297da64 100644 --- a/drivers/gpu/drm/drm_dsc.c +++ b/drivers/gpu/drm/drm_dsc.c @@ -245,11 +245,11 @@ void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_payload, } EXPORT_SYMBOL(drm_dsc_pps_payload_pack); -static int compute_offset(struct drm_dsc_config *vdsc_cfg, int pixels_per_group, - int groups_per_line, int grpcnt) +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group, + unsigned long groups_per_line, unsigned long grpcnt) { - int offset = 0; - int grpcnt_id = DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay, pixels_per_group); + unsigned long offset = 0; + unsigned long grpcnt_id = DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay, pixels_per_group); if (grpcnt <= grpcnt_id) offset = DIV_ROUND_UP(grpcnt * pixels_per_group * vdsc_cfg->bits_per_pixel, 16);