From patchwork Thu May 27 14:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12284337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F636C4708C for ; Thu, 27 May 2021 14:13:59 +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 3C733613CA for ; Thu, 27 May 2021 14:13:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C733613CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 E19656E908; Thu, 27 May 2021 14:13:50 +0000 (UTC) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E1E36E908 for ; Thu, 27 May 2021 14:13:48 +0000 (UTC) Received: by mail-wr1-x430.google.com with SMTP id m18so65987wrv.2 for ; Thu, 27 May 2021 07:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pnUIa0sFyDkR/8t0TailNKYrmyNBbS9VS6vHPr+XJFM=; b=MI7QJEfekx+QOGzsIRRMyARl32XRuIdsycWLVXL35+vdS0IOKThdyvOYPOcyh3h6CS V6wts5tPvyS04l/g09jcS30fVsupQtgT8iyJXgm0vA1WPEJxC07wSsQ4FW+8J23U2E+o hOkYC03h9qs7Hfbc4GLR8qyjgq34V/N1I4GlI= 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:mime-version:content-transfer-encoding; bh=pnUIa0sFyDkR/8t0TailNKYrmyNBbS9VS6vHPr+XJFM=; b=UWLFxMOKVw3SjRpESG0irTEWgtdamHYvCaRXaDNy6SsbGwg7iDtRTnN8ahGemWwvXz GsarkTmGYaeG4UrxWp6kBnE8A6kdpHzs85LD7nayOP7DUrEMHiRDm6NybLF82tAEEbiK DQE5l+EchQloMzbX42kQcgYLRp5PUHY5wEHZvyi9c64AiCDLb8zZQWZteUcTTbjVEXKI LsJ21ccP0O4+8tbQcy2ZM9hI6qNiAZhPGY07gFIDrpE6kOL7fhsiCrlPedK7hSQwJZTV gjQaxMuboN00R5F0sbdWwoCWxJ7mC5x0y3WL4coSDF5MCCHZD4DbHf7o1RDD33k2VgBH wavA== X-Gm-Message-State: AOAM531A/rV/IUBfHmJ50ea2FW9Jd5VK9EmZQ5B9ysR4V50/GVbYwnfa 2b4UFvXeaiXiOOzcWsofbu3wIw== X-Google-Smtp-Source: ABdhPJwr8pdYAXi2FwDiQGlig3DAKuKdotHAwHRhdVdm/7T5zqMiQbXrxQQ/VdnSdhmO+dMcNSy+FA== X-Received: by 2002:a05:6000:1368:: with SMTP id q8mr3673941wrz.342.1622124826789; Thu, 27 May 2021 07:13:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id x10sm3381136wrt.65.2021.05.27.07.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 07:13:46 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH 4/4] drm/shmem-helper: Align to page size in dumb_create Date: Thu, 27 May 2021 16:13:37 +0200 Message-Id: <20210527141337.3857901-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210527141337.3857901-1-daniel.vetter@ffwll.ch> References: <20210527141337.3857901-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , DRI Development , Thomas Zimmermann , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" shmem helpers seem a bit sloppy here by automatically rounding up when actually creating the buffer, which results in under-reporting of what we actually have. Caught by igt/vgem_basic tests. Acked-by: Thomas Zimmermann Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter --- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 11edd54f0580..296ab1b7c07f 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -505,13 +505,13 @@ int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *dev, if (!args->pitch || !args->size) { args->pitch = min_pitch; - args->size = args->pitch * args->height; + args->size = PAGE_ALIGN(args->pitch * args->height); } else { /* ensure sane minimum values */ if (args->pitch < min_pitch) args->pitch = min_pitch; if (args->size < args->pitch * args->height) - args->size = args->pitch * args->height; + args->size = PAGE_ALIGN(args->pitch * args->height); } shmem = drm_gem_shmem_create_with_handle(file, dev, args->size, &args->handle);