The Gallium changes look good to me. Marek
On Thu, Aug 15, 2013 at 12:47 PM, Axel Davy <axel.d...@ens.fr> wrote: > Signed-off-by: Axel Davy <axel.d...@ens.fr> > --- > include/GL/internal/dri_interface.h | 1 + > src/gallium/drivers/i915/i915_resource.c | 8 ++++++-- > src/gallium/drivers/ilo/ilo_resource.c | 2 +- > src/gallium/drivers/nv50/nv50_miptree.c | 3 +++ > src/gallium/drivers/nvc0/nvc0_miptree.c | 3 +++ > src/gallium/drivers/r300/r300_texture.c | 2 +- > src/gallium/drivers/r600/r600_texture.c | 3 ++- > src/gallium/drivers/radeonsi/r600_texture.c | 2 +- > src/gallium/include/pipe/p_defines.h | 4 ++++ > src/gallium/state_trackers/dri/drm/dri2.c | 2 ++ > src/mesa/drivers/dri/i915/intel_screen.c | 3 +++ > src/mesa/drivers/dri/i965/intel_screen.c | 3 +++ > 12 files changed, 30 insertions(+), 6 deletions(-) > > diff --git a/include/GL/internal/dri_interface.h > b/include/GL/internal/dri_interface.h > index be31bb8..709fece 100644 > --- a/include/GL/internal/dri_interface.h > +++ b/include/GL/internal/dri_interface.h > @@ -968,6 +968,7 @@ struct __DRIdri2ExtensionRec { > #define __DRI_IMAGE_USE_SHARE 0x0001 > #define __DRI_IMAGE_USE_SCANOUT 0x0002 > #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ > +#define __DRI_IMAGE_USE_LINEAR 0x0008 > > > /** > diff --git a/src/gallium/drivers/i915/i915_resource.c > b/src/gallium/drivers/i915/i915_resource.c > index 314ebe9..627ed2b 100644 > --- a/src/gallium/drivers/i915/i915_resource.c > +++ b/src/gallium/drivers/i915/i915_resource.c > @@ -12,8 +12,12 @@ i915_resource_create(struct pipe_screen *screen, > if (template->target == PIPE_BUFFER) > return i915_buffer_create(screen, template); > else > - return i915_texture_create(screen, template, FALSE); > - > + { > + if (!(template->bind & PIPE_BIND_LINEAR)) > + return i915_texture_create(screen, template, FALSE); > + else > + return i915_texture_create(screen, template, TRUE); > + } > } > > static struct pipe_resource * > diff --git a/src/gallium/drivers/ilo/ilo_resource.c > b/src/gallium/drivers/ilo/ilo_resource.c > index 5061f69..7dd3435 100644 > --- a/src/gallium/drivers/ilo/ilo_resource.c > +++ b/src/gallium/drivers/ilo/ilo_resource.c > @@ -473,7 +473,7 @@ tex_layout_init_tiling(struct tex_layout *layout) > * "The cursor surface address must be 4K byte aligned. The cursor > must > * be in linear memory, it cannot be tiled." > */ > - if (unlikely(templ->bind & PIPE_BIND_CURSOR)) > + if (unlikely(templ->bind & (PIPE_BIND_CURSOR | PIPE_BIND_LINEAR))) > valid_tilings &= tile_none; > > /* > diff --git a/src/gallium/drivers/nv50/nv50_miptree.c > b/src/gallium/drivers/nv50/nv50_miptree.c > index 28be768..e44c843 100644 > --- a/src/gallium/drivers/nv50/nv50_miptree.c > +++ b/src/gallium/drivers/nv50/nv50_miptree.c > @@ -326,6 +326,9 @@ nv50_miptree_create(struct pipe_screen *pscreen, > pipe_reference_init(&pt->reference, 1); > pt->screen = pscreen; > > + if (pt->bind & PIPE_BIND_LINEAR) > + pt->flags |= NOUVEAU_RESOURCE_FLAG_LINEAR; > + > bo_config.nv50.memtype = nv50_mt_choose_storage_type(mt, TRUE); > > if (!nv50_miptree_init_ms_mode(mt)) { > diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c > b/src/gallium/drivers/nvc0/nvc0_miptree.c > index 9e57d74..f359207 100644 > --- a/src/gallium/drivers/nvc0/nvc0_miptree.c > +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c > @@ -274,6 +274,9 @@ nvc0_miptree_create(struct pipe_screen *pscreen, > } > } > > + if (pt->bind & PIPE_BIND_LINEAR) > + pt->flags |= NOUVEAU_RESOURCE_FLAG_LINEAR; > + > bo_config.nvc0.memtype = nvc0_mt_choose_storage_type(mt, compressed); > > if (!nvc0_miptree_init_ms_mode(mt)) { > diff --git a/src/gallium/drivers/r300/r300_texture.c > b/src/gallium/drivers/r300/r300_texture.c > index 13e9bc3..b7fb081 100644 > --- a/src/gallium/drivers/r300/r300_texture.c > +++ b/src/gallium/drivers/r300/r300_texture.c > @@ -1079,7 +1079,7 @@ struct pipe_resource *r300_texture_create(struct > pipe_screen *screen, > enum radeon_bo_layout microtile, macrotile; > > if ((base->flags & R300_RESOURCE_FLAG_TRANSFER) || > - (base->bind & PIPE_BIND_SCANOUT)) { > + (base->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_LINEAR))) { > microtile = RADEON_LAYOUT_LINEAR; > macrotile = RADEON_LAYOUT_LINEAR; > } else { > diff --git a/src/gallium/drivers/r600/r600_texture.c > b/src/gallium/drivers/r600/r600_texture.c > index 36cca17..b81a432 100644 > --- a/src/gallium/drivers/r600/r600_texture.c > +++ b/src/gallium/drivers/r600/r600_texture.c > @@ -609,7 +609,8 @@ struct pipe_resource *r600_texture_create(struct > pipe_screen *screen, > * because 422 formats are used for videos, which prefer linear > buffers > * for fast uploads anyway. */ > if (!(templ->flags & R600_RESOURCE_FLAG_TRANSFER) && > - desc->layout != UTIL_FORMAT_LAYOUT_SUBSAMPLED) { > + (desc->layout != UTIL_FORMAT_LAYOUT_SUBSAMPLED) && > + !(templ->bind & PIPE_BIND_LINEAR)) { > if (templ->flags & R600_RESOURCE_FLAG_FORCE_TILING) { > array_mode = V_038000_ARRAY_2D_TILED_THIN1; > } else if (!(templ->bind & PIPE_BIND_SCANOUT) && > diff --git a/src/gallium/drivers/radeonsi/r600_texture.c > b/src/gallium/drivers/radeonsi/r600_texture.c > index 9c0b75b..22f6c66 100644 > --- a/src/gallium/drivers/radeonsi/r600_texture.c > +++ b/src/gallium/drivers/radeonsi/r600_texture.c > @@ -528,7 +528,7 @@ struct pipe_resource *si_texture_create(struct > pipe_screen *screen, > int r; > > if (!(templ->flags & R600_RESOURCE_FLAG_TRANSFER) && > - !(templ->bind & PIPE_BIND_SCANOUT)) { > + !(templ->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_LINEAR))) { > if (util_format_is_compressed(templ->format)) { > array_mode = V_009910_ARRAY_1D_TILED_THIN1; > } else { > diff --git a/src/gallium/include/pipe/p_defines.h > b/src/gallium/include/pipe/p_defines.h > index fb42cdf..63869c9 100644 > --- a/src/gallium/include/pipe/p_defines.h > +++ b/src/gallium/include/pipe/p_defines.h > @@ -330,9 +330,13 @@ enum pipe_flush_flags { > * The shared flag is quite underspecified, but certainly isn't a > * binding flag - it seems more like a message to the winsys to create > * a shareable allocation. > + * > + * The third flag has been added to be able to force textures to be created > + * in linear mode (no tiling). > */ > #define PIPE_BIND_SCANOUT (1 << 14) /* */ > #define PIPE_BIND_SHARED (1 << 15) /* get_texture_handle ??? */ > +#define PIPE_BIND_LINEAR (1 << 21) > > > /* Flags for the driver about resource behaviour: > diff --git a/src/gallium/state_trackers/dri/drm/dri2.c > b/src/gallium/state_trackers/dri/drm/dri2.c > index 1dcc1f7..e4477d6 100644 > --- a/src/gallium/state_trackers/dri/drm/dri2.c > +++ b/src/gallium/state_trackers/dri/drm/dri2.c > @@ -628,6 +628,8 @@ dri2_create_image(__DRIscreen *_screen, > tex_usage |= PIPE_BIND_SCANOUT; > if (use & __DRI_IMAGE_USE_SHARE) > tex_usage |= PIPE_BIND_SHARED; > + if (use & __DRI_IMAGE_USE_LINEAR) > + tex_usage |= PIPE_BIND_LINEAR; > if (use & __DRI_IMAGE_USE_CURSOR) { > if (width != 64 || height != 64) > return NULL; > diff --git a/src/mesa/drivers/dri/i915/intel_screen.c > b/src/mesa/drivers/dri/i915/intel_screen.c > index 30a867e..457bbd1 100644 > --- a/src/mesa/drivers/dri/i915/intel_screen.c > +++ b/src/mesa/drivers/dri/i915/intel_screen.c > @@ -484,6 +484,9 @@ intel_create_image(__DRIscreen *screen, > tiling = I915_TILING_NONE; > } > > + if (use & __DRI_IMAGE_USE_LINEAR) > + tiling = I915_TILING_NONE; > + > image = intel_allocate_image(format, loaderPrivate); > if (image == NULL) > return NULL; > diff --git a/src/mesa/drivers/dri/i965/intel_screen.c > b/src/mesa/drivers/dri/i965/intel_screen.c > index 4ee8602..3056918 100644 > --- a/src/mesa/drivers/dri/i965/intel_screen.c > +++ b/src/mesa/drivers/dri/i965/intel_screen.c > @@ -506,6 +506,9 @@ intel_create_image(__DRIscreen *screen, > tiling = I915_TILING_NONE; > } > > + if (use & __DRI_IMAGE_USE_LINEAR) > + tiling = I915_TILING_NONE; > + > image = intel_allocate_image(format, loaderPrivate); > if (image == NULL) > return NULL; > -- > 1.8.1.2 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev