glamor: Allow nested mapping of pixmaps.
authorEric Anholt <eric@anholt.net>
Fri, 10 Jan 2014 15:43:09 +0000 (23:43 +0800)
committerEric Anholt <eric@anholt.net>
Mon, 17 Mar 2014 21:30:56 +0000 (14:30 -0700)
commit4c9a20072552c52b3763bd73e7a7e9b9cb8b4993
tree33c5d20c85f0278143ef54d10cb1cb0bd32d4032
parentd86eacedab443f172baccf544d17e09090f71f3c
glamor: Allow nested mapping of pixmaps.

The common pattern is to do nested if statements making calls to
prepare_access() and then pop those mappings back off in each set of
braces.  Some cases checked for src == dst to avoid leaking mappings,
but others didn't.  Others didn't even do the nested mappings, so a
failure in the outer map would result in trying to umap the inner and
failing.

By allowing nested mappings, we can fix both problems by not requiring
the care from the caller, plus we can allow a simpler nesting of all
the prepares in one if statement.

v2: Add a comment about nested unmap behavior, and just reuse the
    glamor_access_t enum.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
glamor/glamor_core.c
glamor/glamor_priv.h