From patchwork Wed Mar 23 19:44:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cpaul@redhat.com X-Patchwork-Id: 8653441 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 68D449F44D for ; Wed, 23 Mar 2016 19:45:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98E82203ED for ; Wed, 23 Mar 2016 19:45:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9121C203E5 for ; Wed, 23 Mar 2016 19:45:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD5876E01F; Wed, 23 Mar 2016 19:45:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C0846E01F for ; Wed, 23 Mar 2016 19:45:00 +0000 (UTC) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id CAA51C0467ED; Wed, 23 Mar 2016 19:44:59 +0000 (UTC) Received: from ecstaticemu.bos.redhat.com (dhcp-25-74.bos.redhat.com [10.18.25.74]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2NJiwr5022770; Wed, 23 Mar 2016 15:44:59 -0400 From: Lyude To: intel-gfx@lists.freedesktop.org, Chris Wilson Date: Wed, 23 Mar 2016 15:44:37 -0400 Message-Id: <1458762277-14376-1-git-send-email-cpaul@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Subject: [Intel-gfx] [PATCH] uxa: Restore old bo on failure 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 When we fail to do a modeset, we need to make sure that we restore the previous bo in the event that it's changed. Otherwise we'll crash the X server the next time we do a pageflip. This fixes an issue with panning crashing the X server if a user tries to set a large panning resolution such as 5200x3200, and the GPU doesn't have enough memory to handle the bo due to being in UXA mode. Signed-off-by: Lyude Reviewed-by: Chris Wilson --- src/uxa/intel_uxa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uxa/intel_uxa.c b/src/uxa/intel_uxa.c index 590ff5d..830f094 100644 --- a/src/uxa/intel_uxa.c +++ b/src/uxa/intel_uxa.c @@ -1068,7 +1068,7 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); PixmapPtr pixmap; intel_screen_private *intel = intel_get_screen_private(scrn); - dri_bo *bo = intel->front_buffer; + dri_bo *bo = intel->front_buffer, *old_bo; int old_width, old_height, old_pitch; if (!uxa_resources_init(screen)) @@ -1081,6 +1081,7 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen) old_width = pixmap->drawable.width; old_height = pixmap->drawable.height; old_pitch = pixmap->devKind; + old_bo = intel_uxa_get_pixmap_bo(pixmap); if (!screen->ModifyPixmapHeader(pixmap, scrn->virtualX, @@ -1102,6 +1103,9 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen) err: screen->ModifyPixmapHeader(pixmap, old_width, old_height, -1, -1, old_pitch, NULL); + if (old_bo) + intel_uxa_set_pixmap_bo(pixmap, old_bo); + return FALSE; }