From patchwork Mon Nov 27 21:50:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Strode X-Patchwork-Id: 10078265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3700160353 for ; Mon, 27 Nov 2017 21:50:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 290DE29067 for ; Mon, 27 Nov 2017 21:50:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D53D2908D; Mon, 27 Nov 2017 21:50:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C523029067 for ; Mon, 27 Nov 2017 21:50:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5197C6E3CB; Mon, 27 Nov 2017 21:50:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 603796E3CB for ; Mon, 27 Nov 2017 21:50:28 +0000 (UTC) Received: by mail-qk0-x241.google.com with SMTP id o6so34468727qkh.3 for ; Mon, 27 Nov 2017 13:50:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6NFp1cBNlGcoN7iUQaZzcgan/XDSbWuBfnolnV/2R7M=; b=Xt9nomK7/rF+NM69UzgmF/W1K3Raz66rPiMXJFOjFvrO69I/gIrTS9ECeWA9pg9R/z c07pd6HEJilvktU9MX+dAJklG/TVLSptTgC/pAGBPqi9+5MJzArI5p9yCW1W3imqdEXD sbHHNky42MgAvdbVm/kfkqNFTm495/3uf86vArNPuwD1RArFYg7NlSL+VG6fVe/FHJJs Kui/CWhgz/osC4Htpm8+Kil63aPVRPNrMu6GyFUASgXg7losVwZoAUFX8fI5M69hRHC7 gGl8piqyxIGKwK65+31KjBw6fop2kzSc+WWrtj6uf5t3BhBIBb7q8wkxnnlV2fhL7L5D 2qgw== 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; bh=6NFp1cBNlGcoN7iUQaZzcgan/XDSbWuBfnolnV/2R7M=; b=oFxzhxQpXUIezq3QE0EUKAOSeUAtCdL8enmWtV1sozlhHjtz/iEeWpsz3o/CbYtaP7 PncUGQc386iL5zl56VxZ/U5dc0YVms6+OWcPagRlhCe8mfY1tKwu6XTYBolyKsC/BvlC oRe8BCcpVcI0xRJKrJ435iAO+ypFkBBvnFqpPXJ2lPMrQjgVCuWxcROMf16f1jOG4zdd M81Bxe/f19zKCX4AZNyB5erbkrW6YvOEEu7B9UYEIWU8UcP2aaGELxcqg4yPuUywe3vw yAILU1qte3ktJPTwNOO61obhritejd0Zhk0EU3C/8khIuDKKHhae4cWg5tXOp0KtsQNV DMVQ== X-Gm-Message-State: AJaThX7BvQj+78dQ3QQfMJdWEOUqxC+GLC9rgrcSyB7+u1//05QqXtQg L53rxaI1DPZ1d23Hw9cACjcVDA== X-Google-Smtp-Source: AGs4zMaS0cDerjqIDHf4HeZ5oB6NWFytZKEsmkCSlSzyQVF28fJJ4bIGi9DwPVn5lbV+TmnM7SSyjg== X-Received: by 10.55.58.14 with SMTP id h14mr56199437qka.132.1511819427081; Mon, 27 Nov 2017 13:50:27 -0800 (PST) Received: from halfstation.bss.redhat.com ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id g35sm17488179qtk.88.2017.11.27.13.50.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Nov 2017 13:50:26 -0800 (PST) From: Ray Strode To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/qxl: unref cursor bo when finished with it Date: Mon, 27 Nov 2017 16:50:09 -0500 Message-Id: <20171127215010.12621-2-halfline@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171127215010.12621-1-halfline@gmail.com> References: <20171127210706.9200-1-halfline@gmail.com> <20171127215010.12621-1-halfline@gmail.com> Cc: Ray Strode X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Ray Strode qxl_cursor_atomic_update allocs a bo for the cursor that it never frees up at the end of the function. This commit fixes that. Signed-off-by: Ray Strode --- drivers/gpu/drm/qxl/qxl_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 4756b3c9bf2c..7335d99244d5 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -548,61 +548,61 @@ static void qxl_primary_atomic_disable(struct drm_plane *plane, struct qxl_device *qdev = plane->dev->dev_private; if (old_state->fb) { struct qxl_framebuffer *qfb = to_qxl_framebuffer(old_state->fb); struct qxl_bo *bo = gem_to_qxl_bo(qfb->obj); if (bo->is_primary) { qxl_io_destroy_primary(qdev); bo->is_primary = false; } } } static int qxl_plane_atomic_check(struct drm_plane *plane, struct drm_plane_state *state) { return 0; } static void qxl_cursor_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { struct drm_device *dev = plane->dev; struct qxl_device *qdev = dev->dev_private; struct drm_framebuffer *fb = plane->state->fb; struct qxl_release *release; struct qxl_cursor_cmd *cmd; struct qxl_cursor *cursor; struct drm_gem_object *obj; - struct qxl_bo *cursor_bo, *user_bo = NULL; + struct qxl_bo *cursor_bo = NULL, *user_bo = NULL; int ret; void *user_ptr; int size = 64*64*4; ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd), QXL_RELEASE_CURSOR_CMD, &release, NULL); if (ret) return; if (fb != old_state->fb) { obj = to_qxl_framebuffer(fb)->obj; user_bo = gem_to_qxl_bo(obj); /* pinning is done in the prepare/cleanup framevbuffer */ ret = qxl_bo_kmap(user_bo, &user_ptr); if (ret) goto out_free_release; ret = qxl_alloc_bo_reserved(qdev, release, sizeof(struct qxl_cursor) + size, &cursor_bo); if (ret) goto out_kunmap; ret = qxl_release_reserve_list(release, true); if (ret) goto out_free_bo; ret = qxl_bo_kmap(cursor_bo, (void **)&cursor); @@ -618,60 +618,62 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, cursor->data_size = size; cursor->chunk.next_chunk = 0; cursor->chunk.prev_chunk = 0; cursor->chunk.data_size = size; memcpy(cursor->chunk.data, user_ptr, size); qxl_bo_kunmap(cursor_bo); qxl_bo_kunmap(user_bo); cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release); cmd->u.set.visible = 1; cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0); cmd->type = QXL_CURSOR_SET; } else { ret = qxl_release_reserve_list(release, true); if (ret) goto out_free_release; cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release); cmd->type = QXL_CURSOR_MOVE; } cmd->u.position.x = plane->state->crtc_x + fb->hot_x; cmd->u.position.y = plane->state->crtc_y + fb->hot_y; qxl_release_unmap(qdev, release, &cmd->release_info); qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); qxl_release_fence_buffer_objects(release); + qxl_bo_unref(&cursor_bo); + return; out_backoff: qxl_release_backoff_reserve_list(release); out_free_bo: qxl_bo_unref(&cursor_bo); out_kunmap: qxl_bo_kunmap(user_bo); out_free_release: qxl_release_free(qdev, release); return; } static void qxl_cursor_atomic_disable(struct drm_plane *plane, struct drm_plane_state *old_state) { struct qxl_device *qdev = plane->dev->dev_private; struct qxl_release *release; struct qxl_cursor_cmd *cmd; int ret; ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd), QXL_RELEASE_CURSOR_CMD, &release, NULL); if (ret) return; ret = qxl_release_reserve_list(release, true); if (ret) {