Re: [Mesa-dev] [PATCH 1/2] gallium/radeon: sort DBG shader flags according to pipe_shader_type

2017-08-30 Thread Marek Olšák
On Wed, Aug 30, 2017 at 12:50 PM, Emil Velikov  wrote:
> On 30 August 2017 at 10:38, Marek Olšák  wrote:
>> On Wed, Aug 30, 2017 at 11:19 AM, Emil Velikov  
>> wrote:
>>> Hi Marek,
>>>
>>> There's a couple of subtle changes in the patch. If intentional, could
>>> you mention that in the commit message?
>>>
>>> On 29 August 2017 at 23:25, Marek Olšák  wrote:
>>>
  static void r600_disk_cache_create(struct r600_common_screen *rscreen)
  {
 /* Don't use the cache if shader dumping is enabled. */
 -   if (rscreen->debug_flags &
 -   (DBG_FS | DBG_VS | DBG_TCS | DBG_TES | DBG_GS | DBG_PS | 
 DBG_CS))
 +   if (rscreen->debug_flags & DBG_ALL_SHADERS)
>>> DBG_FS seems to be missing now.
>>
>> DBG_FS is a shader in r600, and r600 doesn't use the shader cache.
>>
> Right, thanks for the corrections.
>
> Am I seeing it correctly, that on r600 cache files will be created
> even though they're unused? Worth avoiding the creation since it's a
> bit misleading/confusing?

Probably. We are thinking about abandoning drivers/radeon and copying
that into r600 and radeonsi to put an end to the code sharing.

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


Re: [Mesa-dev] [PATCH 1/2] gallium/radeon: sort DBG shader flags according to pipe_shader_type

2017-08-30 Thread Emil Velikov
On 30 August 2017 at 10:38, Marek Olšák  wrote:
> On Wed, Aug 30, 2017 at 11:19 AM, Emil Velikov  
> wrote:
>> Hi Marek,
>>
>> There's a couple of subtle changes in the patch. If intentional, could
>> you mention that in the commit message?
>>
>> On 29 August 2017 at 23:25, Marek Olšák  wrote:
>>
>>>  static void r600_disk_cache_create(struct r600_common_screen *rscreen)
>>>  {
>>> /* Don't use the cache if shader dumping is enabled. */
>>> -   if (rscreen->debug_flags &
>>> -   (DBG_FS | DBG_VS | DBG_TCS | DBG_TES | DBG_GS | DBG_PS | 
>>> DBG_CS))
>>> +   if (rscreen->debug_flags & DBG_ALL_SHADERS)
>> DBG_FS seems to be missing now.
>
> DBG_FS is a shader in r600, and r600 doesn't use the shader cache.
>
Right, thanks for the corrections.

Am I seeing it correctly, that on r600 cache files will be created
even though they're unused? Worth avoiding the creation since it's a
bit misleading/confusing?

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


Re: [Mesa-dev] [PATCH 1/2] gallium/radeon: sort DBG shader flags according to pipe_shader_type

2017-08-30 Thread Marek Olšák
On Wed, Aug 30, 2017 at 11:19 AM, Emil Velikov  wrote:
> Hi Marek,
>
> There's a couple of subtle changes in the patch. If intentional, could
> you mention that in the commit message?
>
> On 29 August 2017 at 23:25, Marek Olšák  wrote:
>
>>  static void r600_disk_cache_create(struct r600_common_screen *rscreen)
>>  {
>> /* Don't use the cache if shader dumping is enabled. */
>> -   if (rscreen->debug_flags &
>> -   (DBG_FS | DBG_VS | DBG_TCS | DBG_TES | DBG_GS | DBG_PS | DBG_CS))
>> +   if (rscreen->debug_flags & DBG_ALL_SHADERS)
> DBG_FS seems to be missing now.

DBG_FS is a shader in r600, and r600 doesn't use the shader cache.

>
>
>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> @@ -364,22 +364,21 @@ static struct pipe_context 
>> *si_pipe_create_context(struct pipe_screen *screen,
>
>> -   if (sscreen->b.debug_flags & (DBG_VS | DBG_TCS | DBG_TES | DBG_GS |
>> - DBG_PS | DBG_CS))
>> +   if (sscreen->b.debug_flags & DBG_ALL_SHADERS)
> Considering all the other places have DBG_FS (sort of) shouldn't there
> be one here as well?

This is not the r600 driver.

>
>
>> @@ -1077,21 +1076,21 @@ struct pipe_screen *radeonsi_screen_create(struct 
>> radeon_winsys *ws,
>
>> if (debug_get_bool_option("RADEON_DUMP_SHADERS", false))
>> -   sscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS 
>> | DBG_CS;
>> +   sscreen->b.debug_flags |= DBG_ALL_SHADERS;
> DBG_FS is now missing while TCS and TES are newly added.

This is not the r600 driver. That environment variable is also deprecated.

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


Re: [Mesa-dev] [PATCH 1/2] gallium/radeon: sort DBG shader flags according to pipe_shader_type

2017-08-30 Thread Emil Velikov
Hi Marek,

There's a couple of subtle changes in the patch. If intentional, could
you mention that in the commit message?

On 29 August 2017 at 23:25, Marek Olšák  wrote:

>  static void r600_disk_cache_create(struct r600_common_screen *rscreen)
>  {
> /* Don't use the cache if shader dumping is enabled. */
> -   if (rscreen->debug_flags &
> -   (DBG_FS | DBG_VS | DBG_TCS | DBG_TES | DBG_GS | DBG_PS | DBG_CS))
> +   if (rscreen->debug_flags & DBG_ALL_SHADERS)
DBG_FS seems to be missing now.


> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -364,22 +364,21 @@ static struct pipe_context 
> *si_pipe_create_context(struct pipe_screen *screen,

> -   if (sscreen->b.debug_flags & (DBG_VS | DBG_TCS | DBG_TES | DBG_GS |
> - DBG_PS | DBG_CS))
> +   if (sscreen->b.debug_flags & DBG_ALL_SHADERS)
Considering all the other places have DBG_FS (sort of) shouldn't there
be one here as well?


> @@ -1077,21 +1076,21 @@ struct pipe_screen *radeonsi_screen_create(struct 
> radeon_winsys *ws,

> if (debug_get_bool_option("RADEON_DUMP_SHADERS", false))
> -   sscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | 
> DBG_CS;
> +   sscreen->b.debug_flags |= DBG_ALL_SHADERS;
DBG_FS is now missing while TCS and TES are newly added.

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


Re: [Mesa-dev] [PATCH 1/2] gallium/radeon: sort DBG shader flags according to pipe_shader_type

2017-08-30 Thread Samuel Pitoiset

Reviewed-by: Samuel Pitoiset 

On 08/30/2017 12:25 AM, Marek Olšák wrote:

From: Marek Olšák 

---
  src/gallium/drivers/r600/r600_pipe.c  |  2 +-
  src/gallium/drivers/radeon/r600_pipe_common.c | 20 ++--
  src/gallium/drivers/radeon/r600_pipe_common.h | 25 -
  src/gallium/drivers/radeonsi/si_pipe.c|  5 ++---
  4 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index 023f1b4..9844add 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -659,21 +659,21 @@ struct pipe_screen *r600_screen_create(struct 
radeon_winsys *ws,
if (rscreen->b.info.chip_class >= EVERGREEN) {
rscreen->b.b.is_format_supported = 
evergreen_is_format_supported;
} else {
rscreen->b.b.is_format_supported = r600_is_format_supported;
}
  
  	rscreen->b.debug_flags |= debug_get_flags_option("R600_DEBUG", r600_debug_options, 0);

if (debug_get_bool_option("R600_DEBUG_COMPUTE", FALSE))
rscreen->b.debug_flags |= DBG_COMPUTE;
if (debug_get_bool_option("R600_DUMP_SHADERS", FALSE))
-   rscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | 
DBG_CS | DBG_TCS | DBG_TES;
+   rscreen->b.debug_flags |= DBG_ALL_SHADERS | DBG_FS;
if (!debug_get_bool_option("R600_HYPERZ", TRUE))
rscreen->b.debug_flags |= DBG_NO_HYPERZ;
  
  	if (rscreen->b.family == CHIP_UNKNOWN) {

fprintf(stderr, "r600: Unknown chipset 0x%04X\n", 
rscreen->b.info.pci_id);
FREE(rscreen);
return NULL;
}
  
  	/* Figure out streamout kernel support. */

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 7c12565..6b61901 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -892,22 +892,21 @@ static const char *r600_get_family_name(const struct 
r600_common_screen *rscreen
case CHIP_STONEY: return "AMD STONEY";
case CHIP_VEGA10: return "AMD VEGA10";
case CHIP_RAVEN: return "AMD RAVEN";
default: return "AMD unknown";
}
  }
  
  static void r600_disk_cache_create(struct r600_common_screen *rscreen)

  {
/* Don't use the cache if shader dumping is enabled. */
-   if (rscreen->debug_flags &
-   (DBG_FS | DBG_VS | DBG_TCS | DBG_TES | DBG_GS | DBG_PS | DBG_CS))
+   if (rscreen->debug_flags & DBG_ALL_SHADERS)
return;
  
  	uint32_t mesa_timestamp;

if (disk_cache_get_function_timestamp(r600_disk_cache_create,
  _timestamp)) {
char *timestamp_str;
int res = -1;
if (rscreen->chip_class < SI) {
res = asprintf(_str, "%u",mesa_timestamp);
}
@@ -1528,36 +1527,21 @@ void r600_destroy_common_screen(struct 
r600_common_screen *rscreen)
slab_destroy_parent(>pool_transfers);
  
  	disk_cache_destroy(rscreen->disk_shader_cache);

rscreen->ws->destroy(rscreen->ws);
FREE(rscreen);
  }
  
  bool r600_can_dump_shader(struct r600_common_screen *rscreen,

  unsigned processor)
  {
-   switch (processor) {
-   case PIPE_SHADER_VERTEX:
-   return (rscreen->debug_flags & DBG_VS) != 0;
-   case PIPE_SHADER_TESS_CTRL:
-   return (rscreen->debug_flags & DBG_TCS) != 0;
-   case PIPE_SHADER_TESS_EVAL:
-   return (rscreen->debug_flags & DBG_TES) != 0;
-   case PIPE_SHADER_GEOMETRY:
-   return (rscreen->debug_flags & DBG_GS) != 0;
-   case PIPE_SHADER_FRAGMENT:
-   return (rscreen->debug_flags & DBG_PS) != 0;
-   case PIPE_SHADER_COMPUTE:
-   return (rscreen->debug_flags & DBG_CS) != 0;
-   default:
-   return false;
-   }
+   return rscreen->debug_flags && (1 << processor);
  }
  
  bool r600_extra_shader_checks(struct r600_common_screen *rscreen, unsigned processor)

  {
return (rscreen->debug_flags & DBG_CHECK_IR) ||
   r600_can_dump_shader(rscreen, processor);
  }
  
  void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,

  uint64_t offset, uint64_t size, unsigned value)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 59886ec..b0cd502 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -62,34 +62,33 @@ struct u_log_context;
  #define R600_CONTEXT_START_PIPELINE_STATS (1u << 1)
  #define R600_CONTEXT_STOP_PIPELINE_STATS  (1u << 2)
  #define R600_CONTEXT_PRIVATE_FLAG  

[Mesa-dev] [PATCH 1/2] gallium/radeon: sort DBG shader flags according to pipe_shader_type

2017-08-29 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/r600/r600_pipe.c  |  2 +-
 src/gallium/drivers/radeon/r600_pipe_common.c | 20 ++--
 src/gallium/drivers/radeon/r600_pipe_common.h | 25 -
 src/gallium/drivers/radeonsi/si_pipe.c|  5 ++---
 4 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index 023f1b4..9844add 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -659,21 +659,21 @@ struct pipe_screen *r600_screen_create(struct 
radeon_winsys *ws,
if (rscreen->b.info.chip_class >= EVERGREEN) {
rscreen->b.b.is_format_supported = 
evergreen_is_format_supported;
} else {
rscreen->b.b.is_format_supported = r600_is_format_supported;
}
 
rscreen->b.debug_flags |= debug_get_flags_option("R600_DEBUG", 
r600_debug_options, 0);
if (debug_get_bool_option("R600_DEBUG_COMPUTE", FALSE))
rscreen->b.debug_flags |= DBG_COMPUTE;
if (debug_get_bool_option("R600_DUMP_SHADERS", FALSE))
-   rscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | 
DBG_CS | DBG_TCS | DBG_TES;
+   rscreen->b.debug_flags |= DBG_ALL_SHADERS | DBG_FS;
if (!debug_get_bool_option("R600_HYPERZ", TRUE))
rscreen->b.debug_flags |= DBG_NO_HYPERZ;
 
if (rscreen->b.family == CHIP_UNKNOWN) {
fprintf(stderr, "r600: Unknown chipset 0x%04X\n", 
rscreen->b.info.pci_id);
FREE(rscreen);
return NULL;
}
 
/* Figure out streamout kernel support. */
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 7c12565..6b61901 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -892,22 +892,21 @@ static const char *r600_get_family_name(const struct 
r600_common_screen *rscreen
case CHIP_STONEY: return "AMD STONEY";
case CHIP_VEGA10: return "AMD VEGA10";
case CHIP_RAVEN: return "AMD RAVEN";
default: return "AMD unknown";
}
 }
 
 static void r600_disk_cache_create(struct r600_common_screen *rscreen)
 {
/* Don't use the cache if shader dumping is enabled. */
-   if (rscreen->debug_flags &
-   (DBG_FS | DBG_VS | DBG_TCS | DBG_TES | DBG_GS | DBG_PS | DBG_CS))
+   if (rscreen->debug_flags & DBG_ALL_SHADERS)
return;
 
uint32_t mesa_timestamp;
if (disk_cache_get_function_timestamp(r600_disk_cache_create,
  _timestamp)) {
char *timestamp_str;
int res = -1;
if (rscreen->chip_class < SI) {
res = asprintf(_str, "%u",mesa_timestamp);
}
@@ -1528,36 +1527,21 @@ void r600_destroy_common_screen(struct 
r600_common_screen *rscreen)
slab_destroy_parent(>pool_transfers);
 
disk_cache_destroy(rscreen->disk_shader_cache);
rscreen->ws->destroy(rscreen->ws);
FREE(rscreen);
 }
 
 bool r600_can_dump_shader(struct r600_common_screen *rscreen,
  unsigned processor)
 {
-   switch (processor) {
-   case PIPE_SHADER_VERTEX:
-   return (rscreen->debug_flags & DBG_VS) != 0;
-   case PIPE_SHADER_TESS_CTRL:
-   return (rscreen->debug_flags & DBG_TCS) != 0;
-   case PIPE_SHADER_TESS_EVAL:
-   return (rscreen->debug_flags & DBG_TES) != 0;
-   case PIPE_SHADER_GEOMETRY:
-   return (rscreen->debug_flags & DBG_GS) != 0;
-   case PIPE_SHADER_FRAGMENT:
-   return (rscreen->debug_flags & DBG_PS) != 0;
-   case PIPE_SHADER_COMPUTE:
-   return (rscreen->debug_flags & DBG_CS) != 0;
-   default:
-   return false;
-   }
+   return rscreen->debug_flags && (1 << processor);
 }
 
 bool r600_extra_shader_checks(struct r600_common_screen *rscreen, unsigned 
processor)
 {
return (rscreen->debug_flags & DBG_CHECK_IR) ||
   r600_can_dump_shader(rscreen, processor);
 }
 
 void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct 
pipe_resource *dst,
  uint64_t offset, uint64_t size, unsigned value)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 59886ec..b0cd502 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -62,34 +62,33 @@ struct u_log_context;
 #define R600_CONTEXT_START_PIPELINE_STATS  (1u << 1)
 #define R600_CONTEXT_STOP_PIPELINE_STATS   (1u << 2)
 #define R600_CONTEXT_PRIVATE_FLAG  (1u << 3)
 
 /* special primitive types */
 #define R600_PRIM_RECTANGLE_LIST   PIPE_PRIM_MAX