From patchwork Tue Nov 19 14:45:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lipski, Mikita" X-Patchwork-Id: 11252253 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 324B814C0 for ; Tue, 19 Nov 2019 14:45:39 +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 1A952222D1 for ; Tue, 19 Nov 2019 14:45:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A952222D1 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 E6C176E227; Tue, 19 Nov 2019 14:45:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680057.outbound.protection.outlook.com [40.107.68.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66D216E227; Tue, 19 Nov 2019 14:45:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gRouNzB9qWtGTJYJoFn3vyVBCDfYWK/87Degs8x9pPXA6JAviaTXz7+V0hlUr/gUlamk8CqoV8aKVtwg4ei2WlOubzhPEXJfukpIUo5IgF64FjYFNZCfaU2stooHUzUfvjKRnTLZV/9DJvhUSEPCD9BuX92wqCgVyQUE0/IrtUx5DkN0oJwlxeQm6mqFUFmOoGhZRUFXz66ancuTnA2ZVpyk8vWFhcG+fIR+1zlH1yOmCxonJaXrDsAjPdADmPibrZuWZJdiSIDQBodla/F6T6bE8CZfENZWUsVbzRdZB4UgS26hp1LeXkazP1AiVO71s7LLsQIK1iEmGIbXeBTMVg== 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=zhZmkv3LsHPL7VxP3kpV9EvDGmyUsWH8fsRLK74TUjc=; b=BJVXvj0O+tDCmfrLVKEEma5q807RExvcVSW79b1x97XsE6xLTGw15vaqVCecdepIqs2lZd8O+rLqaU6ISkjGDqL9n5jcNcg+Bu7TloT/5ONuYueMH4nE76hiwhoeP3Wsx/bEFBYBdACp/50bmFcSMQBdQeFCZY9yk5rSesCRROyXtl4RuZGI8UTVMqvt5+Qan1oc+XA79dDYxQ16EIXkj+7QgLJvqoiYwvEClesZ3X42Dp30O4kybpjV4DKq9DeVJC+HDZABO4E9TTBvGYNyti6FH8yZtnfw6Ikec9aCV+klzPJ/oQqprglj2Q+YluhD7YF6pjheL07uvXLP9lyKbQ== 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 DM5PR12CA0057.namprd12.prod.outlook.com (2603:10b6:3:103::19) by BN6PR12MB1491.namprd12.prod.outlook.com (2603:10b6:405:5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Tue, 19 Nov 2019 14:45:33 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eaa::208) by DM5PR12CA0057.outlook.office365.com (2603:10b6:3:103::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Tue, 19 Nov 2019 14:45:33 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2451.23 via Frontend Transport; Tue, 19 Nov 2019 14:45:33 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 19 Nov 2019 08:45:33 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 19 Nov 2019 08:45:32 -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; Tue, 19 Nov 2019 08:45:32 -0600 From: To: Subject: [PATCH] drm/dsc: Return unsigned long on compute offset Date: Tue, 19 Nov 2019 09:45:26 -0500 Message-ID: <20191119144526.31797-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)(346002)(39860400002)(396003)(136003)(376002)(428003)(199004)(189003)(426003)(336012)(70206006)(2351001)(70586007)(2616005)(476003)(486006)(50466002)(126002)(2876002)(450100002)(51416003)(5660300002)(4326008)(48376002)(8936002)(26005)(186003)(478600001)(50226002)(8676002)(2906002)(81156014)(81166006)(305945005)(36756003)(86362001)(7696005)(54906003)(6916009)(16586007)(53416004)(316002)(356004)(47776003)(1076003)(6666004)(16060500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1491; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7df4bdc-5a1a-4066-8f3c-08d76cff21e7 X-MS-TrafficTypeDiagnostic: BN6PR12MB1491: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1186; X-Forefront-PRVS: 022649CC2C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b4G8TbfKSsl+5zD5i/iMJuUbzlwaWTfdUvi47K/DLdc4bqOMZDyqcIS8B6zyeqA3jhL2Zu7LeK0PTe37oddL+nbOvU8C4cl2EiF4T47MBJVPhWIYmLbO//gB3YYfQ3Yqxj2P6ylZXSSwBeIFs2KmT0JYbBdeJyThE+jIO+DBD7DT5/nsjxRp1N+f5uAC6lnEF4p0FFHjP78+pZOTYV7Qdj8DC8wgOgus+6NghN5c1vLEGAvc03AMFXee3wJAlgg3BIkVw+nfhdz9MWN3fwraHGttdApCWDSA4fou1Mq+PDBJn3omAT+CTgENG90uC1FB0K8L5Ry/go/4na7lbTU2GZqD06hu0Lrmcoj6FU2J1IowvatHTU9XAIOo6MEczocMGxHeHrrafwGZLDkpdjXQ5lzTXysiy44EmaDvM3bb3RFv82+q5hPCODaxSpAMV7p7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2019 14:45:33.6667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7df4bdc-5a1a-4066-8f3c-08d76cff21e7 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=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1491 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=zhZmkv3LsHPL7VxP3kpV9EvDGmyUsWH8fsRLK74TUjc=; b=GY0l3ihj1pPsZ/JEv2Rfo2mtHGCMOP5ITKN4YbDAUSeLHQZwN9dcT74W7oUGfbVnYeOORqHtdfBltv/iM1AUsPKS5tvZRc8VapmZOLU/aKiG+5DOOjjKnApqCufDCeDi3nq37NQ5DgQMU5p1AWOG3/3AQj37kd0/bTnwPnqgkpM= 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. Cc: Nikola Cornij Cc: Harry Wentland Signed-off-by: Mikita Lipski --- drivers/gpu/drm/drm_dsc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c index 74f3527f567d..ec40604ab6a2 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, +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, int pixels_per_group, int groups_per_line, int 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);