[Mesa-dev] [PATCH] Fix R600_DEBUG=vm output (wrong base).

2014-05-07 Thread Darren Salt
Signed-off-by: Darren Salt devs...@moreofthesa.me.uk
---
 src/gallium/drivers/radeon/r600_buffer_common.c | 2 +-
 src/gallium/drivers/radeon/r600_texture.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

This applies to master, 10.1, 10.2, probably older versions.

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 805756f..822bb14 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -157,7 +157,7 @@ bool r600_init_resource(struct r600_common_screen *rscreen,
util_range_set_empty(res-valid_buffer_range);
 
if (rscreen-debug_flags  DBG_VM  res-b.b.target == PIPE_BUFFER) {
-   fprintf(stderr, VM start=0x%PRIu64  end=0x%PRIu64 | Buffer 
%u bytes\n,
+   fprintf(stderr, VM start=0x%PRIx64  end=0x%PRIx64 | Buffer 
%u bytes\n,
r600_resource_va(rscreen-b, res-b.b),
r600_resource_va(rscreen-b, res-b.b) + 
res-buf-size,
res-buf-size);
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index e30d933..f34a5b5 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -666,7 +666,7 @@ r600_texture_create_object(struct pipe_screen *screen,
rtex-cmask.base_address_reg = (va + rtex-cmask.offset)  8;
 
if (rscreen-debug_flags  DBG_VM) {
-   fprintf(stderr, VM start=0x%PRIu64  end=0x%PRIu64 | 
Texture %ix%ix%i, %i levels, %i samples, %s\n,
+   fprintf(stderr, VM start=0x%PRIx64  end=0x%PRIx64 | 
Texture %ix%ix%i, %i levels, %i samples, %s\n,
r600_resource_va(screen, rtex-resource.b.b),
r600_resource_va(screen, rtex-resource.b.b) + 
rtex-resource.buf-size,
base-width0, base-height0, util_max_layer(base, 0)+1, 
base-last_level+1,
-- 
|  _  | Darren Salt, using Debian GNU/Linux (and Android)
| ( ) |
|  X  | ASCII Ribbon campaign against HTML e-mail
| / \ | http://www.asciiribbon.org/
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 13.0.1 release candidate

2016-11-13 Thread Darren Salt
Could you also add commit 9b121512ac0f78d0996613664b456005d88370d2? It's a
correctness fix for radv (ported from anv) which fixes segfaults which I'd
observed in Talos Principle.

-- 
|  _  | Darren Salt, using Debian GNU/Linux (and Android)
| ( ) |
|  X  | ASCII Ribbon campaign against HTML e-mail
| / \ |
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] radv/pipeline: Don't dereference NULL dynamic state pointers

2016-10-16 Thread Darren Salt
This is a port of commit a4a59172482d50318a5ae7f99021bcf0125e0f53:

   Add guards to prevent dereferencing NULL dynamic pipeline state. Asserts
   of pCreateInfo members are moved to the earliest points at which they
   should not be NULL.

This fixes a segfault, related to pColorBlendState, seen in Talos Principle
which I've observed after startup is completed and when exiting the menus,
depending on when Vulkan rendering is selected.

v2: moved the NULL check in radv_pipeline_init_blend_state to after the
declarations.
---
 src/amd/vulkan/radv_pipeline.c | 67 +-
 1 file changed, 47 insertions(+), 20 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index eb64b69..d992a10 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -717,6 +717,10 @@ radv_pipeline_init_blend_state(struct radv_pipeline 
*pipeline,
uint32_t blend_enable = 0, blend_need_alpha = 0;
int i;
bool single_cb_enable = false;
+
+   if (!vkblend)
+   return;
+
if (extra && extra->custom_blend_mode) {
single_cb_enable = true;
mode = extra->custom_blend_mode;
@@ -1069,18 +1073,27 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline 
*pipeline,
 
struct radv_dynamic_state *dynamic = >dynamic_state;
 
-   dynamic->viewport.count = pCreateInfo->pViewportState->viewportCount;
-   if (states & (1 << VK_DYNAMIC_STATE_VIEWPORT)) {
-   typed_memcpy(dynamic->viewport.viewports,
-pCreateInfo->pViewportState->pViewports,
-pCreateInfo->pViewportState->viewportCount);
-   }
+   /* Section 9.2 of the Vulkan 1.0.15 spec says:
+*
+*pViewportState is [...] NULL if the pipeline
+*has rasterization disabled.
+*/
+   if (!pCreateInfo->pRasterizationState->rasterizerDiscardEnable) {
+   assert(pCreateInfo->pViewportState);
+
+   dynamic->viewport.count = 
pCreateInfo->pViewportState->viewportCount;
+   if (states & (1 << VK_DYNAMIC_STATE_VIEWPORT)) {
+   typed_memcpy(dynamic->viewport.viewports,
+pCreateInfo->pViewportState->pViewports,
+
pCreateInfo->pViewportState->viewportCount);
+   }
 
-   dynamic->scissor.count = pCreateInfo->pViewportState->scissorCount;
-   if (states & (1 << VK_DYNAMIC_STATE_SCISSOR)) {
-   typed_memcpy(dynamic->scissor.scissors,
-pCreateInfo->pViewportState->pScissors,
-pCreateInfo->pViewportState->scissorCount);
+   dynamic->scissor.count = 
pCreateInfo->pViewportState->scissorCount;
+   if (states & (1 << VK_DYNAMIC_STATE_SCISSOR)) {
+   typed_memcpy(dynamic->scissor.scissors,
+pCreateInfo->pViewportState->pScissors,
+pCreateInfo->pViewportState->scissorCount);
+   }
}
 
if (states & (1 << VK_DYNAMIC_STATE_LINE_WIDTH)) {
@@ -1098,7 +,21 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline 
*pipeline,
pCreateInfo->pRasterizationState->depthBiasSlopeFactor;
}
 
-   if (states & (1 << VK_DYNAMIC_STATE_BLEND_CONSTANTS)) {
+   /* Section 9.2 of the Vulkan 1.0.15 spec says:
+*
+*pColorBlendState is [...] NULL if the pipeline has rasterization
+*disabled or if the subpass of the render pass the pipeline is
+*created against does not use any color attachments.
+*/
+   bool uses_color_att = false;
+   for (unsigned i = 0; i < subpass->color_count; ++i) {
+   if (subpass->color_attachments[i].attachment != 
VK_ATTACHMENT_UNUSED) {
+   uses_color_att = true;
+   break;
+   }
+   }
+
+   if (uses_color_att && states & (1 << VK_DYNAMIC_STATE_BLEND_CONSTANTS)) 
{
assert(pCreateInfo->pColorBlendState);
typed_memcpy(dynamic->blend_constants,
 pCreateInfo->pColorBlendState->blendConstants, 4);
@@ -1110,14 +1137,17 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline 
*pipeline,
 * no need to override the depthstencil defaults in
 * radv_pipeline::dynamic_state when there is no depthstencil 
attachment.
 *
-* From the Vulkan spec (20 Oct 2015, git-aa308cb):
+* Section 9.2 of the Vulkan 1.0.15 spec says:
 *
-*pDepthStencilState [...] may only be NULL if renderPass and 
subpass
-*specify a subpass that has no depth/stencil attachment.
+*pDepthStencilState is [...] NULL if the pipeline has rasterization
+*disabled or if the subpass of the 

[Mesa-dev] [PATCH] util/disk_cache: handle multiple architectures

2017-03-02 Thread Darren Salt
Previously, the cache would be removed if created by an application for a
different architecture, e.g. i386 rather than amd64 on a multiarch
installation. This is due to use of the libraries' build datestamps.

This makes use of the canonicalisation done by config.sub.
---
 configure.ac  | 14 ++
 src/util/disk_cache.c | 14 ++
 2 files changed, 28 insertions(+)

To fix up the documentation, https://patchwork.freedesktop.org/patch/141595/
is needed.

diff --git a/configure.ac b/configure.ac
index 890a379..91fabf2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1055,6 +1055,20 @@ if test "x$enable_gallium_extra_hud" = xyes ; then
 DEFINES="${DEFINES} -DHAVE_GALLIUM_EXTRA_HUD=1"
 fi
 
+# Architecture name for shader cache
+# Should be canonical for all but i386, so just canonicalise that
+case "$host_cpu" in
+i[456]86)
+CACHE_ARCH=i386
+;;
+*)
+CACHE_ARCH="$host_cpu"
+;;
+esac
+if test "x$CACHE_ARCH" != x; then
+DEFINES="${DEFINES} -DCACHE_ARCH=\\\"$CACHE_ARCH\\\""
+fi
+
 #TODO: no pkgconfig .pc available for libsensors.
 #PKG_CHECK_MODULES([LIBSENSORS], [libsensors >= $LIBSENSORS_REQUIRED],
[enable_lmsensors=yes], [enable_lmsensors=no])
 AC_ARG_ENABLE([lmsensors],
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index f5e1145..87e62fd 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -54,6 +54,11 @@
 /* The number of keys that can be stored in the index. */
 #define CACHE_INDEX_MAX_KEYS (1 << CACHE_INDEX_KEY_BITS)
 
+/* Default cache architecture name */
+#ifndef CACHE_ARCH
+#define CACHE_ARCH "unknown_arch"
+#endif
+
 struct disk_cache {
/* The path to the cache directory. */
char *path;
@@ -175,6 +180,15 @@ create_mesa_cache_dir(void *mem_ctx, char *path, const
char *timestamp,
if (new_path == NULL)
   return NULL;
 
+   /* Create a parent architecture directory so that we don't remove cache
+* files for other architectures. In theory we could share the cache
+* between architectures but we have no way of knowing if they were
created
+* by a compatible Mesa version.
+*/
+   new_path = concatenate_and_mkdir(mem_ctx, new_path, CACHE_ARCH);
+   if (new_path == NULL)
+  return NULL;
+
/* Remove cache directories for old Mesa versions */
remove_old_cache_directories(mem_ctx, new_path, timestamp);
 
-- 
|  _  | Darren Salt, using Debian GNU/Linux (and Android)
| ( ) |
|  X  | ASCII Ribbon campaign against HTML e-mail
| / \ |
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] drirc: Enable glthread for more games (Saints Row 4 & Gat out of Hell).

2017-10-17 Thread Darren Salt
“Saints Row: Gat out of Hell” benefits from this on slower CPUs in that
usage spikes on individual cores are avoided, which in turn makes it harder
to hit a bug which causes broken audio and the game to hang on exit.

“Saints Row IV” appears to be fine either way, but also exhibits the audio
breakage bug: glthread is therefore being enabled on the grounds that it should
make it a little harder to hit that bug.
---
 src/util/drirc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/util/drirc b/src/util/drirc
index 5ca4a266ec..3cf3d8dc69 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -190,6 +190,12 @@ TODO: document the other workarounds.
 
 
 
+
+
+
+
+
+
 
 
 
-- 
2.11.0

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


[Mesa-dev] [PATCH 2/2] drirc: Group a few games in the glthread whitelist together.

2017-10-17 Thread Darren Salt
---
 src/util/drirc | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/util/drirc b/src/util/drirc
index 3cf3d8dc69..39ac3c858c 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -166,27 +166,37 @@ TODO: document the other workarounds.
 
 
 
-
-
-
+
 
 
 
+
 
 
 
+
 
 
 
+
+
+
+
 
 
 
+
 
 
 
+
 
 
 
+
+
+
+
 
 
 
@@ -196,39 +206,44 @@ TODO: document the other workarounds.
 
 
 
+
 
 
 
+
 
 
 
+
 
 
 
 
 
 
+
 
 
 
 
 
 
+
 
 
 
+
 
 
 
-
-
-
 
 
 
+
 
 
 
+
 
 
 
-- 
2.11.0

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


Re: [Mesa-dev] [PATCH 1/2] drirc: Enable glthread for more games (Saints Row 4 & Gat out of Hell).

2017-10-19 Thread Darren Salt
I demand that Marek Olšák may or may not have written...

> Did you verify with GALLIUM_HUD that glthread is enabled and most
> calls are offloaded?

For both games, typical values are:

Offloaded slots around 6.75M
Direct slots around 4.5M
No. of syncs around 2.5k

-- 
|  _  | Darren Salt, using Debian GNU/Linux (and Android)
| ( ) |
|  X  | ASCII Ribbon campaign against HTML e-mail
| / \ |

You can be replaced by this computer.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev