Re: [Mesa-dev] [PATCH 2/2] st/mesa: Invalidate external textures when (re-)binding

2016-05-26 Thread Philipp Zabel
Am Donnerstag, den 26.05.2016, 10:36 -0400 schrieb Ilia Mirkin:
> On Thu, May 26, 2016 at 10:31 AM, Marek Olšák  wrote:
> > On Wed, May 25, 2016 at 3:34 PM, Philipp Zabel  
> > wrote:
> >> Am Mittwoch, den 25.05.2016, 09:23 -0400 schrieb Ilia Mirkin:
> >>> Iirc invalidate_resource is to allow backend to discard the contents...
> >>
> >> Thanks, I didn't know that. So this would need a new callback then?
> >> Specifically I want to discard a copy in tiled layout that was derived
> >> from a linear external texture previously.
> >
> > FWIW, radeon drivers don't change the tile mode after a texture has
> > been exported. When the texture is exported, the tile mode is set in
> > stone, be it linear or tiled. There is no second copy.
> 
> I think what he's saying is that they have a shadow copy of the
> texture, and need to know when to update the shadow.

Yes, exactly. I'd like to import a linear dma-buf using
EGL_EXT_image_dma_buf_import and GL_OES_EGL_image_external with the
etnaviv gallium driver.

The linear source buffer needs to be transferred into a shadow copy in
tiled layout. The texture samplers can only read from the tiled copy.

After the linear source buffer has been modified, binding the texture
again must trigger a refresh of the tiled copy somehow.

regards
Philipp

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/mesa: Invalidate external textures when (re-)binding

2016-05-26 Thread Marek Olšák
On Thu, May 26, 2016 at 4:36 PM, Ilia Mirkin  wrote:
> On Thu, May 26, 2016 at 10:31 AM, Marek Olšák  wrote:
>> On Wed, May 25, 2016 at 3:34 PM, Philipp Zabel  
>> wrote:
>>> Am Mittwoch, den 25.05.2016, 09:23 -0400 schrieb Ilia Mirkin:
 Iirc invalidate_resource is to allow backend to discard the contents...
>>>
>>> Thanks, I didn't know that. So this would need a new callback then?
>>> Specifically I want to discard a copy in tiled layout that was derived
>>> from a linear external texture previously.
>>
>> FWIW, radeon drivers don't change the tile mode after a texture has
>> been exported. When the texture is exported, the tile mode is set in
>> stone, be it linear or tiled. There is no second copy.
>
> I think what he's saying is that they have a shadow copy of the
> texture, and need to know when to update the shadow.

Is it a tiler-specific thing?

Would pipe->memory_barrier be a good match for this?

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/mesa: Invalidate external textures when (re-)binding

2016-05-26 Thread Ilia Mirkin
On Thu, May 26, 2016 at 10:31 AM, Marek Olšák  wrote:
> On Wed, May 25, 2016 at 3:34 PM, Philipp Zabel  wrote:
>> Am Mittwoch, den 25.05.2016, 09:23 -0400 schrieb Ilia Mirkin:
>>> Iirc invalidate_resource is to allow backend to discard the contents...
>>
>> Thanks, I didn't know that. So this would need a new callback then?
>> Specifically I want to discard a copy in tiled layout that was derived
>> from a linear external texture previously.
>
> FWIW, radeon drivers don't change the tile mode after a texture has
> been exported. When the texture is exported, the tile mode is set in
> stone, be it linear or tiled. There is no second copy.

I think what he's saying is that they have a shadow copy of the
texture, and need to know when to update the shadow.

  -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/mesa: Invalidate external textures when (re-)binding

2016-05-26 Thread Marek Olšák
On Wed, May 25, 2016 at 3:34 PM, Philipp Zabel  wrote:
> Am Mittwoch, den 25.05.2016, 09:23 -0400 schrieb Ilia Mirkin:
>> Iirc invalidate_resource is to allow backend to discard the contents...
>
> Thanks, I didn't know that. So this would need a new callback then?
> Specifically I want to discard a copy in tiled layout that was derived
> from a linear external texture previously.

FWIW, radeon drivers don't change the tile mode after a texture has
been exported. When the texture is exported, the tile mode is set in
stone, be it linear or tiled. There is no second copy.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/mesa: Invalidate external textures when (re-)binding

2016-05-25 Thread Philipp Zabel
Am Mittwoch, den 25.05.2016, 09:23 -0400 schrieb Ilia Mirkin:
> Iirc invalidate_resource is to allow backend to discard the contents...

Thanks, I didn't know that. So this would need a new callback then?
Specifically I want to discard a copy in tiled layout that was derived
from a linear external texture previously.

regards
Philipp

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/mesa: Invalidate external textures when (re-)binding

2016-05-25 Thread Ilia Mirkin
Iirc invalidate_resource is to allow backend to discard the contents...
On May 25, 2016 9:18 AM, "Philipp Zabel"  wrote:

> Use the invalidate_resource pipe callback to invalidate external
> textures when they are (re-)bound. This is needed to comply with the
> requirement from the GL_OES_EGL_image_external extension that a call
> to glBindTexture guarantees that all further sampling will return
> values that correspond to the values in the external texture at or
> after the time that glBindTexture was called.
>
> Signed-off-by: Philipp Zabel 
> ---
>  src/mesa/state_tracker/st_atom_texture.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_atom_texture.c
> b/src/mesa/state_tracker/st_atom_texture.c
> index 4b7ad77..96be2b2 100644
> --- a/src/mesa/state_tracker/st_atom_texture.c
> +++ b/src/mesa/state_tracker/st_atom_texture.c
> @@ -410,6 +410,10 @@ update_single_texture(struct st_context *st,
>}
> }
>
> +   if (texObj->TargetIndex == TEXTURE_EXTERNAL_INDEX &&
> +   st->pipe->invalidate_resource)
> + st->pipe->invalidate_resource(st->pipe, stObj->pt);
> +
> *sampler_view =
>st_get_texture_sampler_view_from_stobj(st, stObj, view_format,
>   glsl_version);
> --
> 2.8.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev