From patchwork Tue Dec 2 19:08:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 5423001 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 ABDF1BEEA8 for ; Tue, 2 Dec 2014 19:09:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D55F6202A1 for ; Tue, 2 Dec 2014 19:09:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 080C720295 for ; Tue, 2 Dec 2014 19:09:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D8F56F9AD; Tue, 2 Dec 2014 11:09:28 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 07FBA6F9AE for ; Tue, 2 Dec 2014 11:09:27 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id l15so29122052wiw.14 for ; Tue, 02 Dec 2014 11:09:26 -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=WdhU319G3i0m/0JW9OHxIEmK+QrQ6uyIDwkyg7bKGk8=; b=UOiqjQcOKVLFpLRbjOeT08mChrPk4wlt0Atcyks4cnPCPkSBPnnRKLvUaXTpl39tGY 8dW5zND5ZiJzddRbK9FHbjVx32E4ITYuDLSI0b3WJWkhF2ZbbFNMmFS06nRi4VzTz7YM 42lkJoqmGDAz0kRCU62ui2t1bhABZRTR4OR28ucp6c8Drsq8O9rX4IyAzUskAWGL7KNM g2v7qHQkqO6l3KwUMqKRyIDH7GRFt3fgFpEAnEPZgIMgGQEvLzaFs+bgFvEsZdHNiGYX O+QVBsqzVjAMLV0jqx3G518AP2uMB6Bmd04/epnKyIMc+yX1XV8ORTRz1Ide3hdEEtoH PM4w== X-Received: by 10.180.96.41 with SMTP id dp9mr7590921wib.13.1417547366190; Tue, 02 Dec 2014 11:09:26 -0800 (PST) Received: from twisty.fritz.box (stgt-5f70211a.pool.mediaWays.net. [95.112.33.26]) by mx.google.com with ESMTPSA id t10sm29713465wix.15.2014.12.02.11.09.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Dec 2014 11:09:25 -0800 (PST) From: Mario Kleiner To: keithp@keithp.com, axel.davy@ens.fr, mario.kleiner.de@gmail.com, jamey@minilop.net, chris@chris-wilson.co.uk, skeggsb@gmail.com Date: Tue, 2 Dec 2014 20:08:47 +0100 Message-Id: <1417547329-9352-2-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417547329-9352-1-git-send-email-mario.kleiner.de@gmail.com> References: <1417547329-9352-1-git-send-email-mario.kleiner.de@gmail.com> Cc: maarten.lankhorst@canonical.com, intel-gfx@lists.freedesktop.org, xorg-devel@lists.x.org, Theo0x48@gmail.com, jcristau@debian.org Subject: [Intel-gfx] [PATCH 1/2] present: Avoid crashes in DebugPresent(), a bit more info. 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 DebugPresent() crashed the server when a dri3 drawable was closed while a pageflipped present was still pending, due to vblank->window-> Null-Ptr deref, so debug builds caused new problems to debug. E.g., glXSwapBuffers(...); glXDestroyWindow(...); -> Pageflip for non-existent window completes -> boom. Also often happens when switching desktop compositor on/off due to Present unflips, or when logging out of session. Also add info if a Present is queued for copyswap or pageflip, if the present is vsynced, and the serial no of the Present request, to aid debugging of pageflip and vsync issues. The serial number is useful as Mesa's dri3/present backend encodes its sendSBC in the serial number, so one can easily correlate server debug output with Mesa and with the SBC values returned to actual OpenGL client applications via OML_sync_control and INTEL_swap_events extension, makes debugging quite a bit more easy. Please also cherry-pick this for a 1.16.x stable update. Signed-off-by: Mario Kleiner --- present/present.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/present/present.c b/present/present.c index ac9047e..e5d3fd5 100644 --- a/present/present.c +++ b/present/present.c @@ -440,7 +440,7 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) DebugPresent(("\tn %lld %p %8lld: %08lx -> %08lx\n", vblank->event_id, vblank, vblank->target_msc, vblank->pixmap ? vblank->pixmap->drawable.id : 0, - vblank->window->drawable.id)); + vblank->window ? vblank->window->drawable.id : 0)); assert (vblank == screen_priv->flip_pending); @@ -859,10 +859,10 @@ present_pixmap(WindowPtr window, } if (pixmap) - DebugPresent(("q %lld %p %8lld: %08lx -> %08lx (crtc %p)\n", + DebugPresent(("q %lld %p %8lld: %08lx -> %08lx (crtc %p) flip %d vsync %d serial %d\n", vblank->event_id, vblank, target_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id, - target_crtc)); + target_crtc, vblank->flip, vblank->sync_flip, vblank->serial)); xorg_list_add(&vblank->event_queue, &present_exec_queue); vblank->queued = TRUE; @@ -955,7 +955,7 @@ present_vblank_destroy(present_vblank_ptr vblank) DebugPresent(("\td %lld %p %8lld: %08lx -> %08lx\n", vblank->event_id, vblank, vblank->target_msc, vblank->pixmap ? vblank->pixmap->drawable.id : 0, - vblank->window->drawable.id)); + vblank->window ? vblank->window->drawable.id : 0)); /* Drop pixmap reference */ if (vblank->pixmap)