From patchwork Thu Aug 14 16:12:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 4724741 Return-Path: X-Original-To: patchwork-dri-devel@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 E5EB8C033A for ; Thu, 14 Aug 2014 16:15:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 469D9201FE for ; Thu, 14 Aug 2014 16:15:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2B2F82013A for ; Thu, 14 Aug 2014 16:14:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A5826E6EE; Thu, 14 Aug 2014 09:14:42 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E3DF6E6EA for ; Thu, 14 Aug 2014 09:14:40 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix2 Daemon) with ESMTP id 9E24572A15E for ; Thu, 14 Aug 2014 18:14:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at vodafone.de X-Spam-Score: 0.165 X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Authentication-Results: rohrpostix2.prod.vfnet.de (amavisd-new); dkim=softfail (invalid, public key: DNS query timeout for mail._domainkey.vodafone.de) header.i=@vodafone.de Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix2.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EikNqgv1mp6v for ; Thu, 14 Aug 2014 18:14:17 +0200 (CEST) Received: from smtp-02.vodafone.de (smtp-02.vodafone.de [10.215.254.37]) by pegasos-out.vodafone.de (Rohrpostix2 Daemon) with ESMTP id D169672A136 for ; Thu, 14 Aug 2014 18:12:19 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de D169672A136 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafone.de; s=mail; t=1408032739; bh=ylPJfTcRubY6a/nYyJDZkBCz2VOUI+3tFL3IIVbpKF4=; h=From:To:Subject:Date:In-Reply-To:References; b=m7+Lce1Gfsh6+i9bjcYxXmQsJzMXAi8wiyO3zxlLsqG1d6AUAvmDJWREtRbW1rXgj p41A9BYOFIppUzk26R37LD9kEv5P1c1ZIX6sgyeE/phKOrL5uOuSd6W0Z3VkZBlsBY wGCo6fmd1xr7c5uxsJZRFoe4jNUBZ5vuPH1JllNU= X-DKIM: OpenDKIM Filter v2.0.2 smtp-02.vodafone.de 204D2E62F4 X-Virus-Scanned: amavisd-new at vodafone.de Received: from smtp-02.vodafone.de ([127.0.0.1]) by localhost (xsmail-dmz6.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u5RVIVym9fOj for ; Thu, 14 Aug 2014 18:12:08 +0200 (CEST) From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/radeon: add flag to NOT fence a BO on CS Date: Thu, 14 Aug 2014 18:12:05 +0200 Message-Id: <1408032725-6236-5-git-send-email-deathsimple@vodafone.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408032725-6236-1-git-send-email-deathsimple@vodafone.de> References: <1408032725-6236-1-git-send-email-deathsimple@vodafone.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König This is useful and only allowed with pure sync objects. E.g. the CS depends on finishing a previous CS, but should not add the new fence the handle. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_cs.c | 29 ++++++++++++++++++++++++----- include/uapi/drm/radeon_drm.h | 1 + 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 11e4789..bdb8eda 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -225,7 +225,7 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority return 0; } -static void radeon_cs_sync_rings(struct radeon_cs_parser *p) +static int radeon_cs_sync_rings(struct radeon_cs_parser *p) { int i; @@ -237,6 +237,18 @@ static void radeon_cs_sync_rings(struct radeon_cs_parser *p) if (!bo) continue; + fence = bo->tbo.sync_obj; + if (reloc->flags & RADEON_RELOC_DONT_FENCE) { + + /* only allowed for sync objects */ + if (radeon_bo_size(bo) != 0) + return -EINVAL; + + list_del(&p->relocs[i].tv.head); + radeon_bo_unreserve(bo); + p->relocs[i].robj = NULL; + } + /* always sync to the last operation the clients doesn't know about */ radeon_semaphore_sync_to(p->ib.presync, bo->last_sync); @@ -245,8 +257,6 @@ static void radeon_cs_sync_rings(struct radeon_cs_parser *p) reloc->flags & RADEON_RELOC_DONT_SYNC) continue; - fence = bo->tbo.sync_obj; - if (bo->written && radeon_fence_signaled(bo->written)) radeon_fence_unref(&bo->written); @@ -257,6 +267,8 @@ static void radeon_cs_sync_rings(struct radeon_cs_parser *p) else radeon_semaphore_sync_to(p->ib.postsync, fence); } + + return 0; } /* XXX: note that this is called from the legacy UMS CS ioctl as well */ @@ -498,7 +510,10 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, (parser->ring == TN_RING_TYPE_VCE2_INDEX)) radeon_vce_note_usage(rdev); - radeon_cs_sync_rings(parser); + r = radeon_cs_sync_rings(parser); + if (r) + return r; + r = radeon_ib_schedule(rdev, &parser->ib, NULL); if (r) { DRM_ERROR("Failed to schedule IB !\n"); @@ -585,7 +600,11 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, if (r) { goto out; } - radeon_cs_sync_rings(parser); + + r = radeon_cs_sync_rings(parser); + if (r) + goto out; + radeon_semaphore_sync_to(parser->ib.presync, vm->fence); if ((rdev->family >= CHIP_TAHITI) && diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h index 5bd3f68..289a0ca 100644 --- a/include/uapi/drm/radeon_drm.h +++ b/include/uapi/drm/radeon_drm.h @@ -946,6 +946,7 @@ struct drm_radeon_cs_chunk { /* drm_radeon_cs_reloc.flags */ #define RADEON_RELOC_PRIO_MASK (0xf << 0) #define RADEON_RELOC_DONT_SYNC (1 << 4) +#define RADEON_RELOC_DONT_FENCE (1 << 5) struct drm_radeon_cs_reloc { uint32_t handle;