[Mesa-dev] [PATCH] gallium: remove PIPE_BIND_TRANSFER_READ/WRITE

Roland Scheidegger sroland at vmware.com
Thu Sep 8 12:38:21 UTC 2016


Looks reasonable to me, seems like the transfer stuff didn't quite turn
out like initially expected.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>


Am 07.09.2016 um 21:37 schrieb Marek Olšák:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> not used in any useful way
> ---
>  src/gallium/auxiliary/util/u_debug.c                | 2 --
>  src/gallium/docs/source/screen.rst                  | 2 --
>  src/gallium/drivers/freedreno/a2xx/fd2_screen.c     | 5 -----
>  src/gallium/drivers/freedreno/a3xx/fd3_screen.c     | 5 -----
>  src/gallium/drivers/freedreno/a4xx/fd4_screen.c     | 5 -----
>  src/gallium/drivers/ilo/ilo_resource.c              | 2 +-
>  src/gallium/drivers/ilo/ilo_transfer.c              | 3 +--
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c      | 6 ++----
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c      | 6 ++----
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c      | 4 +---
>  src/gallium/drivers/r300/r300_screen.c              | 6 ------
>  src/gallium/drivers/r600/evergreen_state.c          | 5 -----
>  src/gallium/drivers/r600/r600_state.c               | 5 -----
>  src/gallium/drivers/radeon/r600_buffer_common.c     | 2 +-
>  src/gallium/drivers/radeonsi/si_state.c             | 5 -----
>  src/gallium/drivers/vc4/vc4_screen.c                | 5 -----
>  src/gallium/include/pipe/p_defines.h                | 3 +--
>  src/gallium/state_trackers/clover/core/format.cpp   | 4 +---
>  src/gallium/state_trackers/clover/core/resource.cpp | 4 +---
>  src/gallium/state_trackers/nine/adapter9.c          | 3 +--
>  src/gallium/state_trackers/nine/buffer9.c           | 2 +-
>  src/gallium/state_trackers/nine/cubetexture9.c      | 3 ---
>  src/gallium/state_trackers/nine/device9.c           | 2 +-
>  src/gallium/state_trackers/nine/nine_pipe.h         | 3 +--
>  src/gallium/state_trackers/nine/swapchain9.c        | 6 ++----
>  src/gallium/state_trackers/nine/texture9.c          | 3 ---
>  src/gallium/state_trackers/nine/volumetexture9.c    | 3 ---
>  src/mesa/state_tracker/st_cb_readpixels.c           | 7 +++----
>  src/mesa/state_tracker/st_cb_texture.c              | 6 +++---
>  29 files changed, 23 insertions(+), 94 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
> index 3a94b75..4619526 100644
> --- a/src/gallium/auxiliary/util/u_debug.c
> +++ b/src/gallium/auxiliary/util/u_debug.c
> @@ -519,22 +519,20 @@ debug_print_bind_flags(const char *msg, unsigned usage)
>  {
>     static const struct debug_named_value names[] = {
>        DEBUG_NAMED_VALUE(PIPE_BIND_DEPTH_STENCIL),
>        DEBUG_NAMED_VALUE(PIPE_BIND_RENDER_TARGET),
>        DEBUG_NAMED_VALUE(PIPE_BIND_BLENDABLE),
>        DEBUG_NAMED_VALUE(PIPE_BIND_SAMPLER_VIEW),
>        DEBUG_NAMED_VALUE(PIPE_BIND_VERTEX_BUFFER),
>        DEBUG_NAMED_VALUE(PIPE_BIND_INDEX_BUFFER),
>        DEBUG_NAMED_VALUE(PIPE_BIND_CONSTANT_BUFFER),
>        DEBUG_NAMED_VALUE(PIPE_BIND_DISPLAY_TARGET),
> -      DEBUG_NAMED_VALUE(PIPE_BIND_TRANSFER_WRITE),
> -      DEBUG_NAMED_VALUE(PIPE_BIND_TRANSFER_READ),
>        DEBUG_NAMED_VALUE(PIPE_BIND_STREAM_OUTPUT),
>        DEBUG_NAMED_VALUE(PIPE_BIND_CURSOR),
>        DEBUG_NAMED_VALUE(PIPE_BIND_CUSTOM),
>        DEBUG_NAMED_VALUE(PIPE_BIND_GLOBAL),
>        DEBUG_NAMED_VALUE(PIPE_BIND_SHADER_BUFFER),
>        DEBUG_NAMED_VALUE(PIPE_BIND_SHADER_IMAGE),
>        DEBUG_NAMED_VALUE(PIPE_BIND_COMPUTE_RESOURCE),
>        DEBUG_NAMED_VALUE(PIPE_BIND_COMMAND_ARGS_BUFFER),
>        DEBUG_NAMED_VALUE(PIPE_BIND_SCANOUT),
>        DEBUG_NAMED_VALUE(PIPE_BIND_SHARED),
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 5a11e72..5dff650 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -522,22 +522,20 @@ resources might be created and handled quite differently.
>    If this flag is set, surface creation may fail if blending is not supported
>    for the specified format. If it is not set, a driver may choose to ignore
>    blending on surfaces with formats that would require emulation.
>  * ``PIPE_BIND_DISPLAY_TARGET``: A surface that can be presented to screen. Arguments to
>    pipe_screen::flush_front_buffer must have this flag set.
>  * ``PIPE_BIND_SAMPLER_VIEW``: A texture that may be sampled from in a fragment
>    or vertex shader.
>  * ``PIPE_BIND_VERTEX_BUFFER``: A vertex buffer.
>  * ``PIPE_BIND_INDEX_BUFFER``: An vertex index/element buffer.
>  * ``PIPE_BIND_CONSTANT_BUFFER``: A buffer of shader constants.
> -* ``PIPE_BIND_TRANSFER_WRITE``: A transfer object which will be written to.
> -* ``PIPE_BIND_TRANSFER_READ``: A transfer object which will be read from.
>  * ``PIPE_BIND_STREAM_OUTPUT``: A stream output buffer.
>  * ``PIPE_BIND_CUSTOM``:
>  * ``PIPE_BIND_SCANOUT``: A front color buffer or scanout buffer.
>  * ``PIPE_BIND_SHARED``: A sharable buffer that can be given to another
>    process.
>  * ``PIPE_BIND_GLOBAL``: A buffer that can be mapped into the global
>    address space of a compute program.
>  * ``PIPE_BIND_SHADER_BUFFER``: A buffer without a format that can be bound
>    to a shader and can be used with load, store, and atomic instructions.
>  * ``PIPE_BIND_SHADER_IMAGE``: A buffer or texture with a format that can be
> diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> index 007b9e6..12ab5b4 100644
> --- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> +++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> @@ -80,25 +80,20 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
>  	if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
>  			(fd_pipe2depth(format) != (enum adreno_rb_depth_format)~0)) {
>  		retval |= PIPE_BIND_DEPTH_STENCIL;
>  	}
>  
>  	if ((usage & PIPE_BIND_INDEX_BUFFER) &&
>  			(fd_pipe2index(format) != (enum pc_di_index_size)~0)) {
>  		retval |= PIPE_BIND_INDEX_BUFFER;
>  	}
>  
> -	if (usage & PIPE_BIND_TRANSFER_READ)
> -		retval |= PIPE_BIND_TRANSFER_READ;
> -	if (usage & PIPE_BIND_TRANSFER_WRITE)
> -		retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  	if (retval != usage) {
>  		DBG("not supported: format=%s, target=%d, sample_count=%d, "
>  				"usage=%x, retval=%x", util_format_name(format),
>  				target, sample_count, usage, retval);
>  	}
>  
>  	return retval == usage;
>  }
>  
>  void
> diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
> index 52a284e..998ec7a 100644
> --- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
> +++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
> @@ -80,25 +80,20 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
>  			(fd_pipe2depth(format) != (enum adreno_rb_depth_format)~0) &&
>  			(fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
>  		retval |= PIPE_BIND_DEPTH_STENCIL;
>  	}
>  
>  	if ((usage & PIPE_BIND_INDEX_BUFFER) &&
>  			(fd_pipe2index(format) != (enum pc_di_index_size)~0)) {
>  		retval |= PIPE_BIND_INDEX_BUFFER;
>  	}
>  
> -	if (usage & PIPE_BIND_TRANSFER_READ)
> -		retval |= PIPE_BIND_TRANSFER_READ;
> -	if (usage & PIPE_BIND_TRANSFER_WRITE)
> -		retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  	if (retval != usage) {
>  		DBG("not supported: format=%s, target=%d, sample_count=%d, "
>  				"usage=%x, retval=%x", util_format_name(format),
>  				target, sample_count, usage, retval);
>  	}
>  
>  	return retval == usage;
>  }
>  
>  void
> diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
> index aa60658..6006bb9 100644
> --- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
> +++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
> @@ -79,25 +79,20 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
>  			(fd4_pipe2depth(format) != (enum a4xx_depth_format)~0) &&
>  			(fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
>  		retval |= PIPE_BIND_DEPTH_STENCIL;
>  	}
>  
>  	if ((usage & PIPE_BIND_INDEX_BUFFER) &&
>  			(fd_pipe2index(format) != (enum pc_di_index_size)~0)) {
>  		retval |= PIPE_BIND_INDEX_BUFFER;
>  	}
>  
> -	if (usage & PIPE_BIND_TRANSFER_READ)
> -		retval |= PIPE_BIND_TRANSFER_READ;
> -	if (usage & PIPE_BIND_TRANSFER_WRITE)
> -		retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  	if (retval != usage) {
>  		DBG("not supported: format=%s, target=%d, sample_count=%d, "
>  				"usage=%x, retval=%x", util_format_name(format),
>  				target, sample_count, usage, retval);
>  	}
>  
>  	return retval == usage;
>  }
>  
>  void
> diff --git a/src/gallium/drivers/ilo/ilo_resource.c b/src/gallium/drivers/ilo/ilo_resource.c
> index 7961288..5ca7e1b 100644
> --- a/src/gallium/drivers/ilo/ilo_resource.c
> +++ b/src/gallium/drivers/ilo/ilo_resource.c
> @@ -197,21 +197,21 @@ resource_get_image_info(const struct pipe_resource *templ,
>     info->aux_disable = (templ->usage == PIPE_USAGE_STAGING);
>  
>     if (templ->bind & PIPE_BIND_LINEAR)
>        info->valid_tilings = 1 << GEN6_TILING_NONE;
>  
>     /*
>      * Tiled images must be mapped via GTT to get a linear view.  Prefer linear
>      * images when the image size is greater than one-fourth of the mappable
>      * aperture.
>      */
> -   if (templ->bind & (PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_TRANSFER_READ))
> +   if (templ->usage == PIPE_USAGE_STAGING)
>        info->prefer_linear_threshold = dev->aperture_mappable / 4;
>  
>     info->bind_surface_sampler = (templ->bind & PIPE_BIND_SAMPLER_VIEW);
>     info->bind_surface_dp_render = (templ->bind & PIPE_BIND_RENDER_TARGET);
>     info->bind_surface_dp_typed = (templ->bind &
>           (PIPE_BIND_SHADER_IMAGE | PIPE_BIND_COMPUTE_RESOURCE));
>     info->bind_zs = (templ->bind & PIPE_BIND_DEPTH_STENCIL);
>     info->bind_scanout = (templ->bind & PIPE_BIND_SCANOUT);
>     info->bind_cursor = (templ->bind & PIPE_BIND_CURSOR);
>  }
> diff --git a/src/gallium/drivers/ilo/ilo_transfer.c b/src/gallium/drivers/ilo/ilo_transfer.c
> index 87607eb..c0dab31 100644
> --- a/src/gallium/drivers/ilo/ilo_transfer.c
> +++ b/src/gallium/drivers/ilo/ilo_transfer.c
> @@ -173,21 +173,20 @@ xfer_alloc_staging_res(struct ilo_transfer *xfer)
>        /* use 2D array for any texture target */
>        templ.target = PIPE_TEXTURE_2D_ARRAY;
>        templ.width0 = box->width;
>     }
>  
>     templ.height0 = box->height;
>     templ.depth0 = 1;
>     templ.array_size = box->depth;
>     templ.nr_samples = 1;
>     templ.usage = PIPE_USAGE_STAGING;
> -   templ.bind = PIPE_BIND_TRANSFER_WRITE;
>  
>     if (xfer->base.usage & PIPE_TRANSFER_FLUSH_EXPLICIT) {
>        templ.flags = PIPE_RESOURCE_FLAG_MAP_PERSISTENT |
>                      PIPE_RESOURCE_FLAG_MAP_COHERENT;
>     }
>  
>     xfer->staging.res = res->screen->resource_create(res->screen, &templ);
>  
>     if (xfer->staging.res && xfer->staging.res->target != PIPE_BUFFER) {
>        assert(ilo_texture(xfer->staging.res)->image.tiling ==
> @@ -1104,21 +1103,21 @@ buf_pwrite(struct ilo_context *ilo, struct pipe_resource *res,
>        else {
>           struct pipe_resource templ, *staging;
>  
>           /*
>            * allocate a staging buffer to hold the data and pipelined copy it
>            * over
>            */
>           templ = *res;
>           templ.width0 = size;
>           templ.usage = PIPE_USAGE_STAGING;
> -         templ.bind = PIPE_BIND_TRANSFER_WRITE;
> +         templ.bind = 0;
>           staging = ilo->base.screen->resource_create(ilo->base.screen, &templ);
>           if (staging) {
>              const struct ilo_vma *staging_vma = ilo_resource_get_vma(staging);
>              struct pipe_box staging_box;
>  
>              /* offset by staging_vma->bo_offset for pwrite */
>              intel_bo_pwrite(staging_vma->bo, staging_vma->bo_offset,
>                    size, data);
>  
>              u_box_1d(0, size, &staging_box);
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index ed74c3a..2ced8f1 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -367,24 +367,22 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen,
>     if (sample_count > nv30_screen(pscreen)->max_sample_count)
>        return false;
>  
>     if (!(0x00000017 & (1 << sample_count)))
>        return false;
>  
>     if (!util_format_is_supported(format, bindings)) {
>        return false;
>     }
>  
> -   /* transfers & shared are always supported */
> -   bindings &= ~(PIPE_BIND_TRANSFER_READ |
> -                 PIPE_BIND_TRANSFER_WRITE |
> -                 PIPE_BIND_SHARED);
> +   /* shared is always supported */
> +   bindings &= ~PIPE_BIND_SHARED;
>  
>     return (nv30_format_info(pscreen, format)->bindings & bindings) == bindings;
>  }
>  
>  static void
>  nv30_screen_fence_emit(struct pipe_screen *pscreen, uint32_t *sequence)
>  {
>     struct nv30_screen *screen = nv30_screen(pscreen);
>     struct nouveau_pushbuf *push = screen->base.pushbuf;
>  
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 57c0c2b..1ec791d 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -68,24 +68,22 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
>     }
>  
>     if (bindings & PIPE_BIND_LINEAR)
>        if (util_format_is_depth_or_stencil(format) ||
>            (target != PIPE_TEXTURE_1D &&
>             target != PIPE_TEXTURE_2D &&
>             target != PIPE_TEXTURE_RECT) ||
>            sample_count > 1)
>           return false;
>  
> -   /* transfers & shared are always supported */
> -   bindings &= ~(PIPE_BIND_TRANSFER_READ |
> -                 PIPE_BIND_TRANSFER_WRITE |
> -                 PIPE_BIND_LINEAR |
> +   /* shared is always supported */
> +   bindings &= ~(PIPE_BIND_LINEAR |
>                   PIPE_BIND_SHARED);
>  
>     return (( nv50_format_table[format].usage |
>              nv50_vertex_format[format].usage) & bindings) == bindings;
>  }
>  
>  static int
>  nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>  {
>     const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 0627f3d..77b38b5 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -78,23 +78,21 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
>     if ((desc->layout == UTIL_FORMAT_LAYOUT_ETC ||
>          desc->layout == UTIL_FORMAT_LAYOUT_ASTC) &&
>         /* The claim is that this should work on GM107 but it doesn't. Need to
>          * test further and figure out if it's a nouveau issue or a HW one.
>         nouveau_screen(pscreen)->class_3d < GM107_3D_CLASS &&
>          */
>         nouveau_screen(pscreen)->class_3d != NVEA_3D_CLASS)
>        return false;
>  
>     /* transfers & shared are always supported */
> -   bindings &= ~(PIPE_BIND_TRANSFER_READ |
> -                 PIPE_BIND_TRANSFER_WRITE |
> -                 PIPE_BIND_LINEAR |
> +   bindings &= ~(PIPE_BIND_LINEAR |
>                   PIPE_BIND_SHARED);
>  
>     if (bindings & PIPE_BIND_SHADER_IMAGE && sample_count > 1 &&
>         nouveau_screen(pscreen)->class_3d >= GM107_3D_CLASS) {
>        /* MS images are currently unsupported on Maxwell because they have to
>         * be handled explicitly. */
>        return false;
>     }
>  
>     return (( nvc0_format_table[format].usage |
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 509feae..f6949ce 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -657,26 +657,20 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
>                  retval |= PIPE_BIND_VERTEX_BUFFER;
>              }
>          } else {
>              /* SW TCL */
>              if (!util_format_is_pure_integer(format)) {
>                  retval |= PIPE_BIND_VERTEX_BUFFER;
>              }
>          }
>      }
>  
> -    /* Transfers are always supported. */
> -    if (usage & PIPE_BIND_TRANSFER_READ)
> -        retval |= PIPE_BIND_TRANSFER_READ;
> -    if (usage & PIPE_BIND_TRANSFER_WRITE)
> -        retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>      return retval == usage;
>  }
>  
>  static void r300_destroy_screen(struct pipe_screen* pscreen)
>  {
>      struct r300_screen* r300screen = r300_screen(pscreen);
>      struct radeon_winsys *rws = radeon_winsys(pscreen);
>  
>      if (rws && !rws->unref(rws))
>        return;
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index ed385ee..d137514 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -287,25 +287,20 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen,
>  	if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
>  	    r600_is_zs_format_supported(format)) {
>  		retval |= PIPE_BIND_DEPTH_STENCIL;
>  	}
>  
>  	if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
>  	    r600_is_vertex_format_supported(format)) {
>  		retval |= PIPE_BIND_VERTEX_BUFFER;
>  	}
>  
> -	if (usage & PIPE_BIND_TRANSFER_READ)
> -		retval |= PIPE_BIND_TRANSFER_READ;
> -	if (usage & PIPE_BIND_TRANSFER_WRITE)
> -		retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  	if ((usage & PIPE_BIND_LINEAR) &&
>  	    !util_format_is_compressed(format) &&
>  	    !(usage & PIPE_BIND_DEPTH_STENCIL))
>  		retval |= PIPE_BIND_LINEAR;
>  
>  	return retval == usage;
>  }
>  
>  static void *evergreen_create_blend_state_mode(struct pipe_context *ctx,
>  					       const struct pipe_blend_state *state, int mode)
> diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
> index c55c532..2b58d98 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -228,25 +228,20 @@ boolean r600_is_format_supported(struct pipe_screen *screen,
>  	if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
>  	    r600_is_zs_format_supported(format)) {
>  		retval |= PIPE_BIND_DEPTH_STENCIL;
>  	}
>  
>  	if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
>  	    r600_is_vertex_format_supported(format)) {
>  		retval |= PIPE_BIND_VERTEX_BUFFER;
>  	}
>  
> -	if (usage & PIPE_BIND_TRANSFER_READ)
> -		retval |= PIPE_BIND_TRANSFER_READ;
> -	if (usage & PIPE_BIND_TRANSFER_WRITE)
> -		retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  	if ((usage & PIPE_BIND_LINEAR) &&
>  	    !util_format_is_compressed(format) &&
>  	    !(usage & PIPE_BIND_DEPTH_STENCIL))
>  		retval |= PIPE_BIND_LINEAR;
>  
>  	return retval == usage;
>  }
>  
>  static void r600_emit_polygon_offset(struct r600_context *rctx, struct r600_atom *a)
>  {
> diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
> index a600793..2e8b6f4 100644
> --- a/src/gallium/drivers/radeon/r600_buffer_common.c
> +++ b/src/gallium/drivers/radeon/r600_buffer_common.c
> @@ -379,21 +379,21 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
>  	}
>  	/* Using a staging buffer in GTT for larger reads is much faster. */
>  	else if ((usage & PIPE_TRANSFER_READ) &&
>  		 !(usage & (PIPE_TRANSFER_WRITE |
>  			    PIPE_TRANSFER_PERSISTENT)) &&
>  		 rbuffer->domains & RADEON_DOMAIN_VRAM &&
>  		 r600_can_dma_copy_buffer(rctx, 0, box->x, box->width)) {
>  		struct r600_resource *staging;
>  
>  		staging = (struct r600_resource*) pipe_buffer_create(
> -				ctx->screen, PIPE_BIND_TRANSFER_READ, PIPE_USAGE_STAGING,
> +				ctx->screen, 0, PIPE_USAGE_STAGING,
>  				box->width + (box->x % R600_MAP_BUFFER_ALIGNMENT));
>  		if (staging) {
>  			/* Copy the VRAM buffer to the staging buffer. */
>  			ctx->resource_copy_region(ctx, &staging->b.b, 0,
>  						  box->x % R600_MAP_BUFFER_ALIGNMENT,
>  						  0, 0, resource, level, box);
>  
>  			data = r600_buffer_map_sync_with_rings(rctx, staging, PIPE_TRANSFER_READ);
>  			if (!data) {
>  				r600_resource_reference(&staging, NULL);
> diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
> index 280a9f8..0d3de9a 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -1849,25 +1849,20 @@ static boolean si_is_format_supported(struct pipe_screen *screen,
>  	if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
>  	    si_is_zs_format_supported(format)) {
>  		retval |= PIPE_BIND_DEPTH_STENCIL;
>  	}
>  
>  	if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
>  	    si_is_vertex_format_supported(screen, format)) {
>  		retval |= PIPE_BIND_VERTEX_BUFFER;
>  	}
>  
> -	if (usage & PIPE_BIND_TRANSFER_READ)
> -		retval |= PIPE_BIND_TRANSFER_READ;
> -	if (usage & PIPE_BIND_TRANSFER_WRITE)
> -		retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  	if ((usage & PIPE_BIND_LINEAR) &&
>  	    !util_format_is_compressed(format) &&
>  	    !(usage & PIPE_BIND_DEPTH_STENCIL))
>  		retval |= PIPE_BIND_LINEAR;
>  
>  	return retval == usage;
>  }
>  
>  /*
>   * framebuffer handling
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index 652d9b4..3dc85d5 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -487,25 +487,20 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
>               format == PIPE_FORMAT_X8Z24_UNORM)) {
>                  retval |= PIPE_BIND_DEPTH_STENCIL;
>          }
>  
>          if ((usage & PIPE_BIND_INDEX_BUFFER) &&
>              (format == PIPE_FORMAT_I8_UINT ||
>               format == PIPE_FORMAT_I16_UINT)) {
>                  retval |= PIPE_BIND_INDEX_BUFFER;
>          }
>  
> -        if (usage & PIPE_BIND_TRANSFER_READ)
> -                retval |= PIPE_BIND_TRANSFER_READ;
> -        if (usage & PIPE_BIND_TRANSFER_WRITE)
> -                retval |= PIPE_BIND_TRANSFER_WRITE;
> -
>  #if 0
>          if (retval != usage) {
>                  fprintf(stderr,
>                          "not supported: format=%s, target=%d, sample_count=%d, "
>                          "usage=0x%x, retval=0x%x\n", util_format_name(format),
>                          target, sample_count, usage, retval);
>          }
>  #endif
>  
>          return retval == usage;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 5361ed6..88aa050 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -403,22 +403,21 @@ enum pipe_flush_flags
>   * the ways a resource might be used.
>   */
>  #define PIPE_BIND_DEPTH_STENCIL        (1 << 0) /* create_surface */
>  #define PIPE_BIND_RENDER_TARGET        (1 << 1) /* create_surface */
>  #define PIPE_BIND_BLENDABLE            (1 << 2) /* create_surface */
>  #define PIPE_BIND_SAMPLER_VIEW         (1 << 3) /* create_sampler_view */
>  #define PIPE_BIND_VERTEX_BUFFER        (1 << 4) /* set_vertex_buffers */
>  #define PIPE_BIND_INDEX_BUFFER         (1 << 5) /* draw_elements */
>  #define PIPE_BIND_CONSTANT_BUFFER      (1 << 6) /* set_constant_buffer */
>  #define PIPE_BIND_DISPLAY_TARGET       (1 << 7) /* flush_front_buffer */
> -#define PIPE_BIND_TRANSFER_WRITE       (1 << 8) /* transfer_map */
> -#define PIPE_BIND_TRANSFER_READ        (1 << 9) /* transfer_map */
> +/* gap */
>  #define PIPE_BIND_STREAM_OUTPUT        (1 << 10) /* set_stream_output_buffers */
>  #define PIPE_BIND_CURSOR               (1 << 11) /* mouse cursor */
>  #define PIPE_BIND_CUSTOM               (1 << 12) /* state-tracker/winsys usages */
>  #define PIPE_BIND_GLOBAL               (1 << 13) /* set_global_binding */
>  #define PIPE_BIND_SHADER_BUFFER        (1 << 14) /* set_shader_buffers */
>  #define PIPE_BIND_SHADER_IMAGE         (1 << 15) /* set_shader_images */
>  #define PIPE_BIND_COMPUTE_RESOURCE     (1 << 16) /* set_compute_resources */
>  #define PIPE_BIND_COMMAND_ARGS_BUFFER  (1 << 17) /* pipe_draw_info.indirect */
>  #define PIPE_BIND_QUERY_BUFFER         (1 << 18) /* get_query_result_resource */
>  
> diff --git a/src/gallium/state_trackers/clover/core/format.cpp b/src/gallium/state_trackers/clover/core/format.cpp
> index aee1cc9..5701292 100644
> --- a/src/gallium/state_trackers/clover/core/format.cpp
> +++ b/src/gallium/state_trackers/clover/core/format.cpp
> @@ -140,23 +140,21 @@ namespace clover {
>           throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED);
>  
>        return it->second;
>     }
>  
>     std::set<cl_image_format>
>     supported_formats(const context &ctx, cl_mem_object_type type) {
>        std::set<cl_image_format> s;
>        pipe_texture_target target = translate_target(type);
>        unsigned bindings = (PIPE_BIND_SAMPLER_VIEW |
> -                           PIPE_BIND_COMPUTE_RESOURCE |
> -                           PIPE_BIND_TRANSFER_READ |
> -                           PIPE_BIND_TRANSFER_WRITE);
> +                           PIPE_BIND_COMPUTE_RESOURCE);
>  
>        for (auto f : formats) {
>           if (all_of([=](const device &dev) {
>                    return dev.pipe->is_format_supported(
>                       dev.pipe, f.second, target, 1, bindings);
>                 }, ctx.devices()))
>              s.insert(f.first);
>        }
>  
>        return s;
> diff --git a/src/gallium/state_trackers/clover/core/resource.cpp b/src/gallium/state_trackers/clover/core/resource.cpp
> index 83781d3..06fd3f6 100644
> --- a/src/gallium/state_trackers/clover/core/resource.cpp
> +++ b/src/gallium/state_trackers/clover/core/resource.cpp
> @@ -129,23 +129,21 @@ root_resource::root_resource(clover::device &dev, memory_obj &obj,
>     } else {
>        info.width0 = obj.size();
>        info.height0 = 1;
>        info.depth0 = 1;
>     }
>  
>     info.array_size = 1;
>     info.target = translate_target(obj.type());
>     info.bind = (PIPE_BIND_SAMPLER_VIEW |
>                  PIPE_BIND_COMPUTE_RESOURCE |
> -                PIPE_BIND_GLOBAL |
> -                PIPE_BIND_TRANSFER_READ |
> -                PIPE_BIND_TRANSFER_WRITE);
> +                PIPE_BIND_GLOBAL);
>  
>     if (obj.flags() & CL_MEM_USE_HOST_PTR && user_ptr_support) {
>        // Page alignment is normally required for this, just try, hope for the
>        // best and fall back if it fails.
>        pipe = dev.pipe->resource_from_user_memory(dev.pipe, &info, obj.host_ptr());
>        if (pipe)
>           return;
>     }
>  
>     if (obj.flags() & (CL_MEM_ALLOC_HOST_PTR | CL_MEM_USE_HOST_PTR)) {
> diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
> index 41140d4..acf205d 100644
> --- a/src/gallium/state_trackers/nine/adapter9.c
> +++ b/src/gallium/state_trackers/nine/adapter9.c
> @@ -381,22 +381,21 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
>          d3dformat_to_string(SurfaceFormat), Windowed, MultiSampleType,
>          pQualityLevels);
>  
>      hr = NineAdapter9_GetScreen(This, DeviceType, &screen);
>      if (FAILED(hr))
>          return hr;
>  
>      if (depth_stencil_format(SurfaceFormat))
>          bind = d3d9_get_pipe_depth_format_bindings(SurfaceFormat);
>      else /* render-target */
> -        bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ |
> -               PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;
> +        bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
>  
>      pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D,
>                                       MultiSampleType, bind, FALSE, FALSE);
>  
>      if (pf == PIPE_FORMAT_NONE) {
>          DBG("%s with %u samples not available.\n",
>              d3dformat_to_string(SurfaceFormat), MultiSampleType);
>          return D3DERR_NOTAVAILABLE;
>      }
>  
> diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c
> index 387fc29..236a3ee 100644
> --- a/src/gallium/state_trackers/nine/buffer9.c
> +++ b/src/gallium/state_trackers/nine/buffer9.c
> @@ -60,21 +60,21 @@ NineBuffer9_ctor( struct NineBuffer9 *This,
>      This->pipe = pParams->device->pipe;
>  
>      info->screen = pParams->device->screen;
>      info->target = PIPE_BUFFER;
>      info->format = PIPE_FORMAT_R8_UNORM;
>      info->width0 = Size;
>      info->flags = 0;
>  
>      /* Note: WRITEONLY is just tip for resource placement, the resource
>       * can still be read (but slower). */
> -    info->bind = PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_TRANSFER_READ;
> +    info->bind = PIPE_BIND_VERTEX_BUFFER;
>  
>      /* It is hard to find clear information on where to place the buffer in
>       * memory depending on the flag.
>       * MSDN: resources are static, except for those with DYNAMIC, thus why you
>       *   can only use DISCARD on them.
>       * ATI doc: The driver has the liberty it wants for having things static
>       *   or not.
>       *   MANAGED: Ram + uploads to Vram copy at unlock (msdn and nvidia doc say
>       *   at first draw call using the buffer)
>       *   DEFAULT + Usage = 0 => System memory backing for easy read access
> diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c
> index 1100094..dd1a430 100644
> --- a/src/gallium/state_trackers/nine/cubetexture9.c
> +++ b/src/gallium/state_trackers/nine/cubetexture9.c
> @@ -94,23 +94,20 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
>      info->usage = PIPE_USAGE_DEFAULT;
>      info->flags = 0;
>  
>      if (Usage & D3DUSAGE_RENDERTARGET)
>          info->bind |= PIPE_BIND_RENDER_TARGET;
>      if (Usage & D3DUSAGE_DEPTHSTENCIL)
>          info->bind |= PIPE_BIND_DEPTH_STENCIL;
>  
>      if (Usage & D3DUSAGE_DYNAMIC) {
>          info->usage = PIPE_USAGE_DYNAMIC;
> -        info->bind |=
> -            PIPE_BIND_TRANSFER_READ |
> -            PIPE_BIND_TRANSFER_WRITE;
>      }
>      if (Usage & D3DUSAGE_SOFTWAREPROCESSING)
>          DBG("Application asked for Software Vertex Processing, "
>              "but this is unimplemented\n");
>  
>      if (Pool != D3DPOOL_DEFAULT) {
>          level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1));
>          face_size = nine_format_get_size_and_offsets(pf, level_offsets,
>                                                       EdgeLength, EdgeLength,
>                                                       info->last_level);
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index 3f6577c..230ad02 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -247,21 +247,21 @@ NineDevice9_ctor( struct NineDevice9 *This,
>  
>          tmpl.target = PIPE_BUFFER;
>          tmpl.format = PIPE_FORMAT_R8_UNORM;
>          tmpl.width0 = 16; /* 4 floats */
>          tmpl.height0 = 1;
>          tmpl.depth0 = 1;
>          tmpl.array_size = 1;
>          tmpl.last_level = 0;
>          tmpl.nr_samples = 0;
>          tmpl.usage = PIPE_USAGE_DEFAULT;
> -        tmpl.bind = PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_TRANSFER_WRITE;
> +        tmpl.bind = PIPE_BIND_VERTEX_BUFFER;
>          tmpl.flags = 0;
>          This->dummy_vbo = pScreen->resource_create(pScreen, &tmpl);
>  
>          if (!This->dummy_vbo)
>              return D3DERR_OUTOFVIDEOMEMORY;
>  
>          u_box_1d(0, 16, &box);
>          data = This->pipe->transfer_map(This->pipe, This->dummy_vbo, 0,
>                                          PIPE_TRANSFER_WRITE |
>                                          PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
> diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h
> index fe8e910..93e3225 100644
> --- a/src/gallium/state_trackers/nine/nine_pipe.h
> +++ b/src/gallium/state_trackers/nine/nine_pipe.h
> @@ -232,22 +232,21 @@ d3d9_get_pipe_depth_format_bindings(D3DFORMAT format)
>      case D3DFMT_D15S1:
>      case D3DFMT_D24S8:
>      case D3DFMT_D24X8:
>      case D3DFMT_D24X4S4:
>      case D3DFMT_D16:
>      case D3DFMT_D24FS8:
>          return PIPE_BIND_DEPTH_STENCIL;
>      case D3DFMT_D32F_LOCKABLE:
>      case D3DFMT_D16_LOCKABLE:
>      case D3DFMT_D32_LOCKABLE:
> -        return PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_TRANSFER_READ |
> -               PIPE_BIND_TRANSFER_WRITE;
> +        return PIPE_BIND_DEPTH_STENCIL;
>      case D3DFMT_DF16:
>      case D3DFMT_DF24:
>      case D3DFMT_INTZ:
>          return PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SAMPLER_VIEW;
>      default: unreachable("Unexpected format");
>      }
>  }
>  
>  static inline enum pipe_format
>  d3d9_to_pipe_format_internal(D3DFORMAT format)
> diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
> index bc1c4b1..79fba28 100644
> --- a/src/gallium/state_trackers/nine/swapchain9.c
> +++ b/src/gallium/state_trackers/nine/swapchain9.c
> @@ -294,22 +294,21 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
>      if (has_present_buffers &&
>          (newBufferCount != oldBufferCount || !This->present_buffers)) {
>          This->present_buffers = REALLOC(This->present_buffers,
>                                          This->present_buffers == NULL ? 0 :
>                                          oldBufferCount * sizeof(struct pipe_resource *),
>                                          newBufferCount * sizeof(struct pipe_resource *));
>          memset(This->present_buffers, 0, newBufferCount * sizeof(struct pipe_resource *));
>      }
>  
>      for (i = 0; i < newBufferCount; ++i) {
> -        tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ |
> -                     PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;
> +        tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
>          tmplt.nr_samples = pParams->MultiSampleType;
>          if (!has_present_buffers)
>              tmplt.bind |= PIPE_BIND_SHARED | PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET;
>          tmplt.format = d3d9_to_pipe_format_checked(This->screen,
>                                                     pParams->BackBufferFormat,
>                                                     PIPE_TEXTURE_2D,
>                                                     tmplt.nr_samples,
>                                                     tmplt.bind, FALSE, FALSE);
>          if (tmplt.format == PIPE_FORMAT_NONE)
>              return D3DERR_INVALIDCALL;
> @@ -540,22 +539,21 @@ create_present_buffer( struct NineSwapChain9 *This,
>  
>      tmplt.target = PIPE_TEXTURE_2D;
>      tmplt.width0 = width;
>      tmplt.height0 = height;
>      tmplt.depth0 = 1;
>      tmplt.last_level = 0;
>      tmplt.array_size = 1;
>      tmplt.usage = PIPE_USAGE_DEFAULT;
>      tmplt.flags = 0;
>      tmplt.format = PIPE_FORMAT_B8G8R8X8_UNORM;
> -    tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ |
> -                 PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET |
> +    tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET |
>                   PIPE_BIND_SHARED | PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET;
>      tmplt.nr_samples = 0;
>      if (This->actx->linear_framebuffer)
>          tmplt.bind |= PIPE_BIND_LINEAR;
>      *resource = This->screen->resource_create(This->screen, &tmplt);
>  
>      *present_handle = D3DWindowBuffer_create(This, *resource, 24, true);
>  }
>  
>  static void
> diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
> index 9bc8610..875620e 100644
> --- a/src/gallium/state_trackers/nine/texture9.c
> +++ b/src/gallium/state_trackers/nine/texture9.c
> @@ -135,23 +135,20 @@ NineTexture9_ctor( struct NineTexture9 *This,
>      info->usage = PIPE_USAGE_DEFAULT;
>      info->flags = 0;
>  
>      if (Usage & D3DUSAGE_RENDERTARGET)
>          info->bind |= PIPE_BIND_RENDER_TARGET;
>      if (Usage & D3DUSAGE_DEPTHSTENCIL)
>          info->bind |= PIPE_BIND_DEPTH_STENCIL;
>  
>      if (Usage & D3DUSAGE_DYNAMIC) {
>          info->usage = PIPE_USAGE_DYNAMIC;
> -        info->bind |=
> -            PIPE_BIND_TRANSFER_READ |
> -            PIPE_BIND_TRANSFER_WRITE;
>      }
>  
>      if (Usage & D3DUSAGE_SOFTWAREPROCESSING)
>          DBG("Application asked for Software Vertex Processing, "
>              "but this is unimplemented\n");
>  
>      if (pSharedHandle && *pSharedHandle) { /* Pool == D3DPOOL_SYSTEMMEM */
>          user_buffer = (void *)*pSharedHandle;
>          level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1));
>          (void) nine_format_get_size_and_offsets(pf, level_offsets,
> diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c
> index e70f3c1..e5db6fc 100644
> --- a/src/gallium/state_trackers/nine/volumetexture9.c
> +++ b/src/gallium/state_trackers/nine/volumetexture9.c
> @@ -87,23 +87,20 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
>      else
>          info->last_level = util_logbase2(MAX2(MAX2(Width, Height), Depth));
>      info->array_size = 1;
>      info->nr_samples = 0;
>      info->bind = PIPE_BIND_SAMPLER_VIEW;
>      info->usage = PIPE_USAGE_DEFAULT;
>      info->flags = 0;
>  
>      if (Usage & D3DUSAGE_DYNAMIC) {
>          info->usage = PIPE_USAGE_DYNAMIC;
> -        info->bind |=
> -            PIPE_BIND_TRANSFER_READ |
> -            PIPE_BIND_TRANSFER_WRITE;
>      }
>      if (Usage & D3DUSAGE_SOFTWAREPROCESSING)
>          DBG("Application asked for Software Vertex Processing, "
>              "but this is unimplemented\n");
>  
>      This->volumes = CALLOC(info->last_level + 1, sizeof(*This->volumes));
>      if (!This->volumes)
>          return E_OUTOFMEMORY;
>      This->base.pstype = 3;
>  
> diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
> index 3cfdf78..b79f106 100644
> --- a/src/mesa/state_tracker/st_cb_readpixels.c
> +++ b/src/mesa/state_tracker/st_cb_readpixels.c
> @@ -267,21 +267,20 @@ blit_to_staging(struct st_context *st, struct st_renderbuffer *strb,
>      * Need to check for NPOT texture support. */
>     if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES) &&
>         (!util_is_power_of_two(width) ||
>          !util_is_power_of_two(height)))
>        return NULL;
>  
>     /* create the destination texture */
>     memset(&dst_templ, 0, sizeof(dst_templ));
>     dst_templ.target = PIPE_TEXTURE_2D;
>     dst_templ.format = dst_format;
> -   dst_templ.bind = PIPE_BIND_TRANSFER_READ;
>     if (util_format_is_depth_or_stencil(dst_format))
>        dst_templ.bind |= PIPE_BIND_DEPTH_STENCIL;
>     else
>        dst_templ.bind |= PIPE_BIND_RENDER_TARGET;
>     dst_templ.usage = PIPE_USAGE_STAGING;
>  
>     st_gl_texture_dims_to_pipe_dims(GL_TEXTURE_2D, width, height, 1,
>                                     &dst_templ.width0, &dst_templ.height0,
>                                     &dst_templ.depth0, &dst_templ.array_size);
>  
> @@ -397,21 +396,21 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
>  {
>     struct st_context *st = st_context(ctx);
>     struct gl_renderbuffer *rb =
>           _mesa_get_read_renderbuffer_for_format(ctx, format);
>     struct st_renderbuffer *strb = st_renderbuffer(rb);
>     struct pipe_context *pipe = st->pipe;
>     struct pipe_screen *screen = pipe->screen;
>     struct pipe_resource *src;
>     struct pipe_resource *dst = NULL;
>     enum pipe_format dst_format, src_format;
> -   unsigned bind = PIPE_BIND_TRANSFER_READ;
> +   unsigned bind;
>     struct pipe_transfer *tex_xfer;
>     ubyte *map = NULL;
>     int dst_x, dst_y;
>  
>     /* Validate state (to be sure we have up-to-date framebuffer surfaces)
>      * and flush the bitmap cache prior to reading. */
>     st_validate_state(st, ST_PIPELINE_RENDER);
>     st_flush_bitmap_cache(st);
>  
>     if (!st->prefer_blit_based_texture_transfer) {
> @@ -445,23 +444,23 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
>     src_format = util_format_intensity_to_red(src_format);
>  
>     if (!src_format ||
>         !screen->is_format_supported(screen, src_format, src->target,
>                                      src->nr_samples,
>                                      PIPE_BIND_SAMPLER_VIEW)) {
>        goto fallback;
>     }
>  
>     if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL)
> -      bind |= PIPE_BIND_DEPTH_STENCIL;
> +      bind = PIPE_BIND_DEPTH_STENCIL;
>     else
> -      bind |= PIPE_BIND_RENDER_TARGET;
> +      bind = PIPE_BIND_RENDER_TARGET;
>  
>     /* Choose the destination format by finding the best match
>      * for the format+type combo. */
>     dst_format = st_choose_matching_format(st, bind, format, type,
>                                            pack->SwapBytes);
>     if (dst_format == PIPE_FORMAT_NONE) {
>        goto fallback;
>     }
>  
>     if (st->pbo.download_enabled && _mesa_is_bufferobj(pack->BufferObj)) {
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index 62c2900..fa360b9 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1814,21 +1814,21 @@ st_GetTexSubImage(struct gl_context * ctx,
>     struct st_texture_image *stImage = st_texture_image(texImage);
>     struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
>     struct pipe_resource *src = stObj->pt;
>     struct pipe_resource *dst = NULL;
>     struct pipe_resource dst_templ;
>     enum pipe_format dst_format, src_format;
>     mesa_format mesa_format;
>     GLenum gl_target = texImage->TexObject->Target;
>     enum pipe_texture_target pipe_target;
>     struct pipe_blit_info blit;
> -   unsigned bind = PIPE_BIND_TRANSFER_READ;
> +   unsigned bind;
>     struct pipe_transfer *tex_xfer;
>     ubyte *map = NULL;
>     boolean done = FALSE;
>  
>     assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
>            texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
>  
>     st_flush_bitmap_cache(st);
>  
>     if (!st->prefer_blit_based_texture_transfer &&
> @@ -1878,23 +1878,23 @@ st_GetTexSubImage(struct gl_context * ctx,
>     src_format = util_format_intensity_to_red(src_format);
>  
>     if (!src_format ||
>         !screen->is_format_supported(screen, src_format, src->target,
>                                      src->nr_samples,
>                                      PIPE_BIND_SAMPLER_VIEW)) {
>        goto fallback;
>     }
>  
>     if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL)
> -      bind |= PIPE_BIND_DEPTH_STENCIL;
> +      bind = PIPE_BIND_DEPTH_STENCIL;
>     else
> -      bind |= PIPE_BIND_RENDER_TARGET;
> +      bind = PIPE_BIND_RENDER_TARGET;
>  
>     /* GetTexImage only returns a single face for cubemaps. */
>     if (gl_target == GL_TEXTURE_CUBE_MAP) {
>        gl_target = GL_TEXTURE_2D;
>     }
>     pipe_target = gl_target_to_pipe(gl_target);
>  
>     /* Choose the destination format by finding the best match
>      * for the format+type combo. */
>     dst_format = st_choose_matching_format(st, bind, format, type,
> 



More information about the mesa-dev mailing list