From patchwork Tue May 3 21:20:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tormod Volden X-Patchwork-Id: 751732 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p43LKLqq016758 for ; Tue, 3 May 2011 21:20:43 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 659AC9E972 for ; Tue, 3 May 2011 14:20:21 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wy0-f177.google.com (mail-wy0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id E08DB9E747 for ; Tue, 3 May 2011 14:20:12 -0700 (PDT) Received: by wyb28 with SMTP id 28so515717wyb.36 for ; Tue, 03 May 2011 14:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=rgVbQ+uFgkyouam7b6MYRd20KbodT5Ptjng31k0kpi4=; b=JoAHnX05M20pxYRdcMPPWYAuzS8J98k9/IpsO3ioecffILMmIdIURcffWwd3YcSZLR zOJAqFCUHxKUTC1DnysJRV/+13wftJio3Loll7Pf02UYJWQRLd0VbkG5UuLxZwy5BoLd owaospdufZ1D6Z735a5kggU89ViUgqTPh2IWg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=JuTGP6gp2YvWUD/rbG7HXPnRA9cVhd4Bgg2auwyrw4iYDiVOtp3V8KXaz9eRmWsxeC HSJ2bknqeKPp+L8zUZES9SiBFNipH3u2iFSniElniiO7c/VgCKOIaUvKQizEUitsTXQ+ weJ3XkkfO7RQ8Ernw8+/duYabX3iXa0vPAndA= Received: by 10.216.232.23 with SMTP id m23mr332191weq.26.1304457611567; Tue, 03 May 2011 14:20:11 -0700 (PDT) Received: from localhost.localdomain (80-219-113-251.dclient.hispeed.ch [80.219.113.251]) by mx.google.com with ESMTPS id f52sm256652wes.11.2011.05.03.14.20.09 (version=SSLv3 cipher=OTHER); Tue, 03 May 2011 14:20:09 -0700 (PDT) From: Tormod Volden To: dri-devel@lists.freedesktop.org Subject: Re: multiple framebuffer drm maps Date: Tue, 3 May 2011 23:20:07 +0200 Message-Id: <1304457607-3783-1-git-send-email-lists.tormod@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 03 May 2011 21:20:43 +0000 (UTC) From: Tormod Volden Subject: [PATCH] drm: Add flag for multiple framebuffer support Do not ignore the offset when looking for existing framebuffer maps if the new _DRM_MATCH_FB_OFFSET flag is passed to drm_addmap_core. --- > In commit 41c2e75e60200a860a74b7c84a6375c105e7437f "drm: Make > drm_local_map use a resource_size_t offset" [1] the support for multiple > _DRM_FRAMEBUFFER maps per device was taken away. This change made the > savage drivers upset, since these cards have several apertures (the > layout is different between card families) for which the kernel drm > driver sets up maps. And these maps are now mixed up into one broken one. > > The drivers (drm, ddx, mesa) for instance expects a framebuffer map and a > tiled aperture map, and the broken maps show up as rendering corruption > [2] and allocation failures. I have tried to come up with userland > workarounds but it seems impossible since the kernel will only return > the handle to a broken map and there is no way to remap it correctly. > > Would it be possible to reintroduce this support? One solution could be > a new flag _DRM_IGNORE_FB_OFFSET that can be used by those drivers that > need it, or the other way around, a _DRM_CHECK_FB_OFFSET to be added > by the savage drivers and others in the same situation. I can of course > try to write a patch if people think this is a good idea. This was what I had in mind. Probably controversial to add a new flag for this, so more elegant ideas are welcome. Cheers, Tormod drivers/gpu/drm/drm_bufs.c | 4 +++- include/drm/drm.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 3e257a5..9b7b257 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -60,8 +60,10 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, if (map->flags != _DRM_CONTAINS_LOCK) break; case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: return entry; + case _DRM_FRAME_BUFFER: + if (!(map->flags & _DRM_MATCH_FB_OFFSET)) + return entry; default: /* Make gcc happy */ ; } diff --git a/include/drm/drm.h b/include/drm/drm.h index 4be33b4..d4e2560 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -195,7 +195,8 @@ enum drm_map_flags { _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ _DRM_REMOVABLE = 0x40, /**< Removable mapping */ - _DRM_DRIVER = 0x80 /**< Managed by driver */ + _DRM_DRIVER = 0x80, /**< Managed by driver */ + _DRM_MATCH_FB_OFFSET = 0x100 /**< Multiple framebuffer support */ }; struct drm_ctx_priv_map {