From patchwork Tue Nov 27 19:02:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 1813371 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id E068EDF254 for ; Wed, 28 Nov 2012 00:04:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4988E6328 for ; Tue, 27 Nov 2012 16:04:04 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 03D9CE5EEC for ; Tue, 27 Nov 2012 16:03:51 -0800 (PST) Received: by mail-vb0-f49.google.com with SMTP id r6so5464343vbi.36 for ; Tue, 27 Nov 2012 16:03:51 -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:x-mailer; bh=DcH8SfeprDYrLaIymZAXW5I4CEtcstrRHpb6bOpM4IE=; b=rynfab6TkpH2KaGK9GIy0AOvMdWIU1J3BiaTOEaY2d5JE1hLIXwaVchE1sZTqxL8zK LrMWINlMZ9CfMFhx0kUuUoVhCPzn1k83XRuBFm3QotIwHvS2UIVYUcQ6SeV6MHtD+3cs JsUDZQ1EDBTb2NG3e2NzP/4V7XBZvq8NY3O7x9M1MZhIlFh+oWNhlJDRoSphl++vCk4A BwY7sKEILRyXkwEQIxODwtgNZvUggGXzBGhymKgU86Hp8g1pBMTpcwV/vGr0BZxPHluk WSIMM+h3IIo+oWmchArL4YWyDcmOvpe3/zwmX2/Obck5Bl3yWRa7wsdwTtUPVPvN6E9h sAwQ== Received: by 10.58.143.12 with SMTP id sa12mr27778065veb.43.1354061031191; Tue, 27 Nov 2012 16:03:51 -0800 (PST) Received: from homer.localdomain.com ([66.187.233.206]) by mx.google.com with ESMTPS id dh10sm9872291veb.8.2012.11.27.16.03.49 (version=SSLv3 cipher=OTHER); Tue, 27 Nov 2012 16:03:50 -0800 (PST) From: j.glisse@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon: track global bo name and always return the same Date: Tue, 27 Nov 2012 14:02:02 -0500 Message-Id: <1354042922-26610-1-git-send-email-j.glisse@gmail.com> X-Mailer: git-send-email 1.7.11.7 Cc: Jerome Glisse X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Jerome Glisse To avoid kernel rejecting cs if we return different global name for same bo keep track of global name and always return the same. Seems to fix issue with suspend/resume failing and repeatly printing following message : [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation -35! There might still be way for a rogue program to trigger this issue. Signed-off-by: Jerome Glisse Reviewed-by: Christian König --- radeon/radeon_bo_gem.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c index 265f177..fca0aaf 100644 --- a/radeon/radeon_bo_gem.c +++ b/radeon/radeon_bo_gem.c @@ -47,11 +47,11 @@ #include "radeon_bo_gem.h" #include struct radeon_bo_gem { - struct radeon_bo_int base; - uint32_t name; - int map_count; - atomic_t reloc_in_cs; - void *priv_ptr; + struct radeon_bo_int base; + uint32_t name; + int map_count; + atomic_t reloc_in_cs; + void *priv_ptr; }; struct bo_manager_gem { @@ -320,15 +320,21 @@ void *radeon_gem_get_reloc_in_cs(struct radeon_bo *bo) int radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name) { + struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo; struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; struct drm_gem_flink flink; int r; + if (bo_gem->name) { + *name = bo_gem->name; + return 0; + } flink.handle = bo->handle; r = drmIoctl(boi->bom->fd, DRM_IOCTL_GEM_FLINK, &flink); if (r) { return r; } + bo_gem->name = flink.name; *name = flink.name; return 0; }