From patchwork Fri Nov 8 15:25:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Richter X-Patchwork-Id: 3159951 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38455C045B for ; Fri, 8 Nov 2013 21:25:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41B862047B for ; Fri, 8 Nov 2013 21:25:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ADEE620457 for ; Fri, 8 Nov 2013 21:25:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32F9D1058F1 for ; Fri, 8 Nov 2013 13:25:55 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from charybdis.rus.uni-stuttgart.de (smtp.uni-stuttgart.de [129.69.192.2]) by gabe.freedesktop.org (Postfix) with ESMTP id F4217FC170 for ; Fri, 8 Nov 2013 13:25:12 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by charybdis.rus.uni-stuttgart.de (Postfix) with ESMTP id AC818DBA50; Fri, 8 Nov 2013 16:25:47 +0100 (CET) X-Virus-Scanned: by amavisd-new at charybdis.rus.uni-stuttgart.de Received: from charybdis.rus.uni-stuttgart.de ([127.0.0.1]) by localhost (charybdis.rus.uni-stuttgart.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oFbWLcVXscl4; Fri, 8 Nov 2013 16:25:47 +0100 (CET) Received: from uni-stuttgart.de (mbox.uni-stuttgart.de [129.69.1.9]) (using SSLv3 with cipher DES-CBC3-SHA (168/168 bits)) (Client CN "mbox.uni-stuttgart.de", Issuer "Universitaet Stuttgart CA - G01" (verified OK)) by charybdis.rus.uni-stuttgart.de (Postfix) with ESMTPS; Fri, 8 Nov 2013 16:25:46 +0100 (CET) Received: from [129.69.58.55] (account rusricht@rus.uni-stuttgart.de HELO [129.69.58.55]) by uni-stuttgart.de (CommuniGate Pro SMTP 5.3.14) with ESMTPSA id 175294856; Fri, 08 Nov 2013 16:25:01 +0100 Message-ID: <527D024D.8020000@math.tu-berlin.de> Date: Fri, 08 Nov 2013 16:25:01 +0100 From: Thomas Richter User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Daniel Vetter References: <1383818746-1199-1-git-send-email-daniel.vetter@ffwll.ch> <20131107134516.GP5986@intel.com> <32493_1383921850_527CF8B9_32493_10045_1_20131108075743.GZ14082@phenom.ffwll.local> In-Reply-To: <32493_1383921850_527CF8B9_32493_10045_1_20131108075743.GZ14082@phenom.ffwll.local> Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] Workaround for flicker with panning on the i830 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Hi Daniel, dear intel-experts, please find a revised patch attached that addresses the flicker with panning on the i830 chipset. This patch has now been tested on various screen layouts and seems to be quite reliable, i.e. I haven't seen the flicker since. Unfortunately, I have not been able to find a good workaround for the same problem on a tiled framebuffer, the pattern there, i.e. when the flicker appears, is quite irregular, and it is unclear how to address it. The situation is even worse for 8bit/pixel framebuffers where, for some panning positions, the display remains completely blank. It flickers once or twice, then gets a hick-up, and then stays off. The patch is currently only active on the i830, and only on pipelines using the VGA or DVO output. Strangely enough, LVDS does not seem to be affected, so maybe it is some memory/prefetch related problem. I also checked the debug output, though I found no suspicious activity while the screen flickers or is off. For a linear framebuffer, it seems to be enough to position the start of the pipeline ahead of the desired position, wait one vertical blank, and then adjust it to the correct position. For tiling or 8bit modes, this does not work. Sorry if the formatting is off. This is just what emacs left me with. Please feel free to reformat as you prefer. As a related question: Is there possibly a command line tool that would allow me to modify the intel chipset registers on the fly without going through a kernel recompile? It would make some experiments just so much simpler. Greetings, Thomas diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e5eb11d..e98298f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2087,8 +2087,44 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); I915_WRITE(DSPLINOFF(plane), linear_offset); - } else - I915_WRITE(DSPADDR(plane), i915_gem_obj_ggtt_offset(obj) + linear_offset); + } else if (INTEL_INFO(dev)->gen == 2 && IS_I830(dev) && !intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { + unsigned long planeadr = i915_gem_obj_ggtt_offset(obj) + linear_offset; + DRM_DEBUG_KMS("Plane address is 0x%lx",planeadr); + // I830 panning flicker work around. Only for non-LVDS output, only for i830. + if (obj->tiling_mode != I915_TILING_NONE) { + if ((planeadr & 0x40)) { + DRM_DEBUG_KMS("Detected potential flicker in tiling mode"); + DRM_DEBUG_KMS("No workaround available"); + DRM_DEBUG_KMS("Use a linear frame buffer"); + } + } else { + switch (fb->pixel_format) { + case DRM_FORMAT_XRGB1555: + case DRM_FORMAT_ARGB1555: + case DRM_FORMAT_RGB565: + case DRM_FORMAT_XRGB8888: + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_XBGR8888: + case DRM_FORMAT_ABGR8888: + { + unsigned long int oldadr = I915_READ(DSPADDR(plane)); + if (((oldadr ^ planeadr) & 0x40) && (planeadr & 0xc0) == 0xc0) { + DRM_DEBUG_KMS("Detected potential flicker in linear mode"); + I915_WRITE(DSPADDR(plane), planeadr & (~(0x80))); + POSTING_READ(reg); + intel_wait_for_vblank(dev,intel_crtc->pipe); + } + } + break; + default: + DRM_DEBUG_KMS("No flicker workaround available\n"); + break; + } + } + I915_WRITE(DSPADDR(plane), planeadr); + } else { + I915_WRITE(DSPADDR(plane), i915_gem_obj_ggtt_offset(obj) + linear_offset); + } POSTING_READ(reg); return 0;