Re: [Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color

2017-06-14 Thread Marek Olšák
On Wed, Jun 14, 2017 at 11:23 PM, Timothy Arceri  wrote:
>
>
> On 15/06/17 04:10, Marek Olšák wrote:
>>
>> On Wed, Jun 14, 2017 at 7:27 PM, Marek Olšák  wrote:
>>>
>>> On Tue, Jun 13, 2017 at 8:10 AM, Timothy Arceri 
>>> wrote:



 On 13/06/17 04:18, Marek Olšák wrote:
>
>
> From: Marek Olšák 
>
> AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI
> since
> border color swizzling is broken there anyway. The only other user of
> this
> code is nouveau.



 Maybe move this comment into the code as a TODO? I was a little confused
 at
 first as I thought this commit was meant to make the change. With that:
>>>
>>>
>>> I don't understand. What are you confused about?
>>
>>
>> The commit message talks about radeonsi, but this patch is for
>> st/mesa. st/mesa doesn't care which drivers use the codepath.
>
>
> Well how do you intent to stop using this? Why is the commit message for a
> st change talking about radeonsi? I was assuming you wanted to eventually
> remove this code path from all drivers (or at least skip it for some) in
> which case making this a code comment would make sense, otherwise why do you
> even talk about this in the commit message?

You're right. I'll just remove that commit message.

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


Re: [Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color

2017-06-14 Thread Timothy Arceri



On 15/06/17 04:10, Marek Olšák wrote:

On Wed, Jun 14, 2017 at 7:27 PM, Marek Olšák  wrote:

On Tue, Jun 13, 2017 at 8:10 AM, Timothy Arceri  wrote:



On 13/06/17 04:18, Marek Olšák wrote:


From: Marek Olšák 

AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI since
border color swizzling is broken there anyway. The only other user of this
code is nouveau.



Maybe move this comment into the code as a TODO? I was a little confused at
first as I thought this commit was meant to make the change. With that:


I don't understand. What are you confused about?


The commit message talks about radeonsi, but this patch is for
st/mesa. st/mesa doesn't care which drivers use the codepath.


Well how do you intent to stop using this? Why is the commit message for 
a st change talking about radeonsi? I was assuming you wanted to 
eventually remove this code path from all drivers (or at least skip it 
for some) in which case making this a code comment would make sense, 
otherwise why do you even talk about this in the commit message?




Marek


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


Re: [Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color

2017-06-14 Thread Marek Olšák
On Wed, Jun 14, 2017 at 7:27 PM, Marek Olšák  wrote:
> On Tue, Jun 13, 2017 at 8:10 AM, Timothy Arceri  wrote:
>>
>>
>> On 13/06/17 04:18, Marek Olšák wrote:
>>>
>>> From: Marek Olšák 
>>>
>>> AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI since
>>> border color swizzling is broken there anyway. The only other user of this
>>> code is nouveau.
>>
>>
>> Maybe move this comment into the code as a TODO? I was a little confused at
>> first as I thought this commit was meant to make the change. With that:
>
> I don't understand. What are you confused about?

The commit message talks about radeonsi, but this patch is for
st/mesa. st/mesa doesn't care which drivers use the codepath.

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


Re: [Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color

2017-06-14 Thread Marek Olšák
On Tue, Jun 13, 2017 at 8:10 AM, Timothy Arceri  wrote:
>
>
> On 13/06/17 04:18, Marek Olšák wrote:
>>
>> From: Marek Olšák 
>>
>> AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI since
>> border color swizzling is broken there anyway. The only other user of this
>> code is nouveau.
>
>
> Maybe move this comment into the code as a TODO? I was a little confused at
> first as I thought this commit was meant to make the change. With that:

I don't understand. What are you confused about?

Marek

>
> Reviewed-by: Timothy Arceri 
>
>
>> ---
>>   src/mesa/state_tracker/st_atom_sampler.c | 61
>> +---
>>   1 file changed, 33 insertions(+), 28 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_atom_sampler.c
>> b/src/mesa/state_tracker/st_atom_sampler.c
>> index 9e5d940..9695069 100644
>> --- a/src/mesa/state_tracker/st_atom_sampler.c
>> +++ b/src/mesa/state_tracker/st_atom_sampler.c
>> @@ -170,51 +170,56 @@ st_convert_sampler(const struct st_context *st,
>> sampler->max_lod = sampler->min_lod;
>> sampler->min_lod = tmp;
>> assert(sampler->min_lod <= sampler->max_lod);
>>  }
>>/* For non-black borders... */
>>  if (msamp->BorderColor.ui[0] ||
>>  msamp->BorderColor.ui[1] ||
>>  msamp->BorderColor.ui[2] ||
>>  msamp->BorderColor.ui[3]) {
>> -  const struct st_texture_object *stobj =
>> st_texture_object_const(texobj);
>> const GLboolean is_integer = texobj->_IsIntegerFormat;
>> -  const struct pipe_sampler_view *sv = NULL;
>> -  union pipe_color_union border_color;
>> -  GLuint i;
>> -
>> -  /* Just search for the first used view. We can do this because the
>> - swizzle is per-texture, not per context. */
>> -  /* XXX: clean that up to not use the sampler view at all */
>> -  for (i = 0; i < stobj->num_sampler_views; ++i) {
>> - if (stobj->sampler_views[i]) {
>> -sv = stobj->sampler_views[i];
>> -break;
>> - }
>> -  }
>>   -  if (st->apply_texture_swizzle_to_border_color && sv) {
>> - const unsigned char swz[4] =
>> - {
>> -sv->swizzle_r,
>> -sv->swizzle_g,
>> -sv->swizzle_b,
>> -sv->swizzle_a,
>> - };
>> -
>> - st_translate_color(&msamp->BorderColor,
>> -&border_color,
>> -texBaseFormat, is_integer);
>> +  if (st->apply_texture_swizzle_to_border_color) {
>> + const struct st_texture_object *stobj =
>> st_texture_object_const(texobj);
>> + const struct pipe_sampler_view *sv = NULL;
>> +
>> + /* Just search for the first used view. We can do this because
>> the
>> +swizzle is per-texture, not per context. */
>> + /* XXX: clean that up to not use the sampler view at all */
>> + for (unsigned i = 0; i < stobj->num_sampler_views; ++i) {
>> +if (stobj->sampler_views[i]) {
>> +   sv = stobj->sampler_views[i];
>> +   break;
>> +}
>> + }
>>   - util_format_apply_color_swizzle(&sampler->border_color,
>> - &border_color, swz, is_integer);
>> + if (sv) {
>> +union pipe_color_union tmp;
>> +const unsigned char swz[4] =
>> +{
>> +   sv->swizzle_r,
>> +   sv->swizzle_g,
>> +   sv->swizzle_b,
>> +   sv->swizzle_a,
>> +};
>> +
>> +st_translate_color(&msamp->BorderColor, &tmp,
>> +   texBaseFormat, is_integer);
>> +
>> +util_format_apply_color_swizzle(&sampler->border_color,
>> +&tmp, swz, is_integer);
>> + } else {
>> +st_translate_color(&msamp->BorderColor,
>> +   &sampler->border_color,
>> +   texBaseFormat, is_integer);
>> + }
>> } else {
>>st_translate_color(&msamp->BorderColor,
>>   &sampler->border_color,
>>   texBaseFormat, is_integer);
>> }
>>  }
>>sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
>> 0 : (GLuint) msamp->MaxAnisotropy);
>>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color

2017-06-12 Thread Timothy Arceri



On 13/06/17 04:18, Marek Olšák wrote:

From: Marek Olšák 

AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI since
border color swizzling is broken there anyway. The only other user of this
code is nouveau.


Maybe move this comment into the code as a TODO? I was a little confused 
at first as I thought this commit was meant to make the change. With that:


Reviewed-by: Timothy Arceri 


---
  src/mesa/state_tracker/st_atom_sampler.c | 61 +---
  1 file changed, 33 insertions(+), 28 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_sampler.c 
b/src/mesa/state_tracker/st_atom_sampler.c
index 9e5d940..9695069 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -170,51 +170,56 @@ st_convert_sampler(const struct st_context *st,
sampler->max_lod = sampler->min_lod;
sampler->min_lod = tmp;
assert(sampler->min_lod <= sampler->max_lod);
 }
  
 /* For non-black borders... */

 if (msamp->BorderColor.ui[0] ||
 msamp->BorderColor.ui[1] ||
 msamp->BorderColor.ui[2] ||
 msamp->BorderColor.ui[3]) {
-  const struct st_texture_object *stobj = st_texture_object_const(texobj);
const GLboolean is_integer = texobj->_IsIntegerFormat;
-  const struct pipe_sampler_view *sv = NULL;
-  union pipe_color_union border_color;
-  GLuint i;
-
-  /* Just search for the first used view. We can do this because the
- swizzle is per-texture, not per context. */
-  /* XXX: clean that up to not use the sampler view at all */
-  for (i = 0; i < stobj->num_sampler_views; ++i) {
- if (stobj->sampler_views[i]) {
-sv = stobj->sampler_views[i];
-break;
- }
-  }
  
-  if (st->apply_texture_swizzle_to_border_color && sv) {

- const unsigned char swz[4] =
- {
-sv->swizzle_r,
-sv->swizzle_g,
-sv->swizzle_b,
-sv->swizzle_a,
- };
-
- st_translate_color(&msamp->BorderColor,
-&border_color,
-texBaseFormat, is_integer);
+  if (st->apply_texture_swizzle_to_border_color) {
+ const struct st_texture_object *stobj = 
st_texture_object_const(texobj);
+ const struct pipe_sampler_view *sv = NULL;
+
+ /* Just search for the first used view. We can do this because the
+swizzle is per-texture, not per context. */
+ /* XXX: clean that up to not use the sampler view at all */
+ for (unsigned i = 0; i < stobj->num_sampler_views; ++i) {
+if (stobj->sampler_views[i]) {
+   sv = stobj->sampler_views[i];
+   break;
+}
+ }
  
- util_format_apply_color_swizzle(&sampler->border_color,

- &border_color, swz, is_integer);
+ if (sv) {
+union pipe_color_union tmp;
+const unsigned char swz[4] =
+{
+   sv->swizzle_r,
+   sv->swizzle_g,
+   sv->swizzle_b,
+   sv->swizzle_a,
+};
+
+st_translate_color(&msamp->BorderColor, &tmp,
+   texBaseFormat, is_integer);
+
+util_format_apply_color_swizzle(&sampler->border_color,
+&tmp, swz, is_integer);
+ } else {
+st_translate_color(&msamp->BorderColor,
+   &sampler->border_color,
+   texBaseFormat, is_integer);
+ }
} else {
   st_translate_color(&msamp->BorderColor,
  &sampler->border_color,
  texBaseFormat, is_integer);
}
 }
  
 sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?

0 : (GLuint) msamp->MaxAnisotropy);
  


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


[Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color

2017-06-12 Thread Marek Olšák
From: Marek Olšák 

AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI since
border color swizzling is broken there anyway. The only other user of this
code is nouveau.
---
 src/mesa/state_tracker/st_atom_sampler.c | 61 +---
 1 file changed, 33 insertions(+), 28 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_sampler.c 
b/src/mesa/state_tracker/st_atom_sampler.c
index 9e5d940..9695069 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -170,51 +170,56 @@ st_convert_sampler(const struct st_context *st,
   sampler->max_lod = sampler->min_lod;
   sampler->min_lod = tmp;
   assert(sampler->min_lod <= sampler->max_lod);
}
 
/* For non-black borders... */
if (msamp->BorderColor.ui[0] ||
msamp->BorderColor.ui[1] ||
msamp->BorderColor.ui[2] ||
msamp->BorderColor.ui[3]) {
-  const struct st_texture_object *stobj = st_texture_object_const(texobj);
   const GLboolean is_integer = texobj->_IsIntegerFormat;
-  const struct pipe_sampler_view *sv = NULL;
-  union pipe_color_union border_color;
-  GLuint i;
-
-  /* Just search for the first used view. We can do this because the
- swizzle is per-texture, not per context. */
-  /* XXX: clean that up to not use the sampler view at all */
-  for (i = 0; i < stobj->num_sampler_views; ++i) {
- if (stobj->sampler_views[i]) {
-sv = stobj->sampler_views[i];
-break;
- }
-  }
 
-  if (st->apply_texture_swizzle_to_border_color && sv) {
- const unsigned char swz[4] =
- {
-sv->swizzle_r,
-sv->swizzle_g,
-sv->swizzle_b,
-sv->swizzle_a,
- };
-
- st_translate_color(&msamp->BorderColor,
-&border_color,
-texBaseFormat, is_integer);
+  if (st->apply_texture_swizzle_to_border_color) {
+ const struct st_texture_object *stobj = 
st_texture_object_const(texobj);
+ const struct pipe_sampler_view *sv = NULL;
+
+ /* Just search for the first used view. We can do this because the
+swizzle is per-texture, not per context. */
+ /* XXX: clean that up to not use the sampler view at all */
+ for (unsigned i = 0; i < stobj->num_sampler_views; ++i) {
+if (stobj->sampler_views[i]) {
+   sv = stobj->sampler_views[i];
+   break;
+}
+ }
 
- util_format_apply_color_swizzle(&sampler->border_color,
- &border_color, swz, is_integer);
+ if (sv) {
+union pipe_color_union tmp;
+const unsigned char swz[4] =
+{
+   sv->swizzle_r,
+   sv->swizzle_g,
+   sv->swizzle_b,
+   sv->swizzle_a,
+};
+
+st_translate_color(&msamp->BorderColor, &tmp,
+   texBaseFormat, is_integer);
+
+util_format_apply_color_swizzle(&sampler->border_color,
+&tmp, swz, is_integer);
+ } else {
+st_translate_color(&msamp->BorderColor,
+   &sampler->border_color,
+   texBaseFormat, is_integer);
+ }
   } else {
  st_translate_color(&msamp->BorderColor,
 &sampler->border_color,
 texBaseFormat, is_integer);
   }
}
 
sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
   0 : (GLuint) msamp->MaxAnisotropy);
 
-- 
2.7.4

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