[Mesa-dev] [PATCH 06/12] intel: Correctly check for read-only mappings in intel_bufferobj_map_range
Ian Romanick
idr at freedesktop.org
Mon Aug 22 10:36:03 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 08/22/2011 12:32 AM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> The old code was an obvious cut-and-paste fail from intel_bufferobj_map.
>
> Cc: Eric Anholt <eric at anholt.net>
> Cc: Ben Widawsky <ben at bwidawsk.net>
> ---
> src/mesa/drivers/dri/intel/intel_buffer_objects.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
> index 7a0102b..eaf2026 100644
> --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
> +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
> @@ -374,7 +374,6 @@ intel_bufferobj_map_range(struct gl_context * ctx,
> {
> struct intel_context *intel = intel_context(ctx);
> struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
> - GLboolean read_only = (access == GL_READ_ONLY_ARB);
>
> assert(intel_obj);
>
> @@ -386,6 +385,9 @@ intel_bufferobj_map_range(struct gl_context * ctx,
> obj->AccessFlags = access;
>
> if (intel_obj->sys_buffer) {
> + const GLboolean read_only = (access & GL_MAP_READ_BIT) != 0
> + && (access & GL_MAP_WRITE_BIT) == 0;
> +
I just realized that I never went back and re-edited this line. What I
actually wanted was:
const bool read_only =
(access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == GL_MAP_READ_BIT;
This matches the way I get write_only in radeonMapBufferRange (patch 09/12).
> if (!read_only && intel_obj->source)
> release_buffer(intel_obj);
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk5Sk4MACgkQX1gOwKyEAw8IfQCfceirxxC/UMmN6C+NaJBph44q
wIwAoJsJlQWXD7+enkgbM5A4YkfQg4+M
=qkUj
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list