dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tormod Volden <lists.tormod@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: Re: multiple framebuffer drm maps
Date: Tue,  3 May 2011 23:20:07 +0200	[thread overview]
Message-ID: <1304457607-3783-1-git-send-email-lists.tormod@gmail.com> (raw)
In-Reply-To: <BANLkTimJ+jBvVawHo67oB44SkZm=ToZURA@mail.gmail.com>

From: Tormod Volden <debian.tormod@gmail.com>

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 {
-- 
1.7.0.4

  reply	other threads:[~2011-05-03 21:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-25 21:54 multiple framebuffer drm maps Tormod Volden
2011-05-03 21:20 ` Tormod Volden [this message]
2011-05-03 21:54   ` Tormod Volden
2011-05-22 19:27     ` [PATCH] drm/savage: Do not add framebuffer and aperture maps Tormod Volden
2011-05-27 18:19       ` [PATCH resend] " Tormod Volden
2011-05-27 20:48         ` Dave Airlie
2011-05-27 23:44           ` Tormod Volden
2011-05-29 23:12             ` [PATCH] drm: Compare only lower 32 bits of framebuffer map offsets Tormod Volden
2011-05-29 23:29               ` Dave Airlie
2011-05-30 19:45                 ` [PATCH v2] " Tormod Volden
2011-05-31 22:04                   ` Tormod Volden
2011-06-10 22:59                   ` Tormod Volden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304457607-3783-1-git-send-email-lists.tormod@gmail.com \
    --to=lists.tormod@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).