From patchwork Tue Dec 23 12:35:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 5533131 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9DA7E9F2F7 for ; Tue, 23 Dec 2014 12:36:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10E012018E for ; Tue, 23 Dec 2014 12:36:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 84AB7201B9 for ; Tue, 23 Dec 2014 12:36:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E0EBA6E453; Tue, 23 Dec 2014 04:36:41 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 182886E3FE for ; Tue, 23 Dec 2014 04:36:38 -0800 (PST) Received: by mail-vc0-f169.google.com with SMTP id hy10so2323333vcb.14 for ; Tue, 23 Dec 2014 04:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NjWpOX5RfAp4XL6ElOgGTpSG3/c9Wr/FONnOWFh76O4=; b=etLxv0B05ckFSbhpF6y14oDdvjEgPedqgqP3pV7aoD6HpoUK6xJwfEUzbEenVCFsvK JlgmLiCG0cYIv1cw4Nur4XxhOAQb5l3X0z6D5MSIf9iwi27wfTfFCvGYNeidJUF1vmBU WfI2950O8Pbu7p2Ev+RtUTrHIDl3jo7nAkobwZWqze9Q3LHuKB4p2klyU1WP7uR9LCIJ n0HVuzhY9pbNI/6/5WvcOUf7LLwkmv4kNrKoG1gQ7JeZ6UzUV90Cl/uoiRtY7uvTzurg 2Jsnt8YPJJpWYQ1k7EvgUTTMppCmpJLgwBWFlBKtsKZNgZtnl1hHf/8Q4ScCxKtCF0cl JG0Q== X-Received: by 10.220.119.80 with SMTP id y16mr10080104vcq.51.1419338197729; Tue, 23 Dec 2014 04:36:37 -0800 (PST) Received: from localhost.localdomain ([177.92.19.202]) by mx.google.com with ESMTPSA id at12sm4915045vdc.15.2014.12.23.04.36.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Dec 2014 04:36:37 -0800 (PST) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 23 Dec 2014 10:35:38 -0200 Message-Id: <1419338145-1912-3-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1419338145-1912-1-git-send-email-przanoni@gmail.com> References: <1419338145-1912-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 2/9] drm/i915: fix the FBC CFB size tracking X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni We have dev_priv->fbc.size which is supposed to contain the compressed FB size, but it is not: at find_compression_threshold() we try to overallocate the CFB, but we don't consider this when we assign a value to dev_priv->fbc.size. Since the correct CFB size should already be stored at dev_priv->fbc.compressed_fb.size, just kill dev_priv->fbc.size and use the correct value isntead. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_gem_stolen.c | 13 +++++-------- drivers/gpu/drm/i915/intel_fbc.c | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 3752040..f0419c8 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -734,7 +734,6 @@ enum fb_op_origin { }; struct i915_fbc { - unsigned long size; unsigned threshold; unsigned int fb_id; unsigned int possible_framebuffer_bits; diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 4797138..d02c102 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -231,10 +231,8 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp) dev_priv->mm.stolen_base + compressed_llb->start); } - dev_priv->fbc.size = size / dev_priv->fbc.threshold; - - DRM_DEBUG_KMS("reserved %d bytes of contiguous stolen space for FBC\n", - size); + DRM_DEBUG_KMS("reserved %lu bytes of contiguous stolen space for FBC\n", + dev_priv->fbc.compressed_fb.size); return 0; @@ -253,7 +251,8 @@ int i915_gem_stolen_setup_compression(struct drm_device *dev, int size, int fb_c if (!drm_mm_initialized(&dev_priv->mm.stolen)) return -ENODEV; - if (size <= dev_priv->fbc.size) + if (dev_priv->fbc.compressed_fb.allocated && + size <= dev_priv->fbc.compressed_fb.size) return 0; /* Release any current block */ @@ -266,7 +265,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - if (dev_priv->fbc.size == 0) + if (dev_priv->fbc.compressed_fb.allocated == 0) return; drm_mm_remove_node(&dev_priv->fbc.compressed_fb); @@ -275,8 +274,6 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev) drm_mm_remove_node(dev_priv->fbc.compressed_llb); kfree(dev_priv->fbc.compressed_llb); } - - dev_priv->fbc.size = 0; } void i915_gem_cleanup_stolen(struct drm_device *dev) diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index d3ff2c1..5270dc4 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c @@ -78,7 +78,7 @@ static void i8xx_fbc_enable(struct drm_crtc *crtc) dev_priv->fbc.enabled = true; - cfb_pitch = dev_priv->fbc.size / FBC_LL_SIZE; + cfb_pitch = dev_priv->fbc.compressed_fb.size / FBC_LL_SIZE; if (fb->pitches[0] < cfb_pitch) cfb_pitch = fb->pitches[0];