Re: [Mesa-dev] [Review Request (master branch)] svga: Use pipe_shader_state_from_tgsi to set shader state

2020-02-11 Thread Charmaine Lee


Those two patches are simple fixes to our svga driver and have been tested in 
house for a while already.
So I thought it's ok to push the patches directly.
Thanks for reminding me of the MR practice, will keep that in mind for next 
submits.

-Charmaine


From: Michel Dänzer 
Sent: Tuesday, February 11, 2020 2:03 AM
To: Neha Bhende; Brian Paul; Charmaine Lee
Cc: mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [Review Request (master branch)] svga: Use 
pipe_shader_state_from_tgsi to set shader state


Hi Charmaine,


it looks like you pushed this patch and another one directly to the main
Mesa repository master branch.

Pushing directly to the main Mesa repository is no longer common
practice, and indeed discouraged, as it circumvents the pre-merge GitLab
CI pipeline and forfeits all other benefits of a merge request (MR).

The common practice is to create an MR (normally already for patch
review) and assign it to Marge Bot for merging. Marge will rebase as
needed and merge once the pre-merge CI pipeline has passed.


Thanks,


On 2020-01-29 5:14 p.m., Neha Bhende wrote:
> Use pipe_shader_state_from_tgsi() to set shader state for transformed
> shader so that we get all correct data for respective shader state.
>
> This fixes several regressed glretrace, piglit crashes found during merging
> upsteam mesa
>
> Fixes: bf12bc2dd7a2 (draw: add nir info gathering and building support)
>
> Reviewed-by: Charmaine Lee 
> ---
>  src/gallium/drivers/svga/svga_state_tgsi_transform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/svga/svga_state_tgsi_transform.c 
> b/src/gallium/drivers/svga/svga_state_tgsi_transform.c
> index b567aab6bc8..9d701b73772 100644
> --- a/src/gallium/drivers/svga/svga_state_tgsi_transform.c
> +++ b/src/gallium/drivers/svga/svga_state_tgsi_transform.c
> @@ -131,7 +131,7 @@ emulate_point_sprite(struct svga_context *svga,
>   tgsi_dump(new_tokens, 0);
>}
>
> -  templ.tokens = new_tokens;
> +  pipe_shader_state_from_tgsi(, new_tokens);
>templ.stream_output.num_outputs = 0;
>
>if (streamout) {
>


--
Earthling Michel Dänzer   |   
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.comdata=02%7C01%7Ccharmainel%40vmware.com%7Cc04e2bb7e84a46b9879008d7aed996f5%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637170121886003685sdata=J3VtiMG%2Ba5Co3m3nrjVULvj6a9QcpyIYkzpQrbx%2BR70%3Dreserved=0
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallivm: fix issue with AtomicCmpXchg wrapper on llvm 3.5-3.8

2019-08-02 Thread Charmaine Lee

The patch looks good to me. 
It replaces my earlier patch request on the same issue.

Reviewed-by: Charmaine Lee 


On 8/2/19, 9:54 AM, "Brian Paul"  wrote:

On 08/02/2019 10:36 AM, srol...@vmware.com wrote:
> From: Roland Scheidegger 
> 
> These versions still need wrapper but already have both success and
> failure ordering.
> (Compile tested on llvm 3.7, llvm 3.8.)
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=02
> ---
>   src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 16 +++-
>   1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index 79d10293e80..723c84d57c2 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -822,15 +822,29 @@ static llvm::AtomicOrdering 
mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) {
>  llvm_unreachable("Invalid LLVMAtomicOrdering value!");
>   }
>   
> +#if HAVE_LLVM < 0x305
>   LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr,
>   LLVMValueRef Cmp, LLVMValueRef New,
>   LLVMAtomicOrdering SuccessOrdering,
>   LLVMAtomicOrdering FailureOrdering,
>   LLVMBool SingleThread)
>   {
> -   /* LLVM 3.8 doesn't have a second ordering and uses old 
SynchronizationScope enum */
> +   /* LLVM < 3.5 doesn't have a second ordering and uses old 
SynchronizationScope enum */
>  return 
llvm::wrap(llvm::unwrap(B)->CreateAtomicCmpXchg(llvm::unwrap(Ptr), 
llvm::unwrap(Cmp),
> 
llvm::unwrap(New), mapFromLLVMOrdering(SuccessOrdering),
> SingleThread 
? llvm::SynchronizationScope::SingleThread : 
llvm::SynchronizationScope::CrossThread));
>   }
> +#else
> +LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr,
> +LLVMValueRef Cmp, LLVMValueRef New,
> +LLVMAtomicOrdering SuccessOrdering,
> +LLVMAtomicOrdering FailureOrdering,
> +LLVMBool SingleThread)
> +{
> +   return 
llvm::wrap(llvm::unwrap(B)->CreateAtomicCmpXchg(llvm::unwrap(Ptr), 
llvm::unwrap(Cmp),
> +  
llvm::unwrap(New), mapFromLLVMOrdering(SuccessOrdering),
> +  
mapFromLLVMOrdering(FailureOrdering),
> +  SingleThread ? 
llvm::SynchronizationScope::SingleThread : 
llvm::SynchronizationScope::CrossThread));
> +}
> +#endif
>   #endif
> 

Could the #if / #endif logic be moved into the body of 
LLVMBuildAtomicCmpXchg() so the whole function isn't duplicated?

Other than that,
Reviewed-by: Brian Paul 


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

[Mesa-dev] [PATCH] gallivm: fix a missing argument to CreateAtomicCmpXchg

2019-08-01 Thread Charmaine Lee
This patch fixes a missing argument to CreateAtomicCmpXchg for older
version of LLVM.
---
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 79d1029..8205d24 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -831,6 +831,7 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, 
LLVMValueRef Ptr,
/* LLVM 3.8 doesn't have a second ordering and uses old 
SynchronizationScope enum */
return llvm::wrap(llvm::unwrap(B)->CreateAtomicCmpXchg(llvm::unwrap(Ptr), 
llvm::unwrap(Cmp),
   llvm::unwrap(New), 
mapFromLLVMOrdering(SuccessOrdering),
+  
mapFromLLVMOrdering(FailureOrdering),
   SingleThread ? 
llvm::SynchronizationScope::SingleThread : 
llvm::SynchronizationScope::CrossThread));
 }
 #endif
-- 
1.8.5.6

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

Re: [Mesa-dev] [PATCH] svga: clamp max_const_buffers to SVGA_MAX_CONST_BUFS

2019-05-23 Thread Charmaine Lee

Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Monday, May 20, 2019 6:36:33 AM
To: mesa-dev@lists.freedesktop.org
Cc: Neha Bhende; Charmaine Lee
Subject: [PATCH] svga: clamp max_const_buffers to SVGA_MAX_CONST_BUFS

In case the device reports 15 (or more) buffers.
---
 src/gallium/drivers/svga/svga_screen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index 02c1a99..b70fd85 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -1079,7 +1079,8 @@ svga_screen_create(struct svga_winsys_screen *sws)
   /* Maximum number of constant buffers */
   svgascreen->max_const_buffers =
  get_uint_cap(sws, SVGA3D_DEVCAP_DX_MAX_CONSTANT_BUFFERS, 1);
-  assert(svgascreen->max_const_buffers <= SVGA_MAX_CONST_BUFS);
+  svgascreen->max_const_buffers = MIN2(svgascreen->max_const_buffers,
+   SVGA_MAX_CONST_BUFS);

   screen->is_format_supported = svga_is_dx_format_supported;
}
--
2.7.4

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

Re: [Mesa-dev] [PATCH 2/2] mesa: unreference current winsys buffers when unbinding winsys buffers

2019-05-20 Thread Charmaine Lee

>From: Brian Paul 
>Sent: Monday, May 20, 2019 6:39 AM
>To: Charmaine Lee; mesa-dev@lists.freedesktop.org; Neha Bhende; 
>marek.ol...@amd.com
>Subject: Re: [PATCH 2/2] mesa: unreference current winsys buffers when 
>unbinding winsys buffers

>Both look OK to me.  Do they need to be tagged with "Cc:
mesa-sta...@lists.freedesktop.org" for the stable branches?

>Reviewed-by: Brian Paul 

Yes, I will add the tag.  Thanks Brian for reviewing.

-Charmaine



>On 05/18/2019 07:46 PM, Charmaine Lee wrote:
>> This fixes surface leak when no winsys buffers are bound.
>> ---
>>   src/mesa/main/context.c | 4 
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>> index 34da16b..04ef4d5 100644
>> --- a/src/mesa/main/context.c
>> +++ b/src/mesa/main/context.c
>> @@ -1765,6 +1765,10 @@ _mesa_make_current( struct gl_context *newCtx,
>>
>>check_init_viewport(newCtx, drawBuffer->Width, 
>> drawBuffer->Height);
>> }
>> +  else {
>> + _mesa_reference_framebuffer(>WinSysDrawBuffer, NULL);
>> + _mesa_reference_framebuffer(>WinSysReadBuffer, NULL);
>> +  }
>>
>> if (newCtx->FirstTimeCurrent) {
>>handle_first_current(newCtx);
>>

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

[Mesa-dev] [PATCH 1/2] st/mesa: purge framebuffers with current context after unbinding winsys buffers

2019-05-18 Thread Charmaine Lee
With commit c89e8470e58, framebuffers are purged after unbinding context,
but this change also introduces a heap corruption when running Rhino application
on VMware svga device. Instead of purging the framebuffers after the context
is unbound, this patch first ubinds the winsys buffers, then purges the 
framebuffers
with the current context, and then finally unbinds the context.

This fixes heap corruption.
---
 src/mesa/state_tracker/st_manager.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index bee1f6b..35d41f0 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -1105,10 +1105,17 @@ st_api_make_current(struct st_api *stapi, struct 
st_context_iface *stctxi,
else {
   GET_CURRENT_CONTEXT(ctx);
 
-  ret = _mesa_make_current(NULL, NULL, NULL);
-
-  if (ctx)
+  if (ctx) {
+ /* Before releasing the context, release its associated
+  * winsys buffers first. Then purge the context's winsys buffers list
+  * to free the resources of any winsys buffers that no longer have
+  * an existing drawable.
+  */
+ ret = _mesa_make_current(ctx, NULL, NULL);
  st_framebuffers_purge(ctx->st);
+  }
+
+  ret = _mesa_make_current(NULL, NULL, NULL);
}
 
return ret;
-- 
1.8.5.6

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

[Mesa-dev] [PATCH 2/2] mesa: unreference current winsys buffers when unbinding winsys buffers

2019-05-18 Thread Charmaine Lee
This fixes surface leak when no winsys buffers are bound.
---
 src/mesa/main/context.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 34da16b..04ef4d5 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1765,6 +1765,10 @@ _mesa_make_current( struct gl_context *newCtx,
 
  check_init_viewport(newCtx, drawBuffer->Width, drawBuffer->Height);
   }
+  else {
+ _mesa_reference_framebuffer(>WinSysDrawBuffer, NULL);
+ _mesa_reference_framebuffer(>WinSysReadBuffer, NULL);
+  }
 
   if (newCtx->FirstTimeCurrent) {
  handle_first_current(newCtx);
-- 
1.8.5.6

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

Re: [Mesa-dev] [PATCH] svga: change svga_destroy_shader_variant() to return void

2018-10-09 Thread Charmaine Lee

Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Tuesday, October 9, 2018 8:06:26 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: change svga_destroy_shader_variant() to return void

svga_destroy_shader_variant() itself flushes and retries the command
if there's a failure.  So no need for the callers to do it.  Other
callers of the function were already ignoring the return value.

This also fixes a corner-case double-free reported by Coverity
(and reported by Dave Airlie).

Tested with various OpenGL apps.
---
 src/gallium/drivers/svga/svga_pipe_fs.c | 7 +--
 src/gallium/drivers/svga/svga_pipe_gs.c | 8 +---
 src/gallium/drivers/svga/svga_pipe_vs.c | 7 +--
 src/gallium/drivers/svga/svga_shader.c  | 5 ++---
 src/gallium/drivers/svga/svga_shader.h  | 2 +-
 5 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c 
b/src/gallium/drivers/svga/svga_pipe_fs.c
index aadfb1a..52366f0 100644
--- a/src/gallium/drivers/svga/svga_pipe_fs.c
+++ b/src/gallium/drivers/svga/svga_pipe_fs.c
@@ -108,12 +108,7 @@ svga_delete_fs_state(struct pipe_context *pipe, void 
*shader)
  svga->state.hw_draw.fs = NULL;
   }

-  ret = svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_PS, variant);
-  if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_PS, 
variant);
- assert(ret == PIPE_OK);
-  }
+  svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_PS, variant);
}

FREE((void *)fs->base.tokens);
diff --git a/src/gallium/drivers/svga/svga_pipe_gs.c 
b/src/gallium/drivers/svga/svga_pipe_gs.c
index 2fe5477..cee92a0 100644
--- a/src/gallium/drivers/svga/svga_pipe_gs.c
+++ b/src/gallium/drivers/svga/svga_pipe_gs.c
@@ -120,13 +120,7 @@ svga_delete_gs_state(struct pipe_context *pipe, void 
*shader)
 svga->state.hw_draw.gs = NULL;
  }

- ret = svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_GS, 
variant);
- if (ret != PIPE_OK) {
-svga_context_flush(svga, NULL);
-ret = svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_GS,
-  variant);
-assert(ret == PIPE_OK);
- }
+ svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_GS, variant);
   }

   FREE((void *)gs->base.tokens);
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c 
b/src/gallium/drivers/svga/svga_pipe_vs.c
index ba87cb4..3b6d2e9 100644
--- a/src/gallium/drivers/svga/svga_pipe_vs.c
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -199,12 +199,7 @@ svga_delete_vs_state(struct pipe_context *pipe, void 
*shader)
  svga->state.hw_draw.vs = NULL;
   }

-  ret = svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_VS, variant);
-  if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_VS, 
variant);
- assert(ret == PIPE_OK);
-  }
+  svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_VS, variant);
}

FREE((void *)vs->base.tokens);
diff --git a/src/gallium/drivers/svga/svga_shader.c 
b/src/gallium/drivers/svga/svga_shader.c
index 7a0bb3d..22e4498 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -541,7 +541,7 @@ svga_new_shader_variant(struct svga_context *svga)
 }


-enum pipe_error
+void
 svga_destroy_shader_variant(struct svga_context *svga,
 SVGA3dShaderType type,
 struct svga_shader_variant *variant)
@@ -557,6 +557,7 @@ svga_destroy_shader_variant(struct svga_context *svga,
 /* flush and try again */
 svga_context_flush(svga, NULL);
 ret = SVGA3D_vgpu10_DestroyShader(svga->swc, variant->id);
+assert(ret == PIPE_OK);
  }
  util_bitmask_clear(svga->shader_id_bm, variant->id);
   }
@@ -583,8 +584,6 @@ svga_destroy_shader_variant(struct svga_context *svga,
FREE(variant);

svga->hud.num_shaders--;
-
-   return ret;
 }

 /*
diff --git a/src/gallium/drivers/svga/svga_shader.h 
b/src/gallium/drivers/svga/svga_shader.h
index b80cf18..68991e7 100644
--- a/src/gallium/drivers/svga/svga_shader.h
+++ b/src/gallium/drivers/svga/svga_shader.h
@@ -285,7 +285,7 @@ svga_set_shader(struct svga_context *svga,
 struct svga_shader_variant *
 svga_new_shader_variant(struct svga_context *svga);

-enum pipe_error
+void
 svga_destroy_shader_variant(struct svga_context *svga,
 SVGA3dShaderType type,
 struct svga_shader_variant *variant);
--
2.7.4

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


Re: [Mesa-dev] [PATCH 2/2] mesa: move var decls in texstore_rgba()

2018-07-27 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Friday, July 27, 2018 7:21:53 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] mesa: move var decls in texstore_rgba()

Move them closer to where they're first used.
---
 src/mesa/main/texstore.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index c7a459e..55f66c5 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -673,12 +673,10 @@ texstore_compressed(TEXSTORE_PARAMS)
 static GLboolean
 texstore_rgba(TEXSTORE_PARAMS)
 {
-   void *tempImage = NULL, *tempRGBA = NULL;
-   int srcRowStride, img;
+   void *tempImage = NULL;
+   int img;
GLubyte *src, *dst;
-   uint32_t srcMesaFormat;
uint8_t rebaseSwizzle[4];
-   bool needRebase;
bool transferOpsDone = false;

/* We have to handle MESA_FORMAT_YCBCR manually because it is a special case
@@ -748,15 +746,18 @@ texstore_rgba(TEXSTORE_PARAMS)
   }
}

-   srcRowStride =
+   int srcRowStride =
   _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);

-   srcMesaFormat = _mesa_format_from_format_and_type(srcFormat, srcType);
+   uint32_t srcMesaFormat =
+  _mesa_format_from_format_and_type(srcFormat, srcType);
+
dstFormat = _mesa_get_srgb_format_linear(dstFormat);

/* If we have transferOps then we need to convert to RGBA float first,
   then apply transferOps, then do the conversion to dst
 */
+   void *tempRGBA = NULL;
if (!transferOpsDone &&
_mesa_texstore_needs_transfer_ops(ctx, baseInternalFormat, dstFormat)) {
   /* Allocate RGBA float image */
@@ -797,6 +798,7 @@ texstore_rgba(TEXSTORE_PARAMS)
   _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight,
   srcFormat, srcType, 0, 0, 0);

+   bool needRebase;
if (_mesa_get_format_base_format(dstFormat) != baseInternalFormat) {
   needRebase =
  _mesa_compute_rgba2base2rgba_component_mapping(baseInternalFormat,
--
2.7.4

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


[Mesa-dev] [PATCH] st/wgl: check for NULL piAttribList in wglCreatePbufferARB()

2018-07-06 Thread Charmaine Lee
Java2d opengl pipeline passes NULL piAttribList to
wglCreatePbufferARB(). So skip parsing the attribute list
if it is NULL.
---
 src/gallium/state_trackers/wgl/stw_ext_pbuffer.c | 80 
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c 
b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
index d709faa..02ccb76 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
@@ -101,45 +101,47 @@ wglCreatePbufferARB(HDC hCurrentDC,
   return 0;
}
 
-   for (piAttrib = piAttribList; *piAttrib; piAttrib++) {
-  switch (*piAttrib) {
-  case WGL_PBUFFER_LARGEST_ARB:
- piAttrib++;
- useLargest = *piAttrib;
- break;
-   case WGL_TEXTURE_FORMAT_ARB:
-  /* WGL_ARB_render_texture */
-  piAttrib++;
-  textureFormat = *piAttrib;
-  if (textureFormat != WGL_TEXTURE_RGB_ARB &&
- textureFormat != WGL_TEXTURE_RGBA_ARB &&
- textureFormat != WGL_NO_TEXTURE_ARB) {
- SetLastError(ERROR_INVALID_DATA);
- return 0;
-  }
-  break;
-   case WGL_TEXTURE_TARGET_ARB:
-  /* WGL_ARB_render_texture */
-  piAttrib++;
-  textureTarget = *piAttrib;
-  if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB &&
-  textureTarget != WGL_TEXTURE_1D_ARB &&
-  textureTarget != WGL_TEXTURE_2D_ARB &&
-  textureTarget != WGL_NO_TEXTURE_ARB) {
- SetLastError(ERROR_INVALID_DATA);
- return 0;
-  }
-  break;
-  case WGL_MIPMAP_TEXTURE_ARB:
- /* WGL_ARB_render_texture */
- piAttrib++;
- textureMipmap = !!*piAttrib;
- break;
-  default:
- SetLastError(ERROR_INVALID_DATA);
- debug_printf("wgl: Unsupported attribute 0x%x in %s\n",
-  *piAttrib, __func__);
- return 0;
+   if (piAttribList) {
+  for (piAttrib = piAttribList; *piAttrib; piAttrib++) {
+ switch (*piAttrib) {
+ case WGL_PBUFFER_LARGEST_ARB:
+piAttrib++;
+useLargest = *piAttrib;
+break;
+  case WGL_TEXTURE_FORMAT_ARB:
+ /* WGL_ARB_render_texture */
+ piAttrib++;
+ textureFormat = *piAttrib;
+ if (textureFormat != WGL_TEXTURE_RGB_ARB &&
+textureFormat != WGL_TEXTURE_RGBA_ARB &&
+textureFormat != WGL_NO_TEXTURE_ARB) {
+SetLastError(ERROR_INVALID_DATA);
+return 0;
+ }
+ break;
+  case WGL_TEXTURE_TARGET_ARB:
+ /* WGL_ARB_render_texture */
+ piAttrib++;
+ textureTarget = *piAttrib;
+ if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB &&
+ textureTarget != WGL_TEXTURE_1D_ARB &&
+ textureTarget != WGL_TEXTURE_2D_ARB &&
+ textureTarget != WGL_NO_TEXTURE_ARB) {
+SetLastError(ERROR_INVALID_DATA);
+return 0;
+ }
+ break;
+ case WGL_MIPMAP_TEXTURE_ARB:
+/* WGL_ARB_render_texture */
+piAttrib++;
+textureMipmap = !!*piAttrib;
+break;
+ default:
+SetLastError(ERROR_INVALID_DATA);
+debug_printf("wgl: Unsupported attribute 0x%x in %s\n",
+ *piAttrib, __func__);
+return 0;
+ }
   }
}
 
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] st/mesa: add missing switch cases in glsl_to_tgsi_visitor::visit()

2018-06-14 Thread Charmaine Lee

Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Thursday, June 14, 2018 8:13:01 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] st/mesa: add missing switch cases in 
glsl_to_tgsi_visitor::visit()

To silence compiler warning about unhandled switch cases.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b321112..673c0f6 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3990,6 +3990,8 @@ glsl_to_tgsi_visitor::visit(ir_call *ir)
case ir_intrinsic_generic_atomic_max:
case ir_intrinsic_generic_atomic_exchange:
case ir_intrinsic_generic_atomic_comp_swap:
+   case ir_intrinsic_begin_invocation_interlock:
+   case ir_intrinsic_end_invocation_interlock:
   unreachable("Invalid intrinsic");
}
 }
--
2.7.4

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


Re: [Mesa-dev] [PATCH] glsl: change ast_type_qualifier bitset size to work around GCC 5.4 bug

2018-05-08 Thread Charmaine Lee

Looks good.
Also verified that the workaround fixes the crashes that are seen with VMware 
svga driver due to this bug.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, May 8, 2018 7:43:49 AM
To: mesa-dev@lists.freedesktop.org
Cc: Matt Turner; Kenneth Graunke; Charmaine Lee; 
mesa-sta...@lists.freedesktop.org
Subject: [PATCH] glsl: change ast_type_qualifier bitset size to work around GCC 
5.4 bug

Change the size of the bitset from 128 bits to 96.  This works around an
apparent GCC 5.4 bug in which bad SSE code is generated, leading to a
crash in ast_type_qualifier::validate_in_qualifier() (ast_type.cpp:654).

This can be repro'd with the Piglit test tests/spec/glsl-1.50/execution/
varying-struct-basic-gs-fs.shader_test

Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=105497
Cc: mesa-sta...@lists.freedesktop.org
---
 src/compiler/glsl/ast.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index a1ec0d5..9b88ff5 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -474,7 +474,13 @@ enum {

 struct ast_type_qualifier {
DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier);
-   DECLARE_BITSET_T(bitset_t, 128);
+   /* Note: this bitset needs to have at least as many bits as the 'q'
+* struct has flags, below.  Previously, the size was 128 instead of 96.
+* But an apparent bug in GCC 5.4.0 causes bad SSE code generation
+* elsewhere, leading to a crash.  96 bits works around the issue.
+* See https://bugs.freedesktop.org/show_bug.cgi?id=105497
+*/
+   DECLARE_BITSET_T(bitset_t, 96);

union flags {
   struct {
--
2.7.4

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


Re: [Mesa-dev] [PATCH] tgsi: use enums instead of unsigned in ureg code

2018-04-30 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Monday, April 30, 2018 7:42 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] tgsi: use enums instead of unsigned in ureg code

---
 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 14 +++---
 src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 393e015..7d2b9af 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -170,7 +170,7 @@ struct ureg_program
struct {
   unsigned index;
   enum tgsi_texture_type target;
-  unsigned format;
+  enum pipe_format format;
   boolean wr;
   boolean raw;
} image[PIPE_MAX_SHADER_IMAGES];
@@ -773,7 +773,7 @@ struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw)
 {
@@ -1363,8 +1363,8 @@ void
 ureg_emit_memory(struct ureg_program *ureg,
  unsigned extended_token,
  unsigned qualifier,
- unsigned texture,
- unsigned format)
+ enum tgsi_texture_type texture,
+ enum pipe_format format)
 {
union tgsi_any_token *out, *insn;

@@ -1478,8 +1478,8 @@ ureg_memory_insn(struct ureg_program *ureg,
  const struct ureg_src *src,
  unsigned nr_src,
  unsigned qualifier,
- unsigned texture,
- unsigned format)
+ enum tgsi_texture_type texture,
+ enum pipe_format format)
 {
struct ureg_emit_insn_result insn;
unsigned i;
@@ -1719,7 +1719,7 @@ static void
 emit_decl_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw)
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 7eef94a..ac46da5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -372,7 +372,7 @@ struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw);

@@ -579,8 +579,8 @@ ureg_memory_insn(struct ureg_program *ureg,
  const struct ureg_src *src,
  unsigned nr_src,
  unsigned qualifier,
- unsigned texture,
- unsigned format);
+ enum tgsi_texture_type texture,
+ enum pipe_format format);

 /***
  * Internal instruction helpers, don't call these directly:
@@ -619,8 +619,8 @@ void
 ureg_emit_memory(struct ureg_program *ureg,
  unsigned insn_token,
  unsigned qualifier,
- unsigned texture,
- unsigned format);
+ enum tgsi_texture_type texture,
+ enum pipe_format format);

 void
 ureg_emit_dst( struct ureg_program *ureg,
--
2.7.4

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


[Mesa-dev] [PATCH] st/mesa: fix missing setting of _ElementSize in new_draw_rasterpos_stage

2018-04-26 Thread Charmaine Lee
With this patch, _ElementSize is initialized along with the rest
of the vertex array attributes in new_draw_rasterpos_stage().
This fixes a crash in st_pipe_vertex_format() when running
topogun-1.06-orc-84k-resize trace file with VMware svga driver.
---
 src/mesa/state_tracker/st_cb_rasterpos.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c 
b/src/mesa/state_tracker/st_cb_rasterpos.c
index 4e5417b..b73d543 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -40,6 +40,7 @@
 #include "main/macros.h"
 #include "main/feedback.h"
 #include "main/rastpos.h"
+#include "glformats.h"
 
 #include "st_context.h"
 #include "st_atom.h"
@@ -182,6 +183,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct 
draw_context *draw)
 {
struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage);
GLuint i;
+   GLuint elementSize;
 
rs->stage.draw = draw;
rs->stage.next = NULL;
@@ -196,12 +198,15 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct 
draw_context *draw)
 
rs->binding.Stride = 0;
rs->binding.BufferObj = NULL;
+
+   elementSize = _mesa_bytes_per_vertex_attrib(4, GL_FLOAT);
for (i = 0; i < ARRAY_SIZE(rs->array); i++) {
   rs->attrib[i].Size = 4;
   rs->attrib[i].Type = GL_FLOAT;
   rs->attrib[i].Format = GL_RGBA;
   rs->attrib[i].Ptr = (GLubyte *) ctx->Current.Attrib[i];
   rs->attrib[i].Normalized = GL_TRUE;
+  rs->attrib[i]._ElementSize = elementSize;
   rs->array[i].BufferBinding = >binding;
   rs->array[i].VertexAttrib = >attrib[i];
}
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 5/5] gallium/osmesa: link with winsock2 library on Windows

2018-04-13 Thread Charmaine Lee


For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, April 13, 2018 2:35:37 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 5/5] gallium/osmesa: link with winsock2 library on Windows

To fix the MSVC build.  The build broke because we started to compile
the ddebug code on Windows after the mtypes.h changes.  Building ddebug
caused us to also use the u_network.c code for the first time.
---
 src/gallium/targets/osmesa/SConscript | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/targets/osmesa/SConscript 
b/src/gallium/targets/osmesa/SConscript
index f49f1fe..3df5c50 100644
--- a/src/gallium/targets/osmesa/SConscript
+++ b/src/gallium/targets/osmesa/SConscript
@@ -39,6 +39,9 @@ if env['platform'] == 'windows':
 sources += ['osmesa.mingw.def']
 else:
 sources += ['osmesa.def']
+# Link with winsock2 library
+env.Append(LIBS = ['ws2_32'])
+

 gallium_osmesa = env.SharedLibrary(
 target ='osmesa',
--
2.7.4

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


Re: [Mesa-dev] [PATCH 3/3] glsl: #undef THIS macro to fix MSVC build

2018-04-13 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, April 13, 2018 9:03:41 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 3/3] glsl: #undef THIS macro to fix MSVC build

THIS is a macro in one of the MSVC header files.  It's also a token
in the GLSL lexer.  This causes a compilation failure with MSVC.
This issue seems to be newly exposed after the recent mtypes.h removal
patches.
---
 src/compiler/glsl/glsl_parser_extras.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/glsl/glsl_parser_extras.h 
b/src/compiler/glsl/glsl_parser_extras.h
index 66bd1a3..5b9b6cc 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -33,6 +33,11 @@
 #include 
 #include "glsl_symbol_table.h"

+/* THIS is a macro defined somewhere deep in the Windows MSVC header files.
+ * Undefine it here to avoid collision with the lexer's THIS token.
+ */
+#undef THIS
+
 struct gl_context;

 struct glsl_switch_state {
--
2.7.4

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


Re: [Mesa-dev] [PATCH] glapi: define GL_API to be GLAPI in glapi_dispatch.c

2018-03-30 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, March 30, 2018 7:42 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] glapi: define GL_API to be GLAPI in glapi_dispatch.c

This fixes a Windows build warning where the prototypes for the ES
function in the header file don't match the prototypes in this file
because the GL_API and GLAPI macros are defined differently.
---
 src/mapi/glapi/glapi_dispatch.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c
index 3239523..f0a8c36 100644
--- a/src/mapi/glapi/glapi_dispatch.c
+++ b/src/mapi/glapi/glapi_dispatch.c
@@ -97,6 +97,11 @@
  */
 #include 

+
+/* Use the GLAPI annotation from GL/gl.h, not GL_API from GLES/gl.h */
+#undef GL_API
+#define GL_API GLAPI
+
 GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
 GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
 GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat 
bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
--
2.7.4

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


Re: [Mesa-dev] [PATCH] svga: fix blending regression

2018-03-02 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, February 28, 2018 7:29 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: fix blending regression

The earlier Mesa commit 3d06c8afb5 ("st/mesa: don't translate blend
state when it's disabled for a colorbuffer") subtly changed the
details of gallium's per-RT blend state.

In particular, when pipe_rt_blend_state[i].blend_enabled is true,
we have to get the src/dst blend terms from pipe_rt_blend_state[i],
not [0] as before.

We now have to scan the blend targets to find the first one that's
enabled (if any).  We have to use the index of that target for getting
the src/dst blend terms.  And note that we have to set identical blend
terms for all targets.

This fixes the Piglit fbo-drawbuffers2-blend test.  VMware bug 2063493.
---
 src/gallium/drivers/svga/svga_pipe_blend.c | 35 --
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c 
b/src/gallium/drivers/svga/svga_pipe_blend.c
index 04855fa..6bb9d94 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -148,6 +148,17 @@ svga_create_blend_state(struct pipe_context *pipe,
if (!blend)
   return NULL;

+   /* Find index of first target with blending enabled.  -1 means blending
+* is not enabled at all.
+*/
+   int first_enabled = -1;
+   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+  if (templ->rt[i].blend_enable) {
+ first_enabled = i;
+ break;
+  }
+   }
+
/* Fill in the per-rendertarget blend state.  We currently only
 * support independent blend enable and colormask per render target.
 */
@@ -260,24 +271,26 @@ svga_create_blend_state(struct pipe_context *pipe,
  }
   }
   else {
- /* Note: the vgpu10 device does not yet support independent
-  * blend terms per render target.  Target[0] always specifies the
-  * blending terms.
+ /* Note: the vgpu10 device does not yet support independent blend
+  * terms per render target.  When blending is enabled, the blend
+  * terms must match for all targets.
   */
- if (templ->independent_blend_enable || templ->rt[0].blend_enable) {
-/* always use the 0th target's blending terms for now */
+ if (first_enabled >= 0) {
+/* use first enabled target's blending terms */
+const struct pipe_rt_blend_state *rt = >rt[first_enabled];
+
 blend->rt[i].srcblend =
-   svga_translate_blend_factor(svga, templ->rt[0].rgb_src_factor);
+   svga_translate_blend_factor(svga, rt->rgb_src_factor);
 blend->rt[i].dstblend =
-   svga_translate_blend_factor(svga, templ->rt[0].rgb_dst_factor);
+   svga_translate_blend_factor(svga, rt->rgb_dst_factor);
 blend->rt[i].blendeq =
-   svga_translate_blend_func(templ->rt[0].rgb_func);
+   svga_translate_blend_func(rt->rgb_func);
 blend->rt[i].srcblend_alpha =
-   svga_translate_blend_factor(svga, 
templ->rt[0].alpha_src_factor);
+   svga_translate_blend_factor(svga, rt->alpha_src_factor);
 blend->rt[i].dstblend_alpha =
-   svga_translate_blend_factor(svga, 
templ->rt[0].alpha_dst_factor);
+   svga_translate_blend_factor(svga, rt->alpha_dst_factor);
 blend->rt[i].blendeq_alpha =
-   svga_translate_blend_func(templ->rt[0].alpha_func);
+   svga_translate_blend_func(rt->alpha_func);

 if (blend->rt[i].srcblend_alpha != blend->rt[i].srcblend ||
 blend->rt[i].dstblend_alpha != blend->rt[i].dstblend ||
--
2.7.4

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


Re: [Mesa-dev] [PATCH] svga: replaced 'unsigned' with proper enum types in shader code

2018-02-16 Thread Charmaine Lee
Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, February 16, 2018 12:59:28 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: replaced 'unsigned' with proper enum types in shader code

---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 33 ++---
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 4d0834b..6b8337c 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -2053,11 +2053,15 @@ emit_decl_instruction(struct svga_shader_emitter_v10 
*emit,
  */
 static void
 emit_input_declaration(struct svga_shader_emitter_v10 *emit,
-   VGPU10_OPCODE_TYPE opcodeType, unsigned operandType,
-   unsigned dim, unsigned index, unsigned size,
-   unsigned name, unsigned numComp,
-   unsigned selMode, unsigned usageMask,
-   unsigned interpMode)
+   VGPU10_OPCODE_TYPE opcodeType,
+   VGPU10_OPERAND_TYPE operandType,
+   VGPU10_OPERAND_INDEX_DIMENSION dim,
+   unsigned index, unsigned size,
+   VGPU10_SYSTEM_NAME name,
+   VGPU10_OPERAND_NUM_COMPONENTS numComp,
+   VGPU10_OPERAND_4_COMPONENT_SELECTION_MODE selMode,
+   unsigned usageMask,
+   VGPU10_INTERPOLATION_MODE interpMode)
 {
VGPU10OpcodeToken0 opcode0;
VGPU10OperandToken0 operand0;
@@ -2117,8 +2121,9 @@ emit_input_declaration(struct svga_shader_emitter_v10 
*emit,
  */
 static void
 emit_output_declaration(struct svga_shader_emitter_v10 *emit,
-unsigned type, unsigned index,
-unsigned name, unsigned usageMask)
+VGPU10_OPCODE_TYPE type, unsigned index,
+VGPU10_SYSTEM_NAME name,
+unsigned usageMask)
 {
VGPU10OpcodeToken0 opcode0;
VGPU10OperandToken0 operand0;
@@ -2352,7 +2357,9 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
  enum tgsi_semantic semantic_name = emit->info.input_semantic_name[i];
  unsigned usage_mask = emit->info.input_usage_mask[i];
  unsigned index = emit->linkage.input_map[i];
- unsigned type, interpolationMode, name;
+ VGPU10_OPCODE_TYPE type;
+ VGPU10_INTERPOLATION_MODE interpolationMode;
+ VGPU10_SYSTEM_NAME name;

  if (usage_mask == 0)
 continue;  /* register is not actually used */
@@ -2412,9 +2419,10 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
  unsigned usage_mask = emit->info.input_usage_mask[i];
  unsigned index = emit->linkage.input_map[i];
  VGPU10_OPCODE_TYPE opcodeType, operandType;
- unsigned numComp, selMode;
- unsigned name;
- unsigned dim;
+ VGPU10_OPERAND_NUM_COMPONENTS numComp;
+ VGPU10_OPERAND_4_COMPONENT_SELECTION_MODE selMode;
+ VGPU10_SYSTEM_NAME name;
+ VGPU10_OPERAND_INDEX_DIMENSION dim;

  if (usage_mask == 0)
 continue;  /* register is not actually used */
@@ -2548,7 +2556,8 @@ emit_output_declarations(struct svga_shader_emitter_v10 
*emit)
   }
   else {
  /* VS or GS */
- unsigned name, type;
+ VGPU10_COMPONENT_NAME name;
+ VGPU10_OPCODE_TYPE type;
  unsigned writemask = VGPU10_OPERAND_4_COMPONENT_MASK_ALL;

  switch (semantic_name) {
--
2.7.4

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


Re: [Mesa-dev] [PATCH] svga: replace gotos with else clauses

2018-02-15 Thread Charmaine Lee
Looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, February 15, 2018 8:31:12 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: replace gotos with else clauses

Simple clean-up.
---
 src/gallium/drivers/svga/svga_state_fs.c | 19 +--
 src/gallium/drivers/svga/svga_state_gs.c |  9 -
 src/gallium/drivers/svga/svga_state_vs.c | 15 +++
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index eeb1ba6..5190542 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -383,18 +383,17 @@ svga_reemit_fs_bindings(struct svga_context *svga)
   ret =  svga->swc->resource_rebind(svga->swc, NULL,
 svga->state.hw_draw.fs->gb_shader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+   svga->state.hw_draw.fs->gb_shader,
+   svga->state.hw_draw.fs->id);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+  svga->state.hw_draw.fs->gb_shader);
}

-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-svga->state.hw_draw.fs->gb_shader,
-svga->state.hw_draw.fs->id);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-   svga->state.hw_draw.fs->gb_shader);
-
- out:
if (ret != PIPE_OK)
   return ret;

diff --git a/src/gallium/drivers/svga/svga_state_gs.c 
b/src/gallium/drivers/svga/svga_state_gs.c
index 19f0887..38d85f0 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -153,13 +153,12 @@ svga_reemit_gs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
+gbshader, shaderId);
}

-   ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
- gbshader, shaderId);
-
- out:
if (ret != PIPE_OK)
   return ret;

diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index 3dfc9f4..ad93f60 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -227,16 +227,15 @@ svga_reemit_vs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
+   gbshader, shaderId);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
}

-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
-gbshader, shaderId);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
-
- out:
if (ret != PIPE_OK)
   return ret;

--
2.7.4

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


Re: [Mesa-dev] [PATCH] svga: call tgsi_scan_shader() for dummy shaders

2018-02-15 Thread Charmaine Lee

Looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, February 14, 2018 6:57:21 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: call tgsi_scan_shader() for dummy shaders

If we fail to compile the normal VS or FS we fall back to a simple/
dummy shader.  We need to rescan the the shader to update the shader
info.  Otherwise, this can lead to further translations failures
because the shader info doesn't match the actual shader.

Found by adding some extra debug assertions in the state-update code
while debugging something else.

v2: also update shader generic_inputs/outputs, etc. per Charmaine
---
 src/gallium/drivers/svga/svga_state_fs.c | 4 
 src/gallium/drivers/svga/svga_state_vs.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index 5e56899..eeb1ba6 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -115,6 +115,10 @@ get_compiled_dummy_shader(struct svga_context *svga,
FREE((void *) fs->base.tokens);
fs->base.tokens = dummy;

+   tgsi_scan_shader(fs->base.tokens, >base.info);
+   fs->generic_inputs = svga_get_generic_inputs_mask(>base.info);
+   svga_remap_generics(fs->generic_inputs, fs->generic_remap_table);
+
variant = translate_fragment_program(svga, fs, key);
return variant;
 }
diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index a0ab868..3dfc9f4 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -105,6 +105,9 @@ get_compiled_dummy_vertex_shader(struct svga_context *svga,
FREE((void *) vs->base.tokens);
vs->base.tokens = dummy;

+   tgsi_scan_shader(vs->base.tokens, >base.info);
+   vs->generic_outputs = svga_get_generic_outputs_mask(>base.info);
+
variant = translate_vertex_program(svga, vs, key);
return variant;
 }
--
2.7.4

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


Re: [Mesa-dev] [PATCH 3/3] svga: move duplicated code for setting fillmode/flatshade state

2018-02-14 Thread Charmaine Lee

For patch 2 and 3, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, February 14, 2018 1:15:14 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 3/3] svga: move duplicated code for setting fillmode/flatshade 
state

Move the calls to svga_hwtnl_set_fillmode() and svga_hwtnl_set_flatshade()
out of the two retry_draw_*() functions to the svga_draw_vbo() function.
---
 src/gallium/drivers/svga/svga_pipe_draw.c | 30 ++
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index af53881..c73c406 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -64,16 +64,6 @@ retry_draw_range_elements(struct svga_context *svga,

SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWELEMENTS);

-   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
-
-   /** determine if flatshade is to be used after svga_update_state()
-*  in case the fragment shader is changed.
-*/
-   svga_hwtnl_set_flatshade(svga->hwtnl,
-svga->curr.rast->templ.flatshade ||
-is_using_flat_shading(svga),
-svga->curr.rast->templ.flatshade_first);
-
for (unsigned try = 0; try < 2; try++) {
   ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
index_buffer, index_size,
@@ -100,16 +90,6 @@ retry_draw_arrays(struct svga_context *svga,

SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWARRAYS);

-   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
-
-   /** determine if flatshade is to be used after svga_update_state()
-*  in case the fragment shader is changed.
-*/
-   svga_hwtnl_set_flatshade(svga->hwtnl,
-svga->curr.rast->templ.flatshade ||
-is_using_flat_shading(svga),
-svga->curr.rast->templ.flatshade_first);
-
for (unsigned try = 0; try < 2; try++) {
   ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
start_instance, instance_count);
@@ -230,6 +210,16 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
  assert(ret == PIPE_OK);
   }

+  svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
+
+  /** determine if flatshade is to be used after svga_update_state()
+   *  in case the fragment shader is changed.
+   */
+  svga_hwtnl_set_flatshade(svga->hwtnl,
+   svga->curr.rast->templ.flatshade ||
+   is_using_flat_shading(svga),
+   svga->curr.rast->templ.flatshade_first);
+
   if (info->index_size && indexbuf) {
  unsigned offset;

--
2.7.4

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


Re: [Mesa-dev] [PATCH 1/3] svga: call tgsi_scan_shader() for dummy shaders

2018-02-14 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Wednesday, February 14, 2018 1:15 PM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee; Neha Bhende
>Subject: [PATCH 1/3] svga: call tgsi_scan_shader() for dummy shaders

>If we fail to compile the normal VS or FS we fall back to a simple/
>dummy shader.  We need to rescan the the shader to update the shader
>info.  Otherwise, this can lead to further translations failures
>because the shader info doesn't match the actual shader.
>
>Found by adding some extra debug assertions in the state-update code
>while debugging something else.
>---
> src/gallium/drivers/svga/svga_state_fs.c | 2 ++
> src/gallium/drivers/svga/svga_state_vs.c | 2 ++
> 2 files changed, 4 insertions(+)

>diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
>b/src/gallium/drivers/svga/svga_state_fs.c
>index 5e56899..f185a68 100644
>--- a/src/gallium/drivers/svga/svga_state_fs.c
>+++ b/src/gallium/drivers/svga/svga_state_fs.c
>@@ -115,6 +115,8 @@ get_compiled_dummy_shader(struct svga_context *svga,
>FREE((void *) fs->base.tokens);
>fs->base.tokens = dummy;

>+   tgsi_scan_shader(fs->base.tokens, >base.info);
>+

To be complete, we need to get the generic_inputs mask and call 
svga_remap_generics again.


>variant = translate_fragment_program(svga, fs, key);
>return variant;
> }
>diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
>b/src/gallium/drivers/svga/svga_state_vs.c
>index a0ab868..1dcc161 100644
>--- a/src/gallium/drivers/svga/svga_state_vs.c
>+++ b/src/gallium/drivers/svga/svga_state_vs.c
>@@ -105,6 +105,8 @@ get_compiled_dummy_vertex_shader(struct svga_context *svga,
>FREE((void *) vs->base.tokens);
>vs->base.tokens = dummy;

>+   tgsi_scan_shader(vs->base.tokens, >base.info);
>+
Need to set the generic_outputs mask again.


>variant = translate_vertex_program(svga, vs, key);
>return variant;
>

-Charmaine
___
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: whitespace, formatting fixes in st_glsl_to_tgsi.cpp

2018-01-30 Thread Charmaine Lee
For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, January 30, 2018 7:36:43 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] st/mesa: whitespace, formatting fixes in 
st_glsl_to_tgsi.cpp

---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 273 ++---
 1 file changed, 169 insertions(+), 104 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a1e37cf..c92b1d9 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -348,12 +348,16 @@ public:
void *mem_ctx;
 };

-static st_dst_reg address_reg = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 0);
-static st_dst_reg address_reg2 = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 1);
-static st_dst_reg sampler_reladdr = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 2);
+static st_dst_reg address_reg = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+   GLSL_TYPE_FLOAT, 0);
+static st_dst_reg address_reg2 = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+GLSL_TYPE_FLOAT, 1);
+static st_dst_reg sampler_reladdr = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+   GLSL_TYPE_FLOAT, 2);

 static void
-fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 
3);
+fail_link(struct gl_shader_program *prog, const char *fmt, ...)
+   PRINTFLIKE(2, 3);

 static void
 fail_link(struct gl_shader_program *prog, const char *fmt, ...)
@@ -445,7 +449,7 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,

/* Update indirect addressing status used by TGSI */
if (dst.reladdr || dst.reladdr2) {
-  switch(dst.file) {
+  switch (dst.file) {
   case PROGRAM_STATE_VAR:
   case PROGRAM_CONSTANT:
   case PROGRAM_UNIFORM:
@@ -460,8 +464,8 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
}
else {
   for (i = 0; i < 4; i++) {
- if(inst->src[i].reladdr) {
-switch(inst->src[i].file) {
+ if (inst->src[i].reladdr) {
+switch (inst->src[i].file) {
 case PROGRAM_STATE_VAR:
 case PROGRAM_CONSTANT:
 case PROGRAM_UNIFORM:
@@ -497,8 +501,11 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
 */
for (j = 0; j < 2; j++) {
   dst_is_64bit[j] = glsl_base_type_is_64bit(inst->dst[j].type);
-  if (!dst_is_64bit[j] && inst->dst[j].file == PROGRAM_OUTPUT && 
inst->dst[j].type == GLSL_TYPE_ARRAY) {
- enum glsl_base_type type = find_array_type(this->outputs, 
this->num_outputs, inst->dst[j].array_id);
+  if (!dst_is_64bit[j] && inst->dst[j].file == PROGRAM_OUTPUT &&
+  inst->dst[j].type == GLSL_TYPE_ARRAY) {
+ enum glsl_base_type type = find_array_type(this->outputs,
+this->num_outputs,
+inst->dst[j].array_id);
  if (glsl_base_type_is_64bit(type))
 dst_is_64bit[j] = true;
   }
@@ -510,7 +517,8 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
   int initial_src_swz[4], initial_src_idx[4];
   int initial_dst_idx[2], initial_dst_writemask[2];
   /* select the writemask for dst0 or dst1 */
-  unsigned writemask = inst->dst[1].file == PROGRAM_UNDEFINED ? 
inst->dst[0].writemask : inst->dst[1].writemask;
+  unsigned writemask = inst->dst[1].file == PROGRAM_UNDEFINED
+ ? inst->dst[0].writemask : inst->dst[1].writemask;

   /* copy out the writemask, index and swizzles for all src/dsts. */
   for (j = 0; j < 2; j++) {
@@ -532,9 +540,10 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,

  int i = u_bit_scan();

- /* before emitting the instruction, see if we have to adjust load / 
store
-  * address */
- if (i > 1 && (inst->op == TGSI_OPCODE_LOAD || inst->op == 
TGSI_OPCODE_STORE) &&
+ /* before emitting the instruction, see if we have to adjust
+  * load / store address */
+ if (i > 1 && (inst->op == TGSI_OPCODE_LOAD ||
+   inst->op == TGSI_OPCODE_STORE) &&
  addr.file == PROGRAM_UNDEFINED) {
 /* We have to advance the buffer address by 16 */
 addr = get_temp(glsl_type::uint_type);
@@ -561,14 +570,16 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
dinst->dst[j].writemask = (i & 1) ? WRITEMASK_ZW : WRITEMASK_XY;
dinst->dst[j].in

Re: [Mesa-dev] [PATCH 2/2] svga: use opcode local var to simplify some code

2018-01-30 Thread Charmaine Lee

For this series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, January 30, 2018 7:36:27 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: use opcode local var to simplify some code

---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index da520be..73aa78b 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -5360,8 +5360,7 @@ emit_simple(struct svga_shader_emitter_v10 *emit,
unsigned i;

begin_emit_instruction(emit);
-   emit_opcode(emit, translate_opcode(inst->Instruction.Opcode),
-   inst->Instruction.Saturate);
+   emit_opcode(emit, translate_opcode(opcode), inst->Instruction.Saturate);
for (i = 0; i < op->num_dst; i++) {
   emit_dst_register(emit, >Dst[i]);
}
@@ -5412,8 +5411,7 @@ emit_simple_1dst(struct svga_shader_emitter_v10 *emit,
unsigned i;

begin_emit_instruction(emit);
-   emit_opcode(emit, translate_opcode(inst->Instruction.Opcode),
-   inst->Instruction.Saturate);
+   emit_opcode(emit, translate_opcode(opcode), inst->Instruction.Saturate);

for (i = 0; i < dst_count; i++) {
   if (i == dst_index) {
--
2.7.4

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


Re: [Mesa-dev] [PATCH] svga: s/Bool/SVGA3dBool/ in SVGA3dDevCapResult

2018-01-25 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, January 25, 2018 10:38:51 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: s/Bool/SVGA3dBool/ in SVGA3dDevCapResult

And fix whitespace.  To sync up with in-house code.
---
 src/gallium/drivers/svga/include/svga3d_devcaps.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/include/svga3d_devcaps.h 
b/src/gallium/drivers/svga/include/svga3d_devcaps.h
index ade210b..4e2f6bf 100644
--- a/src/gallium/drivers/svga/include/svga3d_devcaps.h
+++ b/src/gallium/drivers/svga/include/svga3d_devcaps.h
@@ -448,10 +448,10 @@ typedef enum {
SVGADX_DXFMT_MULTISAMPLE_8 )

 typedef union {
-   Bool   b;
+   SVGA3dBool b;
uint32 u;
-   int32  i;
-   float  f;
+   int32 i;
+   float f;
 } SVGA3dDevCapResult;

 #endif /* _SVGA3D_DEVCAPS_H_ */
--
2.7.4

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


Re: [Mesa-dev] [PATCH 3/3] mesa: whitespace fixes in varray.h

2018-01-25 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, January 25, 2018 8:48:00 AM
To: mesa-dev@lists.freedesktop.org
Cc: Neha Bhende; Charmaine Lee; Roland Scheidegger
Subject: [PATCH 3/3] mesa: whitespace fixes in varray.h

---
 src/mesa/main/varray.h | 55 ++
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 03d81d0..93f2f47 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -44,9 +44,10 @@ _mesa_vertex_attrib_address(const struct gl_array_attributes 
*array,
if (_mesa_is_bufferobj(binding->BufferObj))
   return (const GLubyte *) (binding->Offset + array->RelativeOffset);
else
-  return array->Ptr;
+  return array->Ptr;
 }

+
 /**
  * Sets the fields in a gl_vertex_array to values derived from a
  * gl_array_attributes and a gl_vertex_buffer_binding.
@@ -70,6 +71,7 @@ _mesa_update_client_array(struct gl_context *ctx,
_mesa_reference_buffer_object(ctx, >BufferObj, binding->BufferObj);
 }

+
 static inline bool
 _mesa_attr_zero_aliases_vertex(const struct gl_context *ctx)
 {
@@ -190,7 +192,7 @@ _mesa_SecondaryColorPointer_no_error(GLint size, GLenum 
type,
  GLsizei stride, const GLvoid *ptr);
 extern void GLAPIENTRY
 _mesa_SecondaryColorPointer(GLint size, GLenum type,
-  GLsizei stride, const GLvoid *ptr);
+GLsizei stride, const GLvoid *ptr);


 extern void GLAPIENTRY
@@ -206,8 +208,8 @@ _mesa_VertexAttribPointer_no_error(GLuint index, GLint 
size, GLenum type,
const GLvoid *pointer);
 extern void GLAPIENTRY
 _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride,
- const GLvoid *pointer);
+  GLboolean normalized, GLsizei stride,
+  const GLvoid *pointer);

 void GLAPIENTRY
 _mesa_VertexAttribIPointer_no_error(GLuint index, GLint size, GLenum type,
@@ -295,35 +297,35 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, 
const GLvoid *pointer);


 extern void GLAPIENTRY
-_mesa_MultiDrawArrays( GLenum mode, const GLint *first,
-  const GLsizei *count, GLsizei primcount );
+_mesa_MultiDrawArrays(GLenum mode, const GLint *first,
+  const GLsizei *count, GLsizei primcount);

 extern void GLAPIENTRY
-_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
-const GLvoid **indices, GLsizei primcount );
+_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
+   const GLvoid **indices, GLsizei primcount);

 extern void GLAPIENTRY
-_mesa_MultiDrawElementsBaseVertex( GLenum mode,
-  const GLsizei *count, GLenum type,
-  const GLvoid **indices, GLsizei primcount,
-  const GLint *basevertex);
+_mesa_MultiDrawElementsBaseVertex(GLenum mode,
+  const GLsizei *count, GLenum type,
+  const GLvoid **indices, GLsizei primcount,
+  const GLint *basevertex);

 extern void GLAPIENTRY
-_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
- const GLsizei * count,
- GLsizei primcount, GLint modestride );
+_mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
+ const GLsizei * count,
+ GLsizei primcount, GLint modestride );


 extern void GLAPIENTRY
-_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
-   GLenum type, const GLvoid * const * indices,
-   GLsizei primcount, GLint modestride );
+_mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count,
+   GLenum type, const GLvoid * const * indices,
+   GLsizei primcount, GLint modestride );

 extern void GLAPIENTRY
 _mesa_LockArraysEXT(GLint first, GLsizei count);

 extern void GLAPIENTRY
-_mesa_UnlockArraysEXT( void );
+_mesa_UnlockArraysEXT(void);


 extern void GLAPIENTRY
@@ -343,13 +345,13 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint 
end, GLsizei count,

 extern void GLAPIENTRY
 _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
-const GLvoid *indices, GLint basevertex);
+ const GLvoid *indices, GLint basevertex);

 extern void GLAPIENTRY
 _mesa_DrawRangeElementsBaseVertex(GLen

Re: [Mesa-dev] [PATCH] svga: update SVGA_NEW_ flags for updating sampler state

2017-12-28 Thread Charmaine Lee

Looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, December 28, 2017 11:09:34 AM
To: mesa-dev@lists.freedesktop.org
Cc: Neha Bhende; Charmaine Lee
Subject: [PATCH] svga: update SVGA_NEW_ flags for updating sampler state

The SVGA_NEW_FS flag is needed since we now examine the fragment
shader's fs_shadow_compare_units flags.  The SVGA_NEW_TEXTURE_FLAGS
flag is not needed since it's only for pre-VGPU10.

No piglit changes.  This doesn't fix any known issues but it could
pop up somewhere.  Suggested by Charmaine.
---
 src/gallium/drivers/svga/svga_state_sampler.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_sampler.c 
b/src/gallium/drivers/svga/svga_state_sampler.c
index 11f36e3..bcc055d 100644
--- a/src/gallium/drivers/svga/svga_state_sampler.c
+++ b/src/gallium/drivers/svga/svga_state_sampler.c
@@ -393,6 +393,7 @@ update_samplers(struct svga_context *svga, unsigned dirty )
   for (i = 0; i < count; i++) {
  bool fs_shadow = false;

+ /* _NEW_FS */
  if (shader == PIPE_SHADER_FRAGMENT) {
 struct svga_shader_variant *fs = svga->state.hw_draw.fs;
 /* If the fragment shader is doing the shadow comparison
@@ -469,8 +470,8 @@ update_samplers(struct svga_context *svga, unsigned dirty )

 struct svga_tracked_state svga_hw_sampler = {
"texture sampler emit",
-   (SVGA_NEW_SAMPLER |
-SVGA_NEW_STIPPLE |
-SVGA_NEW_TEXTURE_FLAGS),
+   (SVGA_NEW_FS |
+SVGA_NEW_SAMPLER |
+SVGA_NEW_STIPPLE),
update_samplers
 };
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: check for null fs pointer in update_samplers()

2017-12-28 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, December 28, 2017 8:19:24 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: check for null fs pointer in update_samplers()

This can happen when there's no active fragment shader, such as
when using transform feedback.  This wasn't hit by any Piglit test
but is hit by Daniel Rákos' Nature demo.  VMware bug 2026189.
---
 src/gallium/drivers/svga/svga_state_sampler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_state_sampler.c 
b/src/gallium/drivers/svga/svga_state_sampler.c
index 9bd0d53..11f36e3 100644
--- a/src/gallium/drivers/svga/svga_state_sampler.c
+++ b/src/gallium/drivers/svga/svga_state_sampler.c
@@ -399,7 +399,7 @@ update_samplers(struct svga_context *svga, unsigned dirty )
  * for this texture unit, don't enable shadow compare in
  * the texture sampler state.
  */
-if (fs->fs_shadow_compare_units & (1 << i)) {
+if (fs && (fs->fs_shadow_compare_units & (1 << i))) {
fs_shadow = true;
 }
  }
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] svga: use tgsi_util_get_shadow_ref_src_index() in a couple place

2017-12-26 Thread Charmaine Lee

For this series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Sunday, December 24, 2017 2:40:28 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: use tgsi_util_get_shadow_ref_src_index() in a couple 
place

No piglit changes.
---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 29 +++--
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 31149dd..3e4a6ed 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -4782,16 +4782,12 @@ emit_tex_compare_refcoord(struct 
svga_shader_emitter_v10 *emit,
   const struct tgsi_full_src_register *coord)
 {
struct tgsi_full_src_register coord_src_ref;
-   unsigned component;
+   int component;

assert(tgsi_is_shadow_target(target));

-   assert(target != TGSI_TEXTURE_SHADOWCUBE_ARRAY); /* XXX not implemented */
-   if (target == TGSI_TEXTURE_SHADOW2D_ARRAY ||
-   target == TGSI_TEXTURE_SHADOWCUBE)
-  component = TGSI_SWIZZLE_W;
-   else
-  component = TGSI_SWIZZLE_Z;
+   component = tgsi_util_get_shadow_ref_src_index(target) % 4;
+   assert(component >= 0);

coord_src_ref = scalar_src(coord, component);

@@ -4895,21 +4891,10 @@ end_tex_swizzle(struct svga_shader_emitter_v10 *emit,

   assert(emit->unit == PIPE_SHADER_FRAGMENT);

-  switch (swz->texture_target) {
-  case TGSI_TEXTURE_SHADOW2D:
-  case TGSI_TEXTURE_SHADOWRECT:
-  case TGSI_TEXTURE_SHADOW1D:
-  case TGSI_TEXTURE_SHADOW1D_ARRAY:
- coord_src = scalar_src(swz->coord_src, TGSI_SWIZZLE_Z);
- break;
-  case TGSI_TEXTURE_SHADOWCUBE:
-  case TGSI_TEXTURE_SHADOW2D_ARRAY:
- coord_src = scalar_src(swz->coord_src, TGSI_SWIZZLE_W);
- break;
-  default:
- assert(!"Unexpected texture target in end_tex_swizzle()");
- coord_src = scalar_src(swz->coord_src, TGSI_SWIZZLE_Z);
-  }
+  int component =
+ tgsi_util_get_shadow_ref_src_index(swz->texture_target) % 4;
+  assert(component >= 0);
+  coord_src = scalar_src(swz->coord_src, component);

   /* COMPARE tmp, coord, texel */
   emit_comparison(emit, compare_func,
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] svga: fix TGSI_TEXTURE_SHADOW1D coordinate selection

2017-12-26 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Saturday, December 23, 2017 9:13:47 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: fix TGSI_TEXTURE_SHADOW1D coordinate selection

Fixes about 24 Piglit tex-miplevel-selection tests.
---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index deb8e5a..31149dd 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -4898,12 +4898,10 @@ end_tex_swizzle(struct svga_shader_emitter_v10 *emit,
   switch (swz->texture_target) {
   case TGSI_TEXTURE_SHADOW2D:
   case TGSI_TEXTURE_SHADOWRECT:
+  case TGSI_TEXTURE_SHADOW1D:
   case TGSI_TEXTURE_SHADOW1D_ARRAY:
  coord_src = scalar_src(swz->coord_src, TGSI_SWIZZLE_Z);
  break;
-  case TGSI_TEXTURE_SHADOW1D:
- coord_src = scalar_src(swz->coord_src, TGSI_SWIZZLE_Y);
- break;
   case TGSI_TEXTURE_SHADOWCUBE:
   case TGSI_TEXTURE_SHADOW2D_ARRAY:
  coord_src = scalar_src(swz->coord_src, TGSI_SWIZZLE_W);
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] gallium/util: don't pass a pipe_resource to util_resource_is_array_texture()

2017-12-07 Thread Charmaine Lee

Series looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, December 7, 2017 2:25:05 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Roland Scheidegger
Subject: [PATCH 2/2] gallium/util: don't pass a pipe_resource to 
util_resource_is_array_texture()

No need to pass a pipe_resource when we can just pass the target.
This makes the function potentially more usable.  Rename it too.
---
 src/gallium/auxiliary/util/u_resource.h   | 6 +++---
 src/gallium/drivers/radeon/r600_texture.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_resource.h 
b/src/gallium/auxiliary/util/u_resource.h
index 6736476..3c6194b 100644
--- a/src/gallium/auxiliary/util/u_resource.h
+++ b/src/gallium/auxiliary/util/u_resource.h
@@ -32,14 +32,14 @@ unsigned
 util_resource_size(const struct pipe_resource *res);

 /**
- * Return true if the resource is an array texture.
+ * Return true if the texture target is an array type.
  *
  * Note that this function returns true for single-layered array textures.
  */
 static inline boolean
-util_resource_is_array_texture(const struct pipe_resource *res)
+util_texture_is_array(enum pipe_texture_target target)
 {
-   switch (res->target) {
+   switch (target) {
case PIPE_TEXTURE_1D_ARRAY:
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_CUBE_ARRAY:
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index cb69398..66d4f02 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -582,7 +582,7 @@ static void si_query_opaque_metadata(struct si_screen 
*sscreen,
PIPE_SWIZZLE_W
};
uint32_t desc[8], i;
-   bool is_array = util_resource_is_array_texture(res);
+   bool is_array = util_texture_is_array(res->target);

/* DRM 2.x.x doesn't support this. */
if (sscreen->info.drm_major != 3)
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] svga: move svga_is_format_supported() to svga_format.c

2017-11-21 Thread Charmaine Lee

Series looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, November 21, 2017 6:33:22 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: move svga_is_format_supported() to svga_format.c

where the other format-related functions live.
---
 src/gallium/drivers/svga/svga_format.c | 119 
 src/gallium/drivers/svga/svga_format.h |  10 +++
 src/gallium/drivers/svga/svga_screen.c | 121 -
 3 files changed, 129 insertions(+), 121 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_format.c 
b/src/gallium/drivers/svga/svga_format.c
index f5265a1..964923f 100644
--- a/src/gallium/drivers/svga/svga_format.c
+++ b/src/gallium/drivers/svga/svga_format.c
@@ -2070,3 +2070,122 @@ svga_linear_to_srgb(SVGA3dSurfaceFormat format)
   return format;
}
 }
+
+
+/**
+ * Implement pipe_screen::is_format_supported().
+ * \param bindings  bitmask of PIPE_BIND_x flags
+ */
+boolean
+svga_is_format_supported(struct pipe_screen *screen,
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned sample_count,
+ unsigned bindings)
+{
+   struct svga_screen *ss = svga_screen(screen);
+   SVGA3dSurfaceFormat svga_format;
+   SVGA3dSurfaceFormatCaps caps;
+   SVGA3dSurfaceFormatCaps mask;
+
+   assert(bindings);
+
+   if (sample_count > 1) {
+  /* In ms_samples, if bit N is set it means that we support
+   * multisample with N+1 samples per pixel.
+   */
+  if ((ss->ms_samples & (1 << (sample_count - 1))) == 0) {
+ return FALSE;
+  }
+   }
+
+   svga_format = svga_translate_format(ss, format, bindings);
+   if (svga_format == SVGA3D_FORMAT_INVALID) {
+  return FALSE;
+   }
+
+   if (!ss->sws->have_vgpu10 &&
+   util_format_is_srgb(format) &&
+   (bindings & PIPE_BIND_DISPLAY_TARGET)) {
+   /* We only support sRGB rendering with vgpu10 */
+  return FALSE;
+   }
+
+   /*
+* For VGPU10 vertex formats, skip querying host capabilities
+*/
+
+   if (ss->sws->have_vgpu10 && (bindings & PIPE_BIND_VERTEX_BUFFER)) {
+  SVGA3dSurfaceFormat svga_format;
+  unsigned flags;
+  svga_translate_vertex_format_vgpu10(format, _format, );
+  return svga_format != SVGA3D_FORMAT_INVALID;
+   }
+
+   /*
+* Override host capabilities, so that we end up with the same
+* visuals for all virtual hardware implementations.
+*/
+   if (bindings & PIPE_BIND_DISPLAY_TARGET) {
+  switch (svga_format) {
+  case SVGA3D_A8R8G8B8:
+  case SVGA3D_X8R8G8B8:
+  case SVGA3D_R5G6B5:
+ break;
+
+  /* VGPU10 formats */
+  case SVGA3D_B8G8R8A8_UNORM:
+  case SVGA3D_B8G8R8X8_UNORM:
+  case SVGA3D_B5G6R5_UNORM:
+  case SVGA3D_B8G8R8X8_UNORM_SRGB:
+  case SVGA3D_B8G8R8A8_UNORM_SRGB:
+  case SVGA3D_R8G8B8A8_UNORM_SRGB:
+ break;
+
+  /* Often unsupported/problematic. This means we end up with the same
+   * visuals for all virtual hardware implementations.
+   */
+  case SVGA3D_A4R4G4B4:
+  case SVGA3D_A1R5G5B5:
+ return FALSE;
+
+  default:
+ return FALSE;
+  }
+   }
+
+   /*
+* Query the host capabilities.
+*/
+   svga_get_format_cap(ss, svga_format, );
+
+   if (bindings & PIPE_BIND_RENDER_TARGET) {
+  /* Check that the color surface is blendable, unless it's an
+   * integer format.
+   */
+  if (!svga_format_is_integer(svga_format) &&
+  (caps.value & SVGA3DFORMAT_OP_NOALPHABLEND)) {
+ return FALSE;
+  }
+   }
+
+   mask.value = 0;
+   if (bindings & PIPE_BIND_RENDER_TARGET) {
+  mask.value |= SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET;
+   }
+   if (bindings & PIPE_BIND_DEPTH_STENCIL) {
+  mask.value |= SVGA3DFORMAT_OP_ZSTENCIL;
+   }
+   if (bindings & PIPE_BIND_SAMPLER_VIEW) {
+  mask.value |= SVGA3DFORMAT_OP_TEXTURE;
+   }
+
+   if (target == PIPE_TEXTURE_CUBE) {
+  mask.value |= SVGA3DFORMAT_OP_CUBETEXTURE;
+   }
+   else if (target == PIPE_TEXTURE_3D) {
+  mask.value |= SVGA3DFORMAT_OP_VOLUMETEXTURE;
+   }
+
+   return (caps.value & mask.value) == mask.value;
+}
diff --git a/src/gallium/drivers/svga/svga_format.h 
b/src/gallium/drivers/svga/svga_format.h
index 55d89ed..c063589 100644
--- a/src/gallium/drivers/svga/svga_format.h
+++ b/src/gallium/drivers/svga/svga_format.h
@@ -120,4 +120,14 @@ svga_format_is_shareable(const struct svga_screen *ss,

 SVGA3dSurfaceFormat
 svga_linear_to_srgb(SVGA3dSurfaceFormat format);
+
+
+boolean
+svga_is_format_supported(struct pipe_screen *screen,
+ enum pipe_format format,
+ enum pipe_texture_target target

Re: [Mesa-dev] [PATCH] tgsi: bump tgsi_opcode_info::output_mode size to 4 bits

2017-11-17 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, November 17, 2017 2:40:01 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Roland Scheidegger
Subject: [PATCH] tgsi: bump tgsi_opcode_info::output_mode size to 4 bits

To avoid problems with MSVC.  And verify size with ASSERT_BITFIELD_SIZE().
---
 src/gallium/auxiliary/tgsi/tgsi_info.c | 2 ++
 src/gallium/auxiliary/tgsi/tgsi_info.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index c39de0e..2baed5b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -56,6 +56,8 @@ tgsi_get_opcode_info( uint opcode )
static boolean firsttime = 1;

ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, opcode, TGSI_OPCODE_LAST - 1);
+   ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, output_mode,
+TGSI_OUTPUT_OTHER);

if (firsttime) {
   unsigned i;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h 
b/src/gallium/auxiliary/tgsi/tgsi_info.h
index 8d32f47..bbd86c6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -78,7 +78,7 @@ struct tgsi_opcode_info
unsigned is_branch:1;
unsigned pre_dedent:1;
unsigned post_indent:1;
-   enum tgsi_output_mode output_mode:3;
+   enum tgsi_output_mode output_mode:4;
unsigned opcode:8;
 };

--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: add missing PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER* cases

2017-11-16 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, November 16, 2017 3:36:15 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: add missing PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER* cases

---
 src/gallium/drivers/svga/svga_screen.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index 8621640..ab604b9 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -708,6 +708,8 @@ vgpu10_get_shader_param(struct pipe_screen *screen,
case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD:
case PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS:
case PIPE_SHADER_CAP_INT64_ATOMICS:
+   case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS:
+   case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS:
   return 0;
case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
   return 32;
--
1.9.1

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


Re: [Mesa-dev] [PATCH 1/2] tgsi: s/unsigned/enum tgsi_texture_type/

2017-11-14 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Tuesday, November 14, 2017 3:42 PM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee; Neha Bhende
>Subject: [PATCH 1/2] tgsi: s/unsigned/enum tgsi_texture_type/
...

>diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.h 
>b/src/gallium/auxiliary/tgsi/tgsi_util.h
>index 534b5f7..6d56c5b 100644
>--- a/src/gallium/auxiliary/tgsi/tgsi_util.h
>+++ b/src/gallium/auxiliary/tgsi/tgsi_util.h
>@@ -82,24 +82,24 @@ struct tgsi_src_register
> tgsi_util_get_src_from_ind(const struct tgsi_ind_register *reg);

> int
>-tgsi_util_get_texture_coord_dim(unsigned tgsi_tex);
>+tgsi_util_get_texture_coord_dim(enum tgsi_texture_type tgsi_tex);

> int
>-tgsi_util_get_shadow_ref_src_index(unsigned tgsi_tex);
>+tgsi_util_get_shadow_ref_src_index(enum tgsi_texture_type tgsi_tex);

> boolean
>-tgsi_is_shadow_target(unsigned target);
>+tgsi_is_shadow_target(enum tgsi_texture_type);

Lets add the argument name "target" back to be consistent with the rest.

Other than that, this series looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

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


Re: [Mesa-dev] [PATCH] svga: issue debug warning for unsupported two-sided stencil state

2017-11-14 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, November 10, 2017 6:40:26 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] svga: issue debug warning for unsupported two-sided stencil 
state

We only have a single stencil read mask and write mask.  Issue a
warning if different front/back values are used.  The Piglit
gl-2.0-two-sided-stencil test hits this.
---
 src/gallium/drivers/svga/svga_pipe_depthstencil.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c 
b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
index 1b62290..e5caa4b 100644
--- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -172,6 +172,21 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,

   ds->stencil_mask  = templ->stencil[1].valuemask & 0xff;
   ds->stencil_writemask = templ->stencil[1].writemask & 0xff;
+
+  if (templ->stencil[1].valuemask != templ->stencil[0].valuemask) {
+ pipe_debug_message(>debug.callback, CONFORMANCE,
+"two-sided stencil mask not supported "
+"(front=0x%x, back=0x%x)",
+templ->stencil[0].valuemask,
+templ->stencil[1].valuemask);
+  }
+  if (templ->stencil[1].writemask != templ->stencil[0].writemask) {
+ pipe_debug_message(>debug.callback, CONFORMANCE,
+"two-sided stencil writemask not supported "
+"(front=0x%x, back=0x%x)",
+templ->stencil[0].writemask,
+templ->stencil[1].writemask);
+  }
}
else {
   /* back face state is same as front-face state */
--
1.9.1

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


Re: [Mesa-dev] [PATCH] st/mesa: remove 'struct' keyword on function parameter

2017-11-09 Thread Charmaine Lee

Reviewed-by; Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, November 9, 2017 11:31:16 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] st/mesa: remove 'struct' keyword on function parameter

st_src_reg is a class, not a struct.  Simply remove 'struct' to silence
a MSVC compiler warning (class vs. struct mismatch).
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index ca04765..3dc0237 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4590,8 +4590,7 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
 }

 static void
-rename_temp_handle_src(struct rename_reg_pair *renames,
-   struct st_src_reg *src)
+rename_temp_handle_src(struct rename_reg_pair *renames, st_src_reg *src)
 {
if (src && src->file == PROGRAM_TEMPORARY) {
   int old_idx = src->index;
--
1.9.1

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


Re: [Mesa-dev] [PATCH 3/3] mesa: s/GLint/gl_buffer_index/ for _ColorDrawBufferIndexes

2017-11-09 Thread Charmaine Lee

For this series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Thursday, November 9, 2017 11:31:42 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH 3/3] mesa: s/GLint/gl_buffer_index/ for _ColorDrawBufferIndexes

Also fix local variable declarations and replace -1 with BUFFER_NONE.
No Piglit changes.
---
 src/mesa/drivers/common/meta.c   |  2 +-
 src/mesa/main/buffers.c  | 16 
 src/mesa/main/clear.c|  9 +
 src/mesa/main/framebuffer.c  |  4 ++--
 src/mesa/main/mtypes.h   |  2 +-
 src/mesa/state_tracker/st_cb_clear.c |  4 ++--
 src/mesa/state_tracker/st_cb_fbo.c   |  4 ++--
 src/mesa/swrast/s_blit.c |  8 
 src/mesa/swrast/s_renderbuffer.c |  4 ++--
 9 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index bae04be..1cc736c 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1655,7 +1655,7 @@ _mesa_meta_drawbuffers_and_colormask(struct gl_context 
*ctx, GLbitfield mask)
enums[0] = GL_NONE;

for (int i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-  int b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
+  gl_buffer_index b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
   int colormask_idx = ctx->Extensions.EXT_draw_buffers2 ? i : 0;

   if (b < 0 || !(mask & (1 << b)) || is_color_disabled(ctx, colormask_idx))
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 5c37f0f..d364047 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -170,7 +170,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, 
GLenum buffer)
  * Helper routine used by glReadBuffer.
  * Given a GLenum naming a color buffer, return the index of the corresponding
  * renderbuffer (a BUFFER_* value).
- * return -1 for an invalid buffer.
+ * return BUFFER_NONE for an invalid buffer.
  */
 static gl_buffer_index
 read_buffer_enum_to_index(const struct gl_context *ctx, GLenum buffer)
@@ -719,7 +719,7 @@ _mesa_drawbuffers(struct gl_context *ctx, struct 
gl_framebuffer *fb,
if (n > 0 && _mesa_bitcount(destMask[0]) > 1) {
   GLuint count = 0, destMask0 = destMask[0];
   while (destMask0) {
- const int bufIndex = u_bit_scan();
+ const gl_buffer_index bufIndex = u_bit_scan();
  if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
 updated_drawbuffers(ctx, fb);
 fb->_ColorDrawBufferIndexes[count] = bufIndex;
@@ -733,7 +733,7 @@ _mesa_drawbuffers(struct gl_context *ctx, struct 
gl_framebuffer *fb,
   GLuint count = 0;
   for (buf = 0; buf < n; buf++ ) {
  if (destMask[buf]) {
-GLint bufIndex = ffs(destMask[buf]) - 1;
+gl_buffer_index bufIndex = ffs(destMask[buf]) - 1;
 /* only one bit should be set in the destMask[buf] field */
 assert(_mesa_bitcount(destMask[buf]) == 1);
 if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
@@ -743,9 +743,9 @@ _mesa_drawbuffers(struct gl_context *ctx, struct 
gl_framebuffer *fb,
 count = buf + 1;
  }
  else {
-if (fb->_ColorDrawBufferIndexes[buf] != -1) {
+if (fb->_ColorDrawBufferIndexes[buf] != BUFFER_NONE) {
   updated_drawbuffers(ctx, fb);
-   fb->_ColorDrawBufferIndexes[buf] = -1;
+   fb->_ColorDrawBufferIndexes[buf] = BUFFER_NONE;
 }
  }
  fb->ColorDrawBuffer[buf] = buffers[buf];
@@ -753,11 +753,11 @@ _mesa_drawbuffers(struct gl_context *ctx, struct 
gl_framebuffer *fb,
   fb->_NumColorDrawBuffers = count;
}

-   /* set remaining outputs to -1 (GL_NONE) */
+   /* set remaining outputs to BUFFER_NONE */
for (buf = fb->_NumColorDrawBuffers; buf < ctx->Const.MaxDrawBuffers; 
buf++) {
-  if (fb->_ColorDrawBufferIndexes[buf] != -1) {
+  if (fb->_ColorDrawBufferIndexes[buf] != BUFFER_NONE) {
  updated_drawbuffers(ctx, fb);
- fb->_ColorDrawBufferIndexes[buf] = -1;
+ fb->_ColorDrawBufferIndexes[buf] = BUFFER_NONE;
   }
}
for (buf = n; buf < ctx->Const.MaxDrawBuffers; buf++) {
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index c5e7f13..be60442 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -194,9 +194,9 @@ clear(struct gl_context *ctx, GLbitfield mask, bool 
no_error)
   if (mask & GL_COLOR_BUFFER_BIT) {
  GLuint i;
  for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-GLint buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
+gl_buffer_index buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[i

Re: [Mesa-dev] [PATCH 1/2] st/mesa: use enum types instead of int/unsigned

2017-11-06 Thread Charmaine Lee

For this series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Monday, November 6, 2017 1:00:30 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH 1/2] st/mesa: use enum types instead of int/unsigned

Use the proper enum types for various variables.  Makes life in gdb
a little nicer.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp   | 7 ---
 src/mesa/state_tracker/st_glsl_to_tgsi_private.h | 6 +++---
 src/mesa/state_tracker/st_mesa_to_tgsi.c | 6 +++---
 src/mesa/state_tracker/st_mesa_to_tgsi.h | 7 ---
 4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 54e1961..2048b59 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -179,10 +179,10 @@ public:
int num_address_regs;
uint32_t samplers_used;
glsl_base_type sampler_types[PIPE_MAX_SAMPLERS];
-   int sampler_targets[PIPE_MAX_SAMPLERS];   /**< One of TGSI_TEXTURE_* */
+   enum tgsi_texture_type sampler_targets[PIPE_MAX_SAMPLERS];
int images_used;
int image_targets[PIPE_MAX_SHADER_IMAGES];
-   unsigned image_formats[PIPE_MAX_SHADER_IMAGES];
+   enum pipe_format image_formats[PIPE_MAX_SHADER_IMAGES];
bool indirect_addr_consts;
int wpos_transform_const;

@@ -6489,7 +6489,8 @@ st_translate_program(
/* texture samplers */
for (i = 0; i < frag_const->MaxTextureImageUnits; i++) {
   if (program->samplers_used & (1u << i)) {
- unsigned type = st_translate_texture_type(program->sampler_types[i]);
+ enum tgsi_return_type type =
+st_translate_texture_type(program->sampler_types[i]);

  t->samplers[i] = ureg_DECL_sampler(ureg, i);

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h 
b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
index d57525d..bdc7448 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
@@ -127,13 +127,13 @@ public:
unsigned is_64bit_expanded:1;
unsigned sampler_base:5;
unsigned sampler_array_size:6; /**< 1-based size of sampler array, 1 if not 
array */
-   unsigned tex_target:4; /**< One of TEXTURE_*_INDEX */
+   gl_texture_index tex_target:5;
glsl_base_type tex_type:5;
unsigned tex_shadow:1;
-   unsigned image_format:9;
+   enum pipe_format image_format:9;
unsigned tex_offset_num_offset:3;
unsigned dead_mask:4; /**< Used in dead code elimination */
-   unsigned buffer_access:3; /**< buffer access type */
+   unsigned buffer_access:3; /**< bitmask of TGSI_MEMORY_x bits */

const struct tgsi_opcode_info *info;
 };
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c 
b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index fa9fa44..8a61776 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -166,8 +166,8 @@ src_register( struct st_translate *t,
 /**
  * Map mesa texture target to TGSI texture target.
  */
-unsigned
-st_translate_texture_target(GLuint textarget, GLboolean shadow)
+enum tgsi_texture_type
+st_translate_texture_target(gl_texture_index textarget, GLboolean shadow)
 {
if (shadow) {
   switch (textarget) {
@@ -225,7 +225,7 @@ st_translate_texture_target(GLuint textarget, GLboolean 
shadow)
 /**
  * Map GLSL base type to TGSI return type.
  */
-unsigned
+enum tgsi_return_type
 st_translate_texture_type(enum glsl_base_type type)
 {
switch (type) {
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h 
b/src/mesa/state_tracker/st_mesa_to_tgsi.h
index 106cf85..06e8b70 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -30,6 +30,7 @@
 #define ST_MESA_TO_TGSI_H

 #include "main/glheader.h"
+#include "main/mtypes.h"

 #include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
@@ -62,10 +63,10 @@ st_translate_mesa_program(
const ubyte outputSemanticName[],
const ubyte outputSemanticIndex[]);

-unsigned
-st_translate_texture_target(GLuint textarget, GLboolean shadow);
+enum tgsi_texture_type
+st_translate_texture_target(gl_texture_index textarget, GLboolean shadow);

-unsigned
+enum tgsi_return_type
 st_translate_texture_type(enum glsl_base_type type);

 #if defined __cplusplus
--
1.9.1

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


Re: [Mesa-dev] [PATCH] gallium: increase pipe_sampler_view::target bitfield size for MSVC

2017-11-01 Thread Charmaine Lee

Nice catch.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, November 1, 2017 7:45:29 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] gallium: increase pipe_sampler_view::target bitfield size for 
MSVC

MSVC treats enums as being signed.  The 4-bit target field isn't large
enough to correctly store the value 8 (for PIPE_TEXTURE_CUBE_ARRAY).
The bitfield value 0x8 was being interpreted as -8 so matching the
target with PIPE_TEXTURE_CUBE_ARRAY in switch statements, etc. was
failing.

To keep the structure size the same, we reduce the format field from
16 bits to 15.  There don't appear to be any other enum bitfields
which need to be adjusted.

This fixes a number of Piglit cube map array tests.
---
 src/gallium/include/pipe/p_state.h | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index 10bf678..90dc561 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -34,6 +34,10 @@
  * Basic notes:
  *   1. Want compact representations, so we use bitfields.
  *   2. Put bitfields before other (GLfloat) fields.
+ *   3. enum bitfields need to be at least one bit extra in size so the most
+ *  significant bit is zero.  MSVC treats enums as signed so if the high
+ *  bit is set, the value will be interpreted as a negative number.
+ *  That causes trouble in various places.
  */


@@ -436,8 +440,8 @@ struct pipe_surface
 struct pipe_sampler_view
 {
struct pipe_reference reference;
-   enum pipe_format format:16;  /**< typed PIPE_FORMAT_x */
-   enum pipe_texture_target target:4; /**< PIPE_TEXTURE_x */
+   enum pipe_format format:15;  /**< typed PIPE_FORMAT_x */
+   enum pipe_texture_target target:5; /**< PIPE_TEXTURE_x */
unsigned swizzle_r:3; /**< PIPE_SWIZZLE_x for red component */
unsigned swizzle_g:3; /**< PIPE_SWIZZLE_x for green component */
unsigned swizzle_b:3; /**< PIPE_SWIZZLE_x for blue component */
--
1.9.1

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


Re: [Mesa-dev] [PATCH 4/4] util: include string.h in u_string.h

2017-10-03 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, October 3, 2017 1:04:16 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 4/4] util: include string.h in u_string.h

To fix MinGW compiler warning about missing strlen() prototype.
Not sure how I missed this when fixing the malloc() / stdlib.h issue.
---
 src/util/u_string.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/u_string.h b/src/util/u_string.h
index 5a2a3e9..fa0241e 100644
--- a/src/util/u_string.h
+++ b/src/util/u_string.h
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "util/macros.h" // PRINTFLIKE

--
1.9.1

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


Re: [Mesa-dev] [PATCH] vbo: fix build errors on android

2017-09-04 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


> On Sep 3, 2017, at 10:13 PM, Tapani Pälli <tapani.pa...@intel.com> wrote:
> 
> incompatible pointer to integer conversion assigning to 'GLintptr' (aka 'int')
> from 'const char *' [-Werror,-Wint-conversion]
> 
>  offset = indices;
> ^ ~~~
> 
> Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
> ---
> src/mesa/vbo/vbo_minmax_index.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/vbo/vbo_minmax_index.c b/src/mesa/vbo/vbo_minmax_index.c
> index 58a2af49ac..1377926bba 100644
> --- a/src/mesa/vbo/vbo_minmax_index.c
> +++ b/src/mesa/vbo/vbo_minmax_index.c
> @@ -255,7 +255,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
> count, min_index, max_index))
>  return;
> 
> -  offset = indices;
> +  offset = (GLintptr) indices;
>   indices = ctx->Driver.MapBufferRange(ctx, offset, size,
>GL_MAP_READ_BIT, ib->obj,
>MAP_INTERNAL);
> -- 
> 2.13.5
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] vbo: fix offset in minmax cache key

2017-08-30 Thread Charmaine Lee
Instead of saving primitive offset in the minmax cache key,
save the actual buffer offset which is used in the cache lookup.

Fixes rendering artifact seen with GoogleEarth when run with
VMware driver.

v2: Per Brian's comment, initialize offset to avoid compiler warning.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/mesa/vbo/vbo_minmax_index.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/vbo/vbo_minmax_index.c b/src/mesa/vbo/vbo_minmax_index.c
index 4c17a08..58a2af4 100644
--- a/src/mesa/vbo/vbo_minmax_index.c
+++ b/src/mesa/vbo/vbo_minmax_index.c
@@ -245,6 +245,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
   _mesa_primitive_restart_index(ctx, ib->index_size);
const char *indices;
GLuint i;
+   GLintptr offset = 0;
 
indices = (char *) ib->ptr + prim->start * ib->index_size;
if (_mesa_is_bufferobj(ib->obj)) {
@@ -254,7 +255,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
 count, min_index, max_index))
  return;
 
-  indices = ctx->Driver.MapBufferRange(ctx, (GLintptr) indices, size,
+  offset = indices;
+  indices = ctx->Driver.MapBufferRange(ctx, offset, size,
GL_MAP_READ_BIT, ib->obj,
MAP_INTERNAL);
}
@@ -337,8 +339,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
}
 
if (_mesa_is_bufferobj(ib->obj)) {
-  vbo_minmax_cache_store(ctx, ib->obj, ib->index_size, prim->start, count,
- *min_index, *max_index);
+  vbo_minmax_cache_store(ctx, ib->obj, ib->index_size, offset,
+ count, *min_index, *max_index);
   ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
}
 }
-- 
1.9.1

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


[Mesa-dev] [PATCH] vbo: fix offset in minmax cache key

2017-08-30 Thread Charmaine Lee
Instead of saving primitive offset in the minmax cache key,
save the actual buffer offset which is used in the cache lookup.

Fixes rendering artifact seen with GoogleEarth when run with
VMware driver.
---
 src/mesa/vbo/vbo_minmax_index.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/vbo/vbo_minmax_index.c b/src/mesa/vbo/vbo_minmax_index.c
index 4c17a08..3bad158 100644
--- a/src/mesa/vbo/vbo_minmax_index.c
+++ b/src/mesa/vbo/vbo_minmax_index.c
@@ -245,6 +245,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
   _mesa_primitive_restart_index(ctx, ib->index_size);
const char *indices;
GLuint i;
+   GLintptr offset;
 
indices = (char *) ib->ptr + prim->start * ib->index_size;
if (_mesa_is_bufferobj(ib->obj)) {
@@ -254,7 +255,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
 count, min_index, max_index))
  return;
 
-  indices = ctx->Driver.MapBufferRange(ctx, (GLintptr) indices, size,
+  offset = indices;
+  indices = ctx->Driver.MapBufferRange(ctx, offset, size,
GL_MAP_READ_BIT, ib->obj,
MAP_INTERNAL);
}
@@ -337,8 +339,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
}
 
if (_mesa_is_bufferobj(ib->obj)) {
-  vbo_minmax_cache_store(ctx, ib->obj, ib->index_size, prim->start, count,
- *min_index, *max_index);
+  vbo_minmax_cache_store(ctx, ib->obj, ib->index_size, offset,
+ count, *min_index, *max_index);
   ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
}
 }
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: include sample count in surface_size() computation

2017-08-30 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, August 30, 2017 10:16:05 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: include sample count in surface_size() computation

Use MAX2() because sampleCount will be zero for non-MSAA surfaces.
No Piglit regressions.
---
 src/gallium/drivers/svga/svga_screen_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_screen_cache.c 
b/src/gallium/drivers/svga/svga_screen_cache.c
index 5cec435..686d94a 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.c
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -69,7 +69,7 @@ surface_size(const struct svga_host_surface_cache_key *key)
   total_size += img_size;
}

-   total_size *= key->numFaces * key->arraySize;
+   total_size *= key->numFaces * key->arraySize * MAX2(1, key->sampleCount);

return total_size;
 }
--
1.9.1

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


Re: [Mesa-dev] [PATCH] vbo: fix glVertexAttrib(index=0)

2017-08-23 Thread Charmaine Lee

Looks good. Thanks.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, August 22, 2017 1:21:56 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] vbo: fix glVertexAttrib(index=0)

Depending on which extension or GL spec you read the behavior of
glVertexAttrib(index=0) either sets the current value for generic
attribute 0, or it emits a vertex just like glVertex().  I believe
it should do either, depending on context (see below).

The piglit gl-2.0-vertex-const-attr test declares two vertex attributes:
  attribute vec2 vertex;
  attribute vec4 attr;
and the GLSL linker assigns "vertex" to location 0 and "attr" to location 1.
The test passes.

But if the declarations were reversed such that "attr" was location 0 and
"vertex" was location 1, the test would fail to draw properly.

The problem is the call to glVertexAttrib(index=0) to set attr's value
was interpreted as glVertex() and did not set generic attribute[0]'s value.
Interesting, calling glVertex() outside glBegin/End (which is effectively
what the piglit test does) does not generate a GL error.

I believe the behavior of glVertexAttrib(index=0) should depend on
whether it's called inside or outside of glBegin/glEnd().  If inside
glBegin/End(), it should act like glVertex().  Else, it should behave
like glVertexAttrib(index > 0).  This seems to be what NVIDIA does.

This patch makes two changes:

1. Check if we're inside glBegin/End for glVertexAttrib()
2. Fix the vertex array binding for recalculate_input_bindings().  As it was,
   we were using >currval[VBO_ATTRIB_POS], but that's interpreted
   as a zero-stride attribute and doesn't make sense for array drawing.

No Piglit regressions.  Fixes updated gl-2.0-vertex-const-attr test and
passes new gl-2.0-vertex-attrib-0 test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101941
---
 src/mesa/vbo/vbo_attrib_tmp.h | 7 +--
 src/mesa/vbo/vbo_exec_array.c | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index 5718ac5..126e4ef 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -524,15 +524,18 @@ TAG(MultiTexCoord4fv)(GLenum target, const GLfloat * v)

 /**
  * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
+ * It depends on a few things, including whether we're inside or outside
+ * of glBegin/glEnd.
  */
 static inline bool
 is_vertex_position(const struct gl_context *ctx, GLuint index)
 {
-   return index == 0 && _mesa_attr_zero_aliases_vertex(ctx);
+   return (index == 0 &&
+   _mesa_attr_zero_aliases_vertex(ctx) &&
+   _mesa_inside_begin_end(ctx));
 }


-
 static void GLAPIENTRY
 TAG(VertexAttrib1fARB)(GLuint index, GLfloat x)
 {
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index edd55ce..e3421fa 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -356,7 +356,7 @@ recalculate_input_bindings(struct gl_context *ctx)
  else if (array[VERT_ATTRIB_POS].Enabled)
 inputs[0] = [VERT_ATTRIB_POS];
  else {
-inputs[0] = >currval[VBO_ATTRIB_POS];
+inputs[0] = >currval[VBO_ATTRIB_GENERIC0];
 const_inputs |= VERT_BIT_POS;
  }

--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: replace gotos with conditionals in array drawing code

2017-08-21 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>



From: Brian Paul <bri...@vmware.com>
Sent: Monday, August 21, 2017 11:55 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: replace gotos with conditionals in array drawing code

No Piglit regressions.
---
 src/gallium/drivers/svga/svga_draw_arrays.c   | 36 +--
 src/gallium/drivers/svga/svga_draw_elements.c | 28 ++---
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c 
b/src/gallium/drivers/svga/svga_draw_arrays.c
index b968fb0..19d5e50 100644
--- a/src/gallium/drivers/svga/svga_draw_arrays.c
+++ b/src/gallium/drivers/svga/svga_draw_arrays.c
@@ -286,25 +286,25 @@ svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl,
  gen_type,
  gen_nr,
  gen_size, gen_func, _buf);
-  if (ret != PIPE_OK)
- goto done;
-
-  pipe_debug_message(>debug.callback, PERF_INFO,
- "generating temporary index buffer for drawing %s",
- u_prim_name(prim));
-
-  ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
-  gen_buf,
-  gen_size,
-  start,
-  0,
-  count - 1,
-  gen_prim, 0, gen_nr,
-  start_instance,
-  instance_count);
-done:
-  if (gen_buf)
+  if (ret == PIPE_OK) {
+ pipe_debug_message(>debug.callback, PERF_INFO,
+"generating temporary index buffer for drawing %s",
+u_prim_name(prim));
+
+ ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
+ gen_buf,
+ gen_size,
+ start,
+ 0,
+ count - 1,
+ gen_prim, 0, gen_nr,
+ start_instance,
+ instance_count);
+  }
+
+  if (gen_buf) {
  pipe_resource_reference(_buf, NULL);
+  }
}

SVGA_STATS_TIME_POP(svga_sws(svga));
diff --git a/src/gallium/drivers/svga/svga_draw_elements.c 
b/src/gallium/drivers/svga/svga_draw_elements.c
index f9bb136..b1db871 100644
--- a/src/gallium/drivers/svga/svga_draw_elements.c
+++ b/src/gallium/drivers/svga/svga_draw_elements.c
@@ -242,21 +242,21 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl,
   prim, gen_prim,
   count, gen_nr, gen_size,
   gen_func, _buf);
-  if (ret != PIPE_OK)
- goto done;
-
-  ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
-  gen_buf,
-  gen_size,
-  index_bias,
-  min_index,
-  max_index,
-  gen_prim, 0, gen_nr,
-  start_instance,
-  instance_count);
-done:
-  if (gen_buf)
+  if (ret == PIPE_OK) {
+ ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
+ gen_buf,
+ gen_size,
+ index_bias,
+ min_index,
+ max_index,
+ gen_prim, 0, gen_nr,
+ start_instance,
+ instance_count);
+  }
+
+  if (gen_buf) {
  pipe_resource_reference(_buf, NULL);
+  }
}

SVGA_STATS_TIME_POP(svga_sws(hwtnl->svga));
--
1.9.1

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


Re: [Mesa-dev] [Mesa-stable] [PATCH] st/mesa: add osmesa framebuffer iface hash table per st manager

2017-08-02 Thread Charmaine Lee

Change looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul
Sent: Wednesday, August 2, 2017 8:30 PM
To: Bruce Cherniak; mesa-dev@lists.freedesktop.org
Cc: 17 . 2; Charmaine Lee
Subject: Re: [Mesa-stable] [PATCH] st/mesa: add osmesa framebuffer iface hash 
table per st manager

I'll let Charmaine review, but the subject line prefix should probably
be "st/osmesa".

-Brian

On 08/02/2017 05:28 PM, Bruce Cherniak wrote:
> Commit bbc29393d3 didn't include osmesa state_tracker.  This patch adds
> necessary initialization.
>
> Fixes crash in OSMesa initialization.
>
> Created-by: Charmaine Lee <charmai...@vmware.com>
> Tested-by: Bruce Cherniak <bruce.chern...@intel.com>
>
> Cc: Charmaine Lee <charmai...@vmware.com>
> Cc: 17.2 <mesa-sta...@lists.freedesktop.org>
> ---
>   src/gallium/state_trackers/osmesa/osmesa.c | 11 +++
>   1 file changed, 11 insertions(+)
>
> diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
> b/src/gallium/state_trackers/osmesa/osmesa.c
> index 18f1b88128..751d255c54 100644
> --- a/src/gallium/state_trackers/osmesa/osmesa.c
> +++ b/src/gallium/state_trackers/osmesa/osmesa.c
> @@ -439,6 +439,7 @@ osmesa_st_framebuffer_validate(struct st_context_iface 
> *stctx,
>  return TRUE;
>   }
>
> +static uint32_t osmesa_fb_ID = 0;
>
>   static struct st_framebuffer_iface *
>   osmesa_create_st_framebuffer(void)
> @@ -448,6 +449,8 @@ osmesa_create_st_framebuffer(void)
> stfbi->flush_front = osmesa_st_framebuffer_flush_front;
> stfbi->validate = osmesa_st_framebuffer_validate;
> p_atomic_set(>stamp, 1);
> +  stfbi->ID = p_atomic_inc_return(_fb_ID);
> +  stfbi->state_manager = get_st_manager();
>  }
>  return stfbi;
>   }
> @@ -508,6 +511,14 @@ osmesa_find_buffer(enum pipe_format color_format,
>   static void
>   osmesa_destroy_buffer(struct osmesa_buffer *osbuffer)
>   {
> +   struct st_api *stapi = get_st_api();
> +
> +   /*
> +* Notify the state manager that the associated framebuffer interface
> +* is no longer valid.
> +*/
> +   stapi->destroy_drawable(stapi, osbuffer->stfb);
> +
>  FREE(osbuffer->stfb);
>  FREE(osbuffer);
>   }
>

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


[Mesa-dev] [PATCH] st/mesa: fix the unconditional return in st_framebuffer_iface_remove

2017-07-25 Thread Charmaine Lee
Fixes: bbc29393d3beaf6344c7188547b4ff61b63946ae
Tested-by: Christoph Haag 
---
 src/mesa/state_tracker/st_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 834bcc9..6447403 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -560,7 +560,7 @@ st_framebuffer_iface_remove(struct st_manager *smapi,
   (struct st_manager_private *)smapi->st_manager_private;
struct hash_entry *entry;
 
-   if (!smPriv || !smPriv->stfbi_ht);
+   if (!smPriv || !smPriv->stfbi_ht)
   return;
 
mtx_lock(>st_mutex);
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] st/mesa: create framebuffer iface hash table per st manager

2017-07-25 Thread Charmaine Lee

>From: James Legg <jl...@feralinteractive.com>
>Sent: Tuesday, July 25, 2017 6:24 AM
>To: mesa-dev@lists.freedesktop.org; Charmaine Lee
>Subject: Re: [Mesa-dev] [PATCH] st/mesa: create framebuffer iface hash table 
>per st manager

>On Sun, 2017-07-23 at 16:37 -0700, Charmaine Lee wrote:
>> With this patch, framebuffer interface hash table is created
>> per state tracker manager.
>>
>> Fixes crash with steam.
>>
>> Bugzilla: 
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid->3D101876=DwICaQ=uilaK90D4TOVoH58JNXRgQ=Ang1qmMo4GwCmRUnLE-f31kqPa6AOnoS->OAMUzQyM0M=2ysMQPCeR_vf9ch72ej4wehfJ99Mtt9hBTroMbybY_o=xmTbTiDE9mV_SwkzVM08KH23S6vuWlerjRkqriB3>QOg=
>> Fixes: 5124bf98239 ("st/mesa: add destroy_drawable interface")
>> Tested-by: Christoph Haag <haa...@frickel.club>

>> --- a/src/mesa/state_tracker/st_manager.c
>>
>> @@ -511,45 +515,63 @@ st_framebuffer_iface_equal(const void *a, const void 
>> *b)
>>
>>
>>  static boolean
>> -st_framebuffer_iface_lookup(const struct st_framebuffer_iface *stfbi)
>> +st_framebuffer_iface_lookup(struct st_manager *smapi,
>> +const struct st_framebuffer_iface *stfbi)
>>  {
>> +   struct st_manager_private *smPriv =
>> +  (struct st_manager_private *)smapi->st_manager_private;
>> struct hash_entry *entry;
>>
>> -   mtx_lock(_mutex);
>> -   entry = _mesa_hash_table_search(st_fbi_ht, stfbi);
>> -   mtx_unlock(_mutex);
>> +   assert(smPriv);
>> +   assert(smPriv->stfbi_ht);
>> +
>> +   mtx_lock(>st_mutex);
>> +   entry = _mesa_hash_table_search(smPriv->stfbi_ht, stfbi);
>> +   mtx_unlock(>st_mutex);
>>
>> return entry != NULL;
>>  }
>>
>>
>>  static boolean
>> -st_framebuffer_iface_insert(struct st_framebuffer_iface *stfbi)
>> +st_framebuffer_iface_insert(struct st_manager *smapi,
>> +struct st_framebuffer_iface *stfbi)
>>  {
>> +   struct st_manager_private *smPriv =
>> +  (struct st_manager_private *)smapi->st_manager_private;
>> struct hash_entry *entry;
>>
>> -   mtx_lock(_mutex);
>> -   entry = _mesa_hash_table_insert(st_fbi_ht, stfbi, stfbi);
>> -   mtx_unlock(_mutex);
>> +   assert(smPriv);
>> +   assert(smPriv->stfbi_ht);
>> +
>> +   mtx_lock(>st_mutex);
>> +   entry = _mesa_hash_table_insert(smPriv->stfbi_ht, stfbi, stfbi);
>> +   mtx_unlock(>st_mutex);
>>
>> return entry != NULL;
>>  }
>>
>>
>>  static void
>> -st_framebuffer_iface_remove(struct st_framebuffer_iface *stfbi)
>> +st_framebuffer_iface_remove(struct st_manager *smapi,
>> +struct st_framebuffer_iface *stfbi)
>>  {
>> +   struct st_manager_private *smPriv =
>> +  (struct st_manager_private *)smapi->st_manager_private;
>> struct hash_entry *entry;
>>
>> -   mtx_lock(_mutex);
>> -   entry = _mesa_hash_table_search(st_fbi_ht, stfbi);
>> +   if (!smPriv || !smPriv->stfbi_ht);
>> +  return;

>The semicolon after the if causes the return to execute
>unconditionally.

Ah, good catch.  Thanks.  Will fix it.

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


Re: [Mesa-dev] [PATCH] st/mesa: add destroy_drawable interface

2017-07-24 Thread Charmaine Lee

Hi Marek,

I have pushed the fix for Steam. Commit bbc29393d3beaf6344c7188547b4ff61b63946ae
should fix the problem.  Can you please try?

-Charmaine

From: Marek Olšák <mar...@gmail.com>
Sent: Monday, July 24, 2017 3:16:07 PM
To: Charmaine Lee
Cc: Christoph Haag; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] st/mesa: add destroy_drawable interface

Hi Charmaine,

Which commits do I need to revert in 17.2 to unbreak Steam on Mesa? I
guess it's more than one.

Thanks,
Marek

On Sat, Jul 22, 2017 at 3:05 AM, Charmaine Lee <charmai...@vmware.com> wrote:
>
> Hi Christoph,
>
> Can you provide an apitrace of the test that crashes?
>
> Thanks.
> -Charmaine
>
> 
> From: mesa-dev <mesa-dev-boun...@lists.freedesktop.org> on behalf of 
> Christoph Haag <haagch+mesa...@frickel.club>
> Sent: Friday, July 21, 2017 4:52:41 PM
> To: mesa-dev@lists.freedesktop.org
> Subject: Re: [Mesa-dev] [PATCH] st/mesa: add destroy_drawable interface
>
> This patch breaks steam for me. Segfault backtrace:
>
> #0  0x0023 in ?? ()
> No symbol table info available.
> #1  0xf6b1a417 in _mesa_hash_table_search (ht=0x585bb7e8, key=0x5820ee88) at 
> hash_table.c:246
> __PRETTY_FUNCTION__ = "_mesa_hash_table_search"
> #2  0xf6a4488e in st_framebuffer_iface_remove (stfbi=0x5820ee88) at 
> state_tracker/st_manager.c:545
> entry = 0xf6bb3038 <swap_fences_unref+86>
> #3  0xf6a448e5 in st_api_destroy_drawable (stapi=0xf7212bc0 , 
> stfbi=0x5820ee88) at state_tracker/st_manager.c:564
> No locals.
> #4  0xf6bb2b64 in dri_destroy_buffer (dPriv=0x57d62560) at dri_drawable.c:186
> drawable = 0x5820ee88
> screen = 0x57e1a0a8
> stapi = 0xf7212bc0 
> i = 7
> #5  0xf6bb132c in dri_put_drawable (pdp=0x57d62560) at dri_util.c:642
> No locals.
> #6  0xf6bb145c in driDestroyDrawable (pdp=0x57d62560) at dri_util.c:695
> No locals.
> #7  0xf759249a in loader_dri3_drawable_fini (draw=0x581fb0f0) at 
> loader_dri3_helper.c:109
> i = 1478471608
> #8  0xf758ca73 in dri3_destroy_drawable (base=0x581fb0d0) at dri3_glx.c:366
> pdraw = 0x581fb0d0
> #9  0xf7583b5a in driReleaseDrawables (gc=0x57e19ef8) at dri_common.c:452
> priv = 0x57e082d0
> pdraw = 0x581fb0d0
> #10 0xf758c679 in dri3_bind_context (context=0x57e19ef8, old=0x57e19ef8, 
> draw=165675047, read=165675047) at dri3_glx.c:223
> pcp = 0x57e19ef8
> psc = 0x57e07608
> pdraw = 0x5866eb28
> pread = 0x5866eb28
> dri_draw = 0x0
> dri_read = 0x0
> #11 0xf754cd12 in MakeContextCurrent (dpy=0x57c16f30, draw=165675047, 
> read=165675047, gc_user=0x57e19ef8) at glxcurrent.c:228
> gc = 0x57e19ef8
> oldGC = 0x57e19ef8
> #12 0xf754ce75 in glXMakeCurrent (dpy=0x57c16f30, draw=165675047, 
> gc=0x57e19ef8) at glxcurrent.c:274
> No locals.
> #13 0xeb48addb in ?? () from 
> /home/chris/.local/share/Steam/ubuntu12_32/vgui2_s.so
> No symbol table info available.
> #14 0xeb48dd0e in ?? () from 
> /home/chris/.local/share/Steam/ubuntu12_32/vgui2_s.so
> No symbol table info available.
> #15 0xeb49d81d in ?? () from 
> /home/chris/.local/share/Steam/ubuntu12_32/vgui2_s.so
> No symbol table info available.
> #16 0xefd74193 in ?? () from 
> /home/chris/.local/share/Steam/ubuntu12_32/steamui.so
> No symbol table info available.
> #17 0xefd76946 in ?? () from 
> /home/chris/.local/share/Steam/ubuntu12_32/steamui.so
> No symbol table info available.
> #18 0xefd77f16 in ?? () from 
> /home/chris/.local/share/Steam/ubuntu12_32/steamui.so
> No symbol table info available.
> #19 0x5663d660 in RunSteam(int, char**, bool) ()
> No symbol table info available.
> #20 0x5663e5f3 in ?? ()
> No symbol table info available.
> #21 0x56629aac in ?? ()
> No symbol table info available.
> #22 0xf799a1d3 in __libc_start_main () from /usr/lib32/libc.so.6
> No symbol table info available.
> #23 0x5662d159 in _start ()
> No symbol table info available.
>
>
> On 20.07.2017 20:26, Charmaine Lee wrote:
>> With this patch, the st manager will maintain a hash table for
>> the active framebuffer interface objects. A destroy_drawable interface
>> is added to allow the state tracker to notify the st manager to remove
>> the associated framebuffer interface object from the hash table,
>> so the associated framebuffer and its resources can be deleted
>> at framebuffers purge time.
>>
>> Fixes bug 101829 "read-after-free in st_framebuffer_validate"
>>
>> Tested-by: Brad King <brad.k...@kitware.com>
>> Tested-by: Gert Wollny <gw.foss...@gma

Re: [Mesa-dev] [PATCH 2/2] svga: implement MSAA alpha_to_one feature

2017-07-24 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Saturday, July 22, 2017 12:24 PM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee; Neha Bhende
>Subject: [PATCH 2/2] svga: implement MSAA alpha_to_one feature

>The device doesn't directly support this feature so we implement it with
>additional shader code which sets the color output(s) w component to
>1.0 (or max_int or max_uint).

>Fixes 16 Piglit ext_framebuffer_multisample/*alpha-to-one* tests.
>---
> src/gallium/drivers/svga/svga_context.h |  1 +
> src/gallium/drivers/svga/svga_pipe_blend.c  |  1 +
> src/gallium/drivers/svga/svga_shader.h  |  3 ++
> src/gallium/drivers/svga/svga_state_fs.c| 18 +
> src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 61 -
> 5 files changed, 83 insertions(+), 1 deletion(-)

...


>diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
>b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
>index 9f5cd4b..8984ce5 100644
>--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
>+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c

...

@@ -6378,6 +6393,47 @@ emit_pre_helpers(struct svga_shader_emitter_v10 *emit)


> /**
>+ * The device has no direct support for the pipe_blend_state::alpha_to_one
>+ * option so we implement it here with shader code.
>+ */
>+static void
>+emit_alpha_to_one_instructions(struct svga_shader_emitter_v10 *emit,
>+   unsigned fs_color_tmp_index)
>+{
>+   unsigned i;
>+
>+   for (i = 0; i < emit->fs.num_color_outputs; i++) {
>+  struct tgsi_full_dst_register color_dst;
>+
>+  if (fs_color_tmp_index != INVALID_INDEX && i == 0) {
>+ /* write to the temp color register */
>+ color_dst = make_dst_temp_reg(fs_color_tmp_index);
>+  }
>+  else {
>+ /* write directly to the color[i] output */
>+ color_dst = make_dst_output_reg(emit->fs.color_out_index[i]);
>+  }
>+
>+  color_dst = writemask_dst(_dst, TGSI_WRITEMASK_W);
>+
>+  /* Depending on type of the render target, we either set alpha/w to
>+   * 1.0f, or max(int) or max(uint).
>+   */
>+  struct tgsi_full_src_register one;
>+  if (emit->key.fs.int_render_target_mask & (1 << i)) {
>+ one = make_immediate_reg_int(emit, 0x8fff);
>+  } else if (emit->key.fs.uint_render_target_mask & (1 << i)) {
>+ one = make_immediate_reg_int(emit, 0x);
>+  } else {
>+ one = make_immediate_reg_float(emit, 1.0f);
>+  }

How about moving the various "make one immediate" outside of the loop?
No need to repeatedly looking for the same immediate.  

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


[Mesa-dev] [PATCH] st/mesa: create framebuffer iface hash table per st manager

2017-07-23 Thread Charmaine Lee
With this patch, framebuffer interface hash table is created
per state tracker manager.

Fixes crash with steam.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101876
Fixes: 5124bf98239 ("st/mesa: add destroy_drawable interface")
Tested-by: Christoph Haag 
---
 src/gallium/include/state_tracker/st_api.h|  21 +
 src/gallium/state_trackers/dri/dri_drawable.c |   1 +
 src/gallium/state_trackers/dri/dri_screen.c   |   3 +
 src/gallium/state_trackers/glx/xlib/xm_api.c  |   3 +
 src/gallium/state_trackers/glx/xlib/xm_st.c   |   1 +
 src/gallium/state_trackers/wgl/stw_device.c   |   3 +
 src/gallium/state_trackers/wgl/stw_st.c   |   1 +
 src/mesa/state_tracker/st_manager.c   | 107 +++---
 8 files changed, 113 insertions(+), 27 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 9b660f7..bc62a69 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -284,6 +284,7 @@ struct st_context_attribs
 };
 
 struct st_context_iface;
+struct st_manager;
 
 /**
  * Represent a windowing system drawable.
@@ -317,6 +318,11 @@ struct st_framebuffer_iface
uint32_t ID;
 
/**
+* The state tracker manager that manages this object.
+*/
+   struct st_manager *state_manager;
+
+   /**
 * Available for the state tracker manager to use.
 */
void *st_manager_private;
@@ -376,6 +382,11 @@ struct st_context_iface
void *st_manager_private;
 
/**
+* The state tracker manager that manages this object.
+*/
+   struct st_manager *state_manager;
+
+   /**
 * The CSO context associated with this context in case we need to draw
 * something before swap buffers.
 */
@@ -483,6 +494,16 @@ struct st_manager
 */
void (*set_background_context)(struct st_context_iface *stctxi,
   struct util_queue_monitoring *queue_info);
+
+   /**
+* Destroy any private data used by the state tracker manager.
+*/
+   void (*destroy)(struct st_manager *smapi);
+
+   /**
+* Available for the state tracker manager to use.
+*/
+   void *st_manager_private;
 };
 
 /**
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index c7df0f6..9e0dd6b 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -158,6 +158,7 @@ dri_create_buffer(__DRIscreen * sPriv,
dPriv->driverPrivate = (void *)drawable;
p_atomic_set(>base.stamp, 1);
drawable->base.ID = p_atomic_inc_return(_ID);
+   drawable->base.state_manager = >base;
 
return GL_TRUE;
 fail:
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 1dd7bd3..59a850b 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -457,6 +457,9 @@ dri_destroy_option_cache(struct dri_screen * screen)
 void
 dri_destroy_screen_helper(struct dri_screen * screen)
 {
+   if (screen->base.destroy)
+  screen->base.destroy(>base);
+
if (screen->st_api && screen->st_api->destroy)
   screen->st_api->destroy(screen->st_api);
 
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c 
b/src/gallium/state_trackers/glx/xlib/xm_api.c
index e4b1e9d..828253b 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -181,6 +181,9 @@ xmesa_close_display(Display *display)
 *xmdpy->screen->destroy(xmdpy->screen);
 * }
 */
+
+   if (xmdpy->smapi->destroy)
+  xmdpy->smapi->destroy(xmdpy->smapi);
free(xmdpy->smapi);
 
XFree((char *) info);
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c 
b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 6a0f4aa..0c42e65 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -304,6 +304,7 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer 
b)
stfbi->flush_front = xmesa_st_framebuffer_flush_front;
stfbi->validate = xmesa_st_framebuffer_validate;
stfbi->ID = p_atomic_inc_return(_stfbi_ID);
+   stfbi->state_manager = xmdpy->smapi;
p_atomic_set(>stamp, 1);
stfbi->st_manager_private = (void *) xstfb;
 
diff --git a/src/gallium/state_trackers/wgl/stw_device.c 
b/src/gallium/state_trackers/wgl/stw_device.c
index 6c0f14d..b88e110 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -199,6 +199,9 @@ stw_cleanup(void)
DeleteCriticalSection(_dev->fb_mutex);
DeleteCriticalSection(_dev->ctx_mutex);
 
+   if (stw_dev->smapi->destroy)
+  stw_dev->smapi->destroy(stw_dev->smapi);
+
FREE(stw_dev->smapi);
stw_dev->stapi->destroy(stw_dev->stapi);
 
diff --git a/src/gallium/state_trackers/wgl/stw_st.c 
b/src/gallium/state_trackers/wgl/stw_st.c
index 

Re: [Mesa-dev] [PATCH] st/mesa: add destroy_drawable interface

2017-07-21 Thread Charmaine Lee

Hi Christoph,

Can you provide an apitrace of the test that crashes?

Thanks.
-Charmaine


From: mesa-dev <mesa-dev-boun...@lists.freedesktop.org> on behalf of Christoph 
Haag <haagch+mesa...@frickel.club>
Sent: Friday, July 21, 2017 4:52:41 PM
To: mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] st/mesa: add destroy_drawable interface

This patch breaks steam for me. Segfault backtrace:

#0  0x0023 in ?? ()
No symbol table info available.
#1  0xf6b1a417 in _mesa_hash_table_search (ht=0x585bb7e8, key=0x5820ee88) at 
hash_table.c:246
__PRETTY_FUNCTION__ = "_mesa_hash_table_search"
#2  0xf6a4488e in st_framebuffer_iface_remove (stfbi=0x5820ee88) at 
state_tracker/st_manager.c:545
entry = 0xf6bb3038 <swap_fences_unref+86>
#3  0xf6a448e5 in st_api_destroy_drawable (stapi=0xf7212bc0 , 
stfbi=0x5820ee88) at state_tracker/st_manager.c:564
No locals.
#4  0xf6bb2b64 in dri_destroy_buffer (dPriv=0x57d62560) at dri_drawable.c:186
drawable = 0x5820ee88
screen = 0x57e1a0a8
stapi = 0xf7212bc0 
i = 7
#5  0xf6bb132c in dri_put_drawable (pdp=0x57d62560) at dri_util.c:642
No locals.
#6  0xf6bb145c in driDestroyDrawable (pdp=0x57d62560) at dri_util.c:695
No locals.
#7  0xf759249a in loader_dri3_drawable_fini (draw=0x581fb0f0) at 
loader_dri3_helper.c:109
i = 1478471608
#8  0xf758ca73 in dri3_destroy_drawable (base=0x581fb0d0) at dri3_glx.c:366
pdraw = 0x581fb0d0
#9  0xf7583b5a in driReleaseDrawables (gc=0x57e19ef8) at dri_common.c:452
priv = 0x57e082d0
pdraw = 0x581fb0d0
#10 0xf758c679 in dri3_bind_context (context=0x57e19ef8, old=0x57e19ef8, 
draw=165675047, read=165675047) at dri3_glx.c:223
pcp = 0x57e19ef8
psc = 0x57e07608
pdraw = 0x5866eb28
pread = 0x5866eb28
dri_draw = 0x0
dri_read = 0x0
#11 0xf754cd12 in MakeContextCurrent (dpy=0x57c16f30, draw=165675047, 
read=165675047, gc_user=0x57e19ef8) at glxcurrent.c:228
gc = 0x57e19ef8
oldGC = 0x57e19ef8
#12 0xf754ce75 in glXMakeCurrent (dpy=0x57c16f30, draw=165675047, 
gc=0x57e19ef8) at glxcurrent.c:274
No locals.
#13 0xeb48addb in ?? () from 
/home/chris/.local/share/Steam/ubuntu12_32/vgui2_s.so
No symbol table info available.
#14 0xeb48dd0e in ?? () from 
/home/chris/.local/share/Steam/ubuntu12_32/vgui2_s.so
No symbol table info available.
#15 0xeb49d81d in ?? () from 
/home/chris/.local/share/Steam/ubuntu12_32/vgui2_s.so
No symbol table info available.
#16 0xefd74193 in ?? () from 
/home/chris/.local/share/Steam/ubuntu12_32/steamui.so
No symbol table info available.
#17 0xefd76946 in ?? () from 
/home/chris/.local/share/Steam/ubuntu12_32/steamui.so
No symbol table info available.
#18 0xefd77f16 in ?? () from 
/home/chris/.local/share/Steam/ubuntu12_32/steamui.so
No symbol table info available.
#19 0x5663d660 in RunSteam(int, char**, bool) ()
No symbol table info available.
#20 0x5663e5f3 in ?? ()
No symbol table info available.
#21 0x56629aac in ?? ()
No symbol table info available.
#22 0xf799a1d3 in __libc_start_main () from /usr/lib32/libc.so.6
No symbol table info available.
#23 0x5662d159 in _start ()
No symbol table info available.


On 20.07.2017 20:26, Charmaine Lee wrote:
> With this patch, the st manager will maintain a hash table for
> the active framebuffer interface objects. A destroy_drawable interface
> is added to allow the state tracker to notify the st manager to remove
> the associated framebuffer interface object from the hash table,
> so the associated framebuffer and its resources can be deleted
> at framebuffers purge time.
>
> Fixes bug 101829 "read-after-free in st_framebuffer_validate"
>
> Tested-by: Brad King <brad.k...@kitware.com>
> Tested-by: Gert Wollny <gw.foss...@gmail.com>
> ---
>  src/gallium/include/state_tracker/st_api.h|  7 ++
>  src/gallium/state_trackers/dri/dri_drawable.c |  6 +-
>  src/gallium/state_trackers/glx/xlib/xm_api.c  |  5 ++
>  src/gallium/state_trackers/glx/xlib/xm_st.c   |  2 +
>  src/gallium/state_trackers/wgl/stw_st.c   |  6 +-
>  src/mesa/state_tracker/st_manager.c   | 95 
> ++-
>  src/mesa/state_tracker/st_manager.h   |  5 ++
>  7 files changed, 123 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/include/state_tracker/st_api.h 
> b/src/gallium/include/state_tracker/st_api.h
> index 30a4866..9b660f7 100644
> --- a/src/gallium/include/state_tracker/st_api.h
> +++ b/src/gallium/include/state_tracker/st_api.h
> @@ -552,6 +552,13 @@ struct st_api
>  * Get the currently bound context in the calling thread.
>  */
> struct st_context_iface *(*get_current)(struct st_api *stapi);
> +
> +   /**
> +* Notify the st manager the framebuffer interface object
> +* is no longer valid.
> +*/
>

Re: [Mesa-dev] [PATCH] svga: only support 4x, 8x, 16x msaa

2017-07-20 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Thursday, July 20, 2017 1:54 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: only support 4x, 8x, 16x msaa

Skip 2x MSAA, for example, since it's seldom used and just bloats
the list of pixel formats.
---
 src/gallium/drivers/svga/svga_screen.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index 1ec91e5..77223c9 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -1116,6 +1116,11 @@ svga_screen_create(struct svga_winsys_screen *sws)
 get_uint_cap(sws, SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES, 0);
   }

+  /* We only support 4x, 8x, 16x MSAA */
+  svgascreen->ms_samples &= ((1 << (4-1)) |
+ (1 << (8-1)) |
+ (1 << (16-1)));
+
   /* Maximum number of constant buffers */
   svgascreen->max_const_buffers =
  get_uint_cap(sws, SVGA3D_DEVCAP_DX_MAX_CONSTANT_BUFFERS, 1);
--
1.9.1

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


[Mesa-dev] [PATCH] st/mesa: add destroy_drawable interface

2017-07-20 Thread Charmaine Lee
With this patch, the st manager will maintain a hash table for
the active framebuffer interface objects. A destroy_drawable interface
is added to allow the state tracker to notify the st manager to remove
the associated framebuffer interface object from the hash table,
so the associated framebuffer and its resources can be deleted
at framebuffers purge time.

Fixes bug 101829 "read-after-free in st_framebuffer_validate"

Tested-by: Brad King 
Tested-by: Gert Wollny 
---
 src/gallium/include/state_tracker/st_api.h|  7 ++
 src/gallium/state_trackers/dri/dri_drawable.c |  6 +-
 src/gallium/state_trackers/glx/xlib/xm_api.c  |  5 ++
 src/gallium/state_trackers/glx/xlib/xm_st.c   |  2 +
 src/gallium/state_trackers/wgl/stw_st.c   |  6 +-
 src/mesa/state_tracker/st_manager.c   | 95 ++-
 src/mesa/state_tracker/st_manager.h   |  5 ++
 7 files changed, 123 insertions(+), 3 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 30a4866..9b660f7 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -552,6 +552,13 @@ struct st_api
 * Get the currently bound context in the calling thread.
 */
struct st_context_iface *(*get_current)(struct st_api *stapi);
+
+   /**
+* Notify the st manager the framebuffer interface object
+* is no longer valid.
+*/
+   void (*destroy_drawable)(struct st_api *stapi,
+struct st_framebuffer_iface *stfbi);
 };
 
 /**
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index 0cfdc30..c7df0f6 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -169,6 +169,8 @@ void
 dri_destroy_buffer(__DRIdrawable * dPriv)
 {
struct dri_drawable *drawable = dri_drawable(dPriv);
+   struct dri_screen *screen = drawable->screen;
+   struct st_api *stapi = screen->st_api;
int i;
 
pipe_surface_reference(>drisw_surface, NULL);
@@ -180,7 +182,9 @@ dri_destroy_buffer(__DRIdrawable * dPriv)
 
swap_fences_unref(drawable);
 
-   drawable->base.ID = 0;
+   /* Notify the st manager that this drawable is no longer valid */
+   stapi->destroy_drawable(stapi, >base);
+
FREE(drawable);
 }
 
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c 
b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 881dd44..e4b1e9d 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -595,6 +595,11 @@ xmesa_free_buffer(XMesaBuffer buffer)
   */
  b->ws.drawable = 0;
 
+ /* Notify the st manager that the associated framebuffer interface
+  * object is no longer valid.
+  */
+ stapi->destroy_drawable(stapi, buffer->stfb);
+
  /* XXX we should move the buffer to a delete-pending list and destroy
   * the buffer until it is no longer current.
   */
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c 
b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 9e30efa..6a0f4aa 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -273,6 +273,7 @@ xmesa_st_framebuffer_flush_front(struct st_context_iface 
*stctx,
return ret;
 }
 
+static uint32_t xmesa_stfbi_ID = 0;
 
 struct st_framebuffer_iface *
 xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b)
@@ -302,6 +303,7 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer 
b)
stfbi->visual = >stvis;
stfbi->flush_front = xmesa_st_framebuffer_flush_front;
stfbi->validate = xmesa_st_framebuffer_validate;
+   stfbi->ID = p_atomic_inc_return(_stfbi_ID);
p_atomic_set(>stamp, 1);
stfbi->st_manager_private = (void *) xstfb;
 
diff --git a/src/gallium/state_trackers/wgl/stw_st.c 
b/src/gallium/state_trackers/wgl/stw_st.c
index c2844b0..85a8b17 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -256,7 +256,11 @@ stw_st_destroy_framebuffer_locked(struct 
st_framebuffer_iface *stfb)
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
   pipe_resource_reference(>textures[i], NULL);
 
-   stwfb->base.ID = 0;
+   /* Notify the st manager that the framebuffer interface is no
+* longer valid.
+*/
+   stw_dev->stapi->destroy_drawable(stw_dev->stapi, >base);
+
FREE(stwfb);
 }
 
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index cb816de..ebc7ca8 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -38,6 +38,7 @@
 #include "main/fbobject.h"
 #include "main/renderbuffer.h"
 #include "main/version.h"
+#include "util/hash_table.h"
 #include "st_texture.h"
 
 #include "st_context.h"
@@ -59,6 +60,10 @@
 #include "util/u_surface.h"
 #include "util/list.h"
 

[Mesa-dev] [PATCH] st/mesa: init winsys buffers list only if context creation succeeds

2017-07-17 Thread Charmaine Lee
Fixes piglit test crash when context creation fails.

v2: As suggested by Brian, move the init to st_create_context_priv()
---
 src/mesa/state_tracker/st_context.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index 560d94e..381ff9d 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -476,6 +476,9 @@ st_create_context_priv( struct gl_context *ctx, struct 
pipe_context *pipe,
_mesa_initialize_vbo_vtxfmt(ctx);
st_init_driver_flags(st);
 
+   /* Initialize context's winsys buffers list */
+   LIST_INITHEAD(>winsys_buffers);
+
return st;
 }
 
@@ -576,9 +579,6 @@ struct st_context *st_create_context(gl_api api, struct 
pipe_context *pipe,
   _mesa_destroy_context(ctx);
}
 
-   /* Initialize context's winsys buffers list */
-   LIST_INITHEAD(>winsys_buffers);
-
return st;
 }
 
-- 
1.9.1

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


[Mesa-dev] [PATCH] st/mesa: init winsys buffers list only if context creation succeeds

2017-07-17 Thread Charmaine Lee
Fixes piglit test crash when context creation fails.
---
 src/mesa/state_tracker/st_context.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index 560d94e..8eccad6 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -574,11 +574,11 @@ struct st_context *st_create_context(gl_api api, struct 
pipe_context *pipe,
st = st_create_context_priv(ctx, pipe, options, no_error);
if (!st) {
   _mesa_destroy_context(ctx);
+   } else {
+  /* Initialize context's winsys buffers list */
+  LIST_INITHEAD(>winsys_buffers);
}
 
-   /* Initialize context's winsys buffers list */
-   LIST_INITHEAD(>winsys_buffers);
-
return st;
 }
 
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] st/mesa: handle stfbi being NULL on entry of st_framebuffer_reuse_or_create

2017-07-13 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Lucas Stach <l.st...@pengutronix.de>
Sent: Thursday, July 13, 2017 10:01 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] st/mesa: handle stfbi being NULL on entry of 
st_framebuffer_reuse_or_create

Apparently this can happen. Just bail out early in that case, as all the called
functions return NULL in that case.

Fixes weston-terminal for me.

Fixes: 147d7fb772a7 ("st/mesa: add a winsys buffers list in st_context")
Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
---
 src/mesa/state_tracker/st_manager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 348b456c4d1d..d910eec00a16 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -788,6 +788,9 @@ st_framebuffer_reuse_or_create(struct st_context *st,
 {
struct st_framebuffer *cur = NULL, *stfb = NULL;

+   if (!stfbi)
+   return NULL;
+
/* Check if there is already a framebuffer object for the specified
 * framebuffer interface in this context. If there is one, use it.
 */
--
2.11.0

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


Re: [Mesa-dev] [PATCH] st/mesa: Handle st_framebuffer_create returning NULL

2017-07-13 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Michel Dänzer <mic...@daenzer.net>
Sent: Thursday, July 13, 2017 12:21 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] st/mesa: Handle st_framebuffer_create returning NULL

From: Michel Dänzer <michel.daen...@amd.com>

st_framebuffer_create returns NULL if stfbi == NULL or
st_framebuffer_add_renderbuffer returns false for the colour buffer.

Fixes Xorg crashing on startup using glamor on radeonsi.

Fixes: 147d7fb772a7 ("st/mesa: add a winsys buffers list in st_context")
Bugzilla: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D101775=DwIDaQ=uilaK90D4TOVoH58JNXRgQ=Ang1qmMo4GwCmRUnLE-f31kqPa6AOnoS-OAMUzQyM0M=UEU3ibcz-_bgA7gbDqxCJ-TuosvjQ-3MVZhk0YlAaHM=m4MMnUdTtDoBav5jZlfidkkA0ORGokAl9-djnste8Hw=
Signed-off-by: Michel Dänzer <michel.daen...@amd.com>
---
 src/mesa/state_tracker/st_manager.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index de16a3a2cf..348b456c4d 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -802,10 +802,12 @@ st_framebuffer_reuse_or_create(struct st_context *st,
if (stfb == NULL) {
   cur = st_framebuffer_create(st, stfbi);

-  /* add to the context's winsys buffers list */
-  LIST_ADD(>head, >winsys_buffers);
+  if (cur) {
+ /* add to the context's winsys buffers list */
+ LIST_ADD(>head, >winsys_buffers);

-  st_framebuffer_reference(, cur);
+ st_framebuffer_reference(, cur);
+  }
}

return stfb;
--
2.13.2

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


Re: [Mesa-dev] [PATCH] draw: s/unsigned/enum tgsi_semantic/

2017-07-12 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, July 12, 2017 9:28 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] draw: s/unsigned/enum tgsi_semantic/

---
 src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 4 ++--
 src/gallium/auxiliary/draw/draw_vs_exec.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c 
b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index adb6120..1329ab4 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -76,7 +76,7 @@ struct widepoint_stage {
uint texcoord_gen_slot[PIPE_MAX_SHADER_OUTPUTS];

/* TGSI_SEMANTIC to which sprite_coord_enable applies */
-   unsigned sprite_coord_semantic;
+   enum tgsi_semantic sprite_coord_semantic;

int psize_slot;
 };
@@ -242,7 +242,7 @@ widepoint_first_point(struct draw_stage *stage,
*/
   for (i = 0; i < fs->info.num_inputs; i++) {
  int slot;
- const unsigned sn = fs->info.input_semantic_name[i];
+ const enum tgsi_semantic sn = fs->info.input_semantic_name[i];
  const unsigned si = fs->info.input_semantic_index[i];

  if (sn == wide->sprite_coord_semantic) {
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c 
b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 5125eb4..9e1db4a 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -169,7 +169,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
*/
   for (j = 0; j < max_vertices; j++) {
  for (slot = 0; slot < shader->info.num_outputs; slot++) {
-unsigned name = shader->info.output_semantic_name[slot];
+enum tgsi_semantic name = shader->info.output_semantic_name[slot];
 if(clamp_vertex_color &&
   (name == TGSI_SEMANTIC_COLOR || name == 
TGSI_SEMANTIC_BCOLOR))
 {
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: move comment, declaration in svga_init_shader_key_common()

2017-07-12 Thread Charmaine Lee
Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, July 12, 2017 9:28 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: move comment, declaration in 
svga_init_shader_key_common()

put the comment before the relevant code.  Move declaration of
swizzle_tab var to where it's used.
---
 src/gallium/drivers/svga/svga_shader.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_shader.c 
b/src/gallium/drivers/svga/svga_shader.c
index 5ff6f03..74c829e 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -192,7 +192,6 @@ svga_init_shader_key_common(const struct svga_context *svga,
 struct svga_compile_key *key)
 {
unsigned i, idx = 0;
-   const enum pipe_swizzle *swizzle_tab;

assert(shader < ARRAY_SIZE(svga->curr.num_sampler_views));

@@ -224,16 +223,16 @@ svga_init_shader_key_common(const struct svga_context 
*svga,
 }
  }

- swizzle_tab = (view->texture->target != PIPE_BUFFER &&
-!util_format_has_alpha(view->format) &&
-svga_texture_device_format_has_alpha(view->texture)) ?
-set_alpha : copy_alpha;
-
  /* If we have a non-alpha view into an svga3d surface with an
   * alpha channel, then explicitly set the alpha channel to 1
   * when sampling. Note that we need to check the
   * actual device format to cover also imported surface cases.
   */
+ const enum pipe_swizzle *swizzle_tab =
+(view->texture->target != PIPE_BUFFER &&
+ !util_format_has_alpha(view->format) &&
+ svga_texture_device_format_has_alpha(view->texture)) ?
+set_alpha : copy_alpha;

  key->tex[i].swizzle_r = swizzle_tab[view->swizzle_r];
  key->tex[i].swizzle_g = swizzle_tab[view->swizzle_g];
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: fix texture swizzle writemasking

2017-07-11 Thread Charmaine Lee

Looks good.  Thanks for the quick fix.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, July 11, 2017 2:02 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: fix texture swizzle writemasking

Commit bfe1e7737a76e3b046 changed how texture swizzles are set up.
This exposed a latent bug in the VMware driver: we were ignoring
the texture instruction's writemask when applying the 0 and 1
swizzle terms.

This wasn't caught by the Piglit texture swizzle test because it
only exercises fixed function (no write masking).

Fixes issues seen with ETQW apitrace.
---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index d29ac28..77911ad 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -5047,6 +5047,7 @@ end_tex_swizzle(struct svga_shader_emitter_v10 *emit,
  ((swz_g == PIPE_SWIZZLE_0) << 1) |
  ((swz_b == PIPE_SWIZZLE_0) << 2) |
  ((swz_a == PIPE_SWIZZLE_0) << 3));
+  writemask_0 &= swz->inst_dst->Register.WriteMask;

   if (writemask_0) {
  struct tgsi_full_src_register zero = int_tex ?
@@ -5066,6 +5067,8 @@ end_tex_swizzle(struct svga_shader_emitter_v10 *emit,
  ((swz_b == PIPE_SWIZZLE_1) << 2) |
  ((swz_a == PIPE_SWIZZLE_1) << 3));

+  writemask_1 &= swz->inst_dst->Register.WriteMask;
+
   if (writemask_1) {
  struct tgsi_full_src_register one = int_tex ?
 make_immediate_reg_int(emit, 1) :
--
1.9.1

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


[Mesa-dev] [PATCH] st/mesa: add a winsys buffers list in st_context

2017-07-11 Thread Charmaine Lee
Commit a5e733c6b52e93de3000647d075f5ca2f55fcb71 fixes the dangling
framebuffer object by unreferencing the window system draw/read buffers
when context is released. However this can prematurely destroy the
resources associated with these window system buffers. The problem is
reproducible with Turbine Demo running with VMware driver. In this case,
the depth buffer content was lost when the context is rebound to a
drawable.

To prevent premature destroy of the resources associated with
window system buffers, this patch maintains a list of these buffers in
the context, making sure the reference counts of these buffers will not
reach zero until the associated framebuffer interface objects no
longer exist. This also helps to avoid unnecessary destruction and
re-construction of the resources associated with the framebuffer.

Fixes VMware bug 1909807.
---
 src/gallium/include/state_tracker/st_api.h|  5 +++
 src/gallium/state_trackers/dri/dri_drawable.c |  4 ++
 src/gallium/state_trackers/wgl/stw_st.c   |  4 +-
 src/mesa/state_tracker/st_context.c   | 22 ++
 src/mesa/state_tracker/st_context.h   |  7 
 src/mesa/state_tracker/st_manager.c   | 59 ++-
 src/mesa/state_tracker/st_manager.h   |  4 ++
 7 files changed, 94 insertions(+), 11 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index d641092..3fd5f01 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -311,6 +311,11 @@ struct st_framebuffer_iface
int32_t stamp;
 
/**
+* Identifier that uniquely identifies the framebuffer interface object.
+*/
+   uint32_t ID;
+
+   /**
 * Available for the state tracker manager to use.
 */
void *st_manager_private;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index 3c2e307..0cfdc30 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -38,6 +38,8 @@
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 
+static uint32_t drifb_ID = 0;
+
 static void
 swap_fences_unref(struct dri_drawable *draw);
 
@@ -155,6 +157,7 @@ dri_create_buffer(__DRIscreen * sPriv,
 
dPriv->driverPrivate = (void *)drawable;
p_atomic_set(>base.stamp, 1);
+   drawable->base.ID = p_atomic_inc_return(_ID);
 
return GL_TRUE;
 fail:
@@ -177,6 +180,7 @@ dri_destroy_buffer(__DRIdrawable * dPriv)
 
swap_fences_unref(drawable);
 
+   drawable->base.ID = 0;
FREE(drawable);
 }
 
diff --git a/src/gallium/state_trackers/wgl/stw_st.c 
b/src/gallium/state_trackers/wgl/stw_st.c
index 7806a2a..c2844b0 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -46,7 +46,7 @@ struct stw_st_framebuffer {
unsigned texture_mask;
 };
 
-
+static uint32_t stwfb_ID = 0;
 
 /**
  * Is the given mutex held by the calling thread?
@@ -234,6 +234,7 @@ stw_st_create_framebuffer(struct stw_framebuffer *fb)
 
stwfb->fb = fb;
stwfb->stvis = fb->pfi->stvis;
+   stwfb->base.ID = p_atomic_inc_return(_ID);
 
stwfb->base.visual = >stvis;
p_atomic_set(>base.stamp, 1);
@@ -255,6 +256,7 @@ stw_st_destroy_framebuffer_locked(struct 
st_framebuffer_iface *stfb)
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
   pipe_resource_reference(>textures[i], NULL);
 
+   stwfb->base.ID = 0;
FREE(stwfb);
 }
 
diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index f535139..fb0182f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -38,6 +38,7 @@
 #include "program/prog_cache.h"
 #include "vbo/vbo.h"
 #include "glapi/glapi.h"
+#include "st_manager.h"
 #include "st_context.h"
 #include "st_debug.h"
 #include "st_cb_bitmap.h"
@@ -571,6 +572,9 @@ struct st_context *st_create_context(gl_api api, struct 
pipe_context *pipe,
   _mesa_destroy_context(ctx);
}
 
+   /* Initialize context's winsys buffers list */
+   LIST_INITHEAD(>winsys_buffers);
+
return st;
 }
 
@@ -591,6 +595,19 @@ destroy_tex_sampler_cb(GLuint id, void *data, void 
*userData)
 void st_destroy_context( struct st_context *st )
 {
struct gl_context *ctx = st->ctx;
+   struct st_framebuffer *stfb, *next;
+
+   GET_CURRENT_CONTEXT(curctx);
+   if (curctx == NULL) {
+  boolean ret;
+
+  /* No current context, but we need one to release
+   * renderbuffer surface when we release framebuffer.
+   * So temporarily bind the context.
+   */
+  ret = _mesa_make_current(ctx, NULL, NULL);
+  (void) ret;
+   }
 
/* This must be called first so that glthread has a chance to finish */
_mesa_glthread_destroy(ctx);
@@ -604,6 +621,11 @@ void st_destroy_context( struct st_context *st )
st_reference_prog(st, >tep, NULL);
st_reference_compprog(st, >cp, NULL);
 
+   /* release framebuffer in the 

Re: [Mesa-dev] [PATCH 5/5] svga: s/unsigned/enum tgsi_texture_type/

2017-07-10 Thread Charmaine Lee

Series looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Monday, July 10, 2017 2:50:25 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 5/5] svga: s/unsigned/enum tgsi_texture_type/

---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index bbaad20..d29ac28 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -2955,7 +2955,8 @@ emit_sampler_declarations(struct svga_shader_emitter_v10 
*emit)
  * Translate TGSI_TEXTURE_x to VGAPU10_RESOURCE_DIMENSION_x.
  */
 static unsigned
-tgsi_texture_to_resource_dimension(unsigned target, boolean is_array)
+tgsi_texture_to_resource_dimension(enum tgsi_texture_type target,
+   boolean is_array)
 {
switch (target) {
case TGSI_TEXTURE_BUFFER:
@@ -4867,7 +4868,7 @@ setup_texcoord(struct svga_shader_emitter_v10 *emit,
  */
 static void
 emit_tex_compare_refcoord(struct svga_shader_emitter_v10 *emit,
-  unsigned target,
+  enum tgsi_texture_type target,
   const struct tgsi_full_src_register *coord)
 {
struct tgsi_full_src_register coord_src_ref;
@@ -4901,7 +4902,7 @@ struct tex_swizzle_info
boolean swizzled;
boolean shadow_compare;
unsigned unit;
-   unsigned texture_target;  /**< TGSI_TEXTURE_x */
+   enum tgsi_texture_type texture_target;  /**< TGSI_TEXTURE_x */
struct tgsi_full_src_register tmp_src;
struct tgsi_full_dst_register tmp_dst;
const struct tgsi_full_dst_register *inst_dst;
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: fix PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE value

2017-07-10 Thread Charmaine Lee

Reviewed-by :Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Monday, July 10, 2017 7:40 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; mesa-sta...@lists.freedesktop.org
Subject: [PATCH] svga: fix PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE value

This query is supposed to return the max texture buffer size/width in
texels, not size in bytes.  Divide by 16 (the largest format size) to
return texels.

Fixes Piglit arb_texture_buffer_object-max-size test.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/gallium/drivers/svga/svga_screen.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index 0b63525..f40d151 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -312,7 +312,10 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
   return svgascreen->ms_samples ? 1 : 0;

case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
-  return SVGA3D_DX_MAX_RESOURCE_SIZE;
+  /* convert bytes to texels for the case of the largest texel
+   * size: float[4].
+   */
+  return SVGA3D_DX_MAX_RESOURCE_SIZE / (4 * sizeof(float));

case PIPE_CAP_MIN_TEXEL_OFFSET:
   return sws->have_vgpu10 ? VGPU10_MIN_TEXEL_FETCH_OFFSET : 0;
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: fix breakage in create_backed_surface_view()

2017-07-10 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Sunday, July 9, 2017 1:00 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] svga: fix breakage in create_backed_surface_view()

This fixes a regression in some piglit tests since commit 5e5d5f1a2eb.
I think I mis-resolved the merge conflict when cherry-picking that
commit to master.
---
 src/gallium/drivers/svga/svga_surface.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_surface.c 
b/src/gallium/drivers/svga/svga_surface.c
index 1f50b9c..d7c9850 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -446,6 +446,8 @@ create_backed_surface_view(struct svga_context *svga, 
struct svga_surface *s)
  goto done;

   s->backed = svga_surface(backed_view);
+
+  SVGA_STATS_TIME_POP(svga_sws(svga));
}
else if (s->backed->age < tex->age) {
   /*
@@ -474,12 +476,9 @@ create_backed_surface_view(struct svga_context *svga, 
struct svga_surface *s)
 bs->key.numMipLevels,
 bs->key.numFaces * bs->key.arraySize,
 zslice, s->base.u.tex.level, layer);
-
-  svga_mark_surface_dirty(>backed->base);
-
-  SVGA_STATS_TIME_POP(svga_sws(svga));
}

+   svga_mark_surface_dirty(>backed->base);
s->backed->age = tex->age;

 done:
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] mesa: finish implementing glPrimitiveRestartNV() for display lists

2017-07-07 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Friday, July 7, 2017 7:10 AM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee; Neha Bhende; Olivier Lauffenburger
>Subject: [PATCH 2/2] mesa: finish implementing glPrimitiveRestartNV() for 
>display lists

>If we try to build a display list with just a glPrimitiveRestartNV()
>call, we'd crash because of a null GLvertexformat::PrimitiveRestartNV
>pointer.  This change fixes that case.

>The previous patch fixed the case of calling glPrimitiveRestartNV()
>inside a glBegin/End pair.
>---
> src/mesa/main/dlist.c | 27 ++-
> 1 file changed, 26 insertions(+), 1 deletion(-)

>diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 9e817be..6e334fd 100644
>--- a/src/mesa/main/dlist.c
>+++ b/src/mesa/main/dlist.c
>@@ -325,7 +325,8 @@ typedef enum
>OPCODE_STENCIL_FUNC_SEPARATE,
>OPCODE_STENCIL_OP_SEPARATE,
>OPCODE_STENCIL_MASK_SEPARATE,
>-
>+   /* GL_NV_primitive_restart */
>+   OPCODE_PRIMITIVE_RESTART_NV,
>/* GL_ARB_shader_objects */
>OPCODE_USE_PROGRAM,
>OPCODE_UNIFORM_1F,
>@@ -6095,6 +6096,24 @@ save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
> }

> static void GLAPIENTRY
>+save_PrimitiveRestartNV(void)
>+{
>+   /* Note: this is used when outside a glBegin/End pair in a display list */
>+   GET_CURRENT_CONTEXT(ctx);
>+   Node *n;
>+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
>+   n = alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
>+   if (n) {
>+  /* nothing */
>+   }

Can you remove this if clause since it is not doing anything?

>+   if (ctx->ExecuteFlag) {
>+  CALL_PrimitiveRestartNV(ctx->Exec, ());
>+   }
>+
>+}
>+
>+
>+static void GLAPIENTRY
> save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
>GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
> GLbitfield mask, GLenum filter)
>@@ -8670,6 +8689,10 @@ execute_list(struct gl_context *ctx, GLuint list)
> n[5].i, n[6].i, n[7].i, 
> n[8].i,
> n[9].i, n[10].e));
> break;
>+ case OPCODE_PRIMITIVE_RESTART_NV:
>+CALL_PrimitiveRestartNV(ctx->Exec, ());
>+break;
>+
>  case OPCODE_USE_PROGRAM:
> CALL_UseProgram(ctx->Exec, (n[1].ui));
> break;
>@@ -10460,6 +10483,8 @@ save_vtxfmt_init(GLvertexformat * vfmt)
>vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
>    vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
>vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
>+
>+   vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
> }


For this series,  Reviewed-by: Charmaine Lee <charmai...@vmware.com>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] svga: adjust line subpixel position for HWv8

2017-07-07 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, July 5, 2017 7:56 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: adjust line subpixel position for HWv8

This fixes two regressions on HWv8:
  Piglit gl-1.0-ortho-pos
  Piglit/glean fbo
This was caused by commit c2b92dada076a "svga: clamp device line width
to at least 1 to fix HWv8 line stippling"

This also fixes two conform tests: Vertex Order and Polygon Face

No Piglit/conform changes with HWv9 or later.

VMware bug 1905053
---
 src/gallium/drivers/svga/svga_state_framebuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c 
b/src/gallium/drivers/svga/svga_state_framebuffer.c
index bb92c54..c52b7ee 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -561,7 +561,7 @@ emit_viewport( struct svga_context *svga,
 break;
  case PIPE_PRIM_LINES:
 adjust_x = -0.5;
-adjust_y = 0;
+adjust_y = -0.125;
 break;
  case PIPE_PRIM_TRIANGLES:
 adjust_x = -0.5;
--
1.9.1

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


Re: [Mesa-dev] [PATCH 3/3] vbo: rename target->index in loopback code

2017-07-07 Thread Charmaine Lee

Series looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Friday, July 7, 2017 7:11 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 3/3] vbo: rename target->index in loopback code

Because it's a vertex attribute index.
---
 src/mesa/vbo/vbo_save_loopback.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c
index 773af93..1dae91b 100644
--- a/src/mesa/vbo/vbo_save_loopback.c
+++ b/src/mesa/vbo/vbo_save_loopback.c
@@ -37,7 +37,7 @@
 #include "vbo_context.h"


-typedef void (*attr_func)(struct gl_context *ctx, GLint target, const GLfloat 
*);
+typedef void (*attr_func)(struct gl_context *ctx, GLint index, const GLfloat 
*);


 /* This file makes heavy use of the aliasing of NV vertex attributes
@@ -45,30 +45,30 @@ typedef void (*attr_func)(struct gl_context *ctx, GLint 
target, const GLfloat *)
  * attributes as currently implemented.
  */
 static void
-VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
+VertexAttrib1fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
 {
-   CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
+   CALL_VertexAttrib1fvNV(ctx->Exec, (index, v));
 }


 static void
-VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
+VertexAttrib2fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
 {
-   CALL_VertexAttrib2fvNV(ctx->Exec, (target, v));
+   CALL_VertexAttrib2fvNV(ctx->Exec, (index, v));
 }


 static void
-VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
+VertexAttrib3fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
 {
-   CALL_VertexAttrib3fvNV(ctx->Exec, (target, v));
+   CALL_VertexAttrib3fvNV(ctx->Exec, (index, v));
 }


 static void
-VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
+VertexAttrib4fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
 {
-   CALL_VertexAttrib4fvNV(ctx->Exec, (target, v));
+   CALL_VertexAttrib4fvNV(ctx->Exec, (index, v));
 }


@@ -81,7 +81,7 @@ static attr_func vert_attrfunc[4] = {


 struct loopback_attr {
-   GLint target;
+   GLint index;
GLint sz;
attr_func func;
 };
@@ -127,7 +127,7 @@ loopback_prim(struct gl_context *ctx,
   const GLfloat *tmp = data + la[0].sz;

   for (k = 1; k < nr; k++) {
- la[k].func(ctx, la[k].target, tmp);
+ la[k].func(ctx, la[k].index, tmp);
  tmp += la[k].sz;
   }

@@ -184,7 +184,7 @@ vbo_loopback_vertex_list(struct gl_context *ctx,
 */
for (i = 0; i < VBO_ATTRIB_MAX; i++) {
   if (attrsz[i]) {
- la[nr].target = i;
+ la[nr].index = i;
  la[nr].sz = attrsz[i];
  la[nr].func = vert_attrfunc[attrsz[i]-1];
  nr++;
--
1.9.1

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


Re: [Mesa-dev] [PATCH] st/mesa: remove unused st_framebuffer::Private field

2017-07-07 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Friday, July 7, 2017 7:11 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] st/mesa: remove unused st_framebuffer::Private field

---
 src/mesa/state_tracker/st_context.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index 5c7c58d..af9149e 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -295,7 +295,6 @@ static inline struct st_context *st_context(struct 
gl_context *ctx)
 struct st_framebuffer
 {
struct gl_framebuffer Base;
-   void *Private;

struct st_framebuffer_iface *iface;
enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
--
1.9.1

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


Re: [Mesa-dev] [PATCH 1/3] st/mesa: find proper mipmap level in st_ClearTexSubImage()

2017-07-06 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>To: <mesa-dev@lists.freedesktop.org>
>CC: Neha Bhende <bhen...@vmware.com>

>The Piglit arb_clear_texture-error test creates a texture with only
>a 1x1 image at level=1, then tries to clear level 0 (non-existant)

s/non-existant/non-existent/

>and level 1 (exists).  The test only checks that the former generates
>an error but the later doesn't.  The test passes, but when we try
>to clear the level=1 image we're passing an invalid level to
>pipe_context::clear_texture().  level=1, but since there's only one
>mipmap level in the texture, it should be zero.

>This fixes the code to search the gallium texture resource for the
>correct mipmap level.  Also, add an assertion to make sure we're not
>passing an invalid level to pipe_context::clear_texture().

>Fixes device errors with VMware driver.  No Piglit regressions.

>v2: don't do the level search when using immutable textures.
>---
>  src/mesa/state_tracker/st_cb_texture.c | 60
>+++---
>  1 file changed, 56 insertions(+), 4 deletions(-)

>diff --git a/src/mesa/state_tracker/st_cb_texture.c
>b/src/mesa/state_tracker/st_cb_texture.c
>index 1847cc3..c6a5e63 100644
>--- a/src/mesa/state_tracker/st_cb_texture.c
>+++ b/src/mesa/state_tracker/st_cb_texture.c
>@@ -2836,6 +2836,42 @@ st_TextureView(struct gl_context *ctx,
> return GL_TRUE;
>  }

>+
>+/**
>+ * Find the mipmap level in 'pt' which matches the level described by
>+ * 'texImage'.
>+ */
>+static unsigned
>+find_mipmap_level(const struct gl_texture_image *texImage,
>+  const struct pipe_resource *pt)
>+{
>+   const GLenum target = texImage->TexObject->Target;
>+   GLint texWidth = texImage->Width;
>+   GLint texHeight = texImage->Height;
>+   GLint texDepth = texImage->Depth;
>+   unsigned level, w;
>+   uint16_t h, d, layers;
>+
>+   st_gl_texture_dims_to_pipe_dims(target, texWidth, texHeight, texDepth,
>+   , , , );
>+
>+   for (level = 0; level <= pt->last_level; level++) {
>+  if (u_minify(pt->width0, level) == w &&
>+  u_minify(pt->height0, level) == h &&
>+  u_minify(pt->depth0, level) == d) {
>+ return level;
>+  }
>+   }
>+
>+   /* If we get here, there must be some sort of inconsistency between
>+* the Mesa texture object/images and the gallium resource.
>+*/
>+   debug_printf("Inconsistent textures in find_mipmap_level()\n");
>+
>+   return texImage->Level;
>+}
>+
>+
>  static void
>  st_ClearTexSubImage(struct gl_context *ctx,
>  struct gl_texture_image *texImage,
>@@ -2844,11 +2880,12 @@ st_ClearTexSubImage(struct gl_context *ctx,
>  const void *clearValue)
>  {
> static const char zeros[16] = {0};
>+   struct gl_texture_object *texObj = texImage->TexObject;
> struct st_texture_image *stImage = st_texture_image(texImage);
> struct pipe_resource *pt = stImage->pt;
> struct st_context *st = st_context(ctx);
> struct pipe_context *pipe = st->pipe;
>-   unsigned level = texImage->Level;
>+   unsigned level;
> struct pipe_box box;
>
> if (!pt)
>@@ -2859,10 +2896,25 @@ st_ClearTexSubImage(struct gl_context *ctx,
>
> u_box_3d(xoffset, yoffset, zoffset + texImage->Face,
>  width, height, depth, );
>-   if (texImage->TexObject->Immutable) {
>-  level += texImage->TexObject->MinLevel;
>-  box.z += texImage->TexObject->MinLayer;
>+   if (texObj->Immutable) {
>+  /* The texture object has to be consistent (no "loose", per-image
>+   * gallium resources).  If this texture is a view into another
>+   * texture, we have to apply the MinLevel/Layer offsets.  If this is
>+   * not a texture view, the offsets will be zero.
>+   */
>+  assert(stImage->pt == st_texture_object(texObj)->pt);
>+  level = texImage->Level + texObj->MinLevel;
>+  box.z += texObj->MinLayer;
> }
>+   else {
>+  /* Texture level sizes may be inconsistent.  We my have "loose",
>+   * per-image gallium resources.  The texImage->Level may not match
>+   * the gallium resource texture level.
>+   */
>+  level = find_mipmap_level(texImage, pt);
>+   }
>+
>+   assert(level <= pt->last_level);

> pipe->clear_texture(pipe, pt, level, , clearValue ? clearValue
>: zeros);
>  }
>--
>1.9.1


Series looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>



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


Re: [Mesa-dev] [PATCH 1/4] svga: fix buffer binding flags initialization

2017-07-03 Thread Charmaine Lee

>From: Brian Paul <bri...@vmware.com>
>Sent: Sunday, July 2, 2017 8:12 AM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee
>Subject: [PATCH 1/4] svga: fix buffer binding flags initialization

>If a buffer is created/initialized with glNamedBufferData we will
>have no target (GL_ARRAY_BUFFER, GL_UNIFORM_BUFFER, etc) >so the
>svga_buffer::bind_flags will be zero until we try to get the buffer
handle.

>This patch initializes the svga_buffer::bind_flags field when it's
zero.

>This fixes the Piglit arb_uniform_buffer_object-rendering-dsa test.

>Note that there's still issues in this area that'll have to be
>addressed in the future.  For example, creating a buffer object
>as GL_UNIFORM_BUFFER and later using it as a vertex buffer will
>fail.

Since we are creating two separate host surfaces for such buffer object
when it is used as both constant buffer and vertex buffer, we are
probably missing a surface update when the buffer object is updated.
Which piglit fails?

>---
> src/gallium/drivers/svga/svga_resource_buffer_upload.c | 6 ++
> 1 file changed, 6 insertions(+)

>diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c 
>>b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
>index 61f6fb0..104cb6d 100644
>--- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c
>+++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
>@@ -1003,6 +1003,12 @@ svga_buffer_handle(struct svga_context *svga, struct 
>pipe_resource *buf,
> return NULL;
>   }
>} else {
>+  if (!sbuf->bind_flags) {
>+ sbuf->bind_flags = tobind_flags;
>+  }
>+
>+  assert((sbuf->bind_flags & tobind_flags) == tobind_flags);
>+
>   /* This call will set sbuf->handle */
>   if (svga_have_gb_objects(svga)) {
>  ret = svga_buffer_update_hw(svga, sbuf, sbuf->bind_flags);
>--
>1.9.1

Series looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

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


Re: [Mesa-dev] [PATCH] wglcontext: assorted updates

2017-07-03 Thread Charmaine Lee
Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Sunday, July 2, 2017 8:07 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] wglcontext: assorted updates

Print context flags, vendor, renderer strings.
Default to not setting the WGL_CONTEXT_PROFILE_MASK_ARB attribute so we
can test that scenario.
Fix profile_mask_to_string() to use GL_*_BIT instead of WGL_*_BIT flags.
Try calling glGenLists() to see if it generates an error.  This helps to
check if core/forward compatible profile error checking is realy working.
Restructure some context setup code.
---
 src/wgl/wglcontext.c | 107 +--
 1 file changed, 86 insertions(+), 21 deletions(-)

diff --git a/src/wgl/wglcontext.c b/src/wgl/wglcontext.c
index 92df7cc..b116270 100644
--- a/src/wgl/wglcontext.c
+++ b/src/wgl/wglcontext.c
@@ -24,6 +24,19 @@
 #include 
 #include 
 #include 
+#include 
+
+#ifndef GL_CONTEXT_FLAG_DEBUG_BIT
+#define GL_CONTEXT_FLAG_DEBUG_BIT 0x0002
+#endif
+#ifndef GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x0004
+#endif
+
+#ifndef GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR
+#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR  0x0008
+#endif
+

 static LRESULT CALLBACK
 WndProc(HWND hWnd,
@@ -61,28 +74,59 @@ static char *
 profile_mask_to_string(GLint profileMask)
 {
switch (profileMask) {
-   case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:
-  return "WGL_CONTEXT_CORE_PROFILE_BIT_ARB";
-   case WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
-  return "WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB";
+   case GL_CONTEXT_CORE_PROFILE_BIT:
+  return "GL_CONTEXT_CORE_PROFILE_BIT";
+   case GL_CONTEXT_COMPATIBILITY_PROFILE_BIT:
+  return "GL_CONTEXT_COMPATIBILITY_PROFILE_BIT";
default:
   return "0";
}
 }

+static char *
+context_flags_to_string(GLint flags)
+{
+   static char buf[1000] = {0};
+   if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
+  strcat(buf, "GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT | ");
+   if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
+  strcat(buf, "GL_CONTEXT_FLAG_DEBUG_BIT | ");
+   if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT)
+  strcat(buf, "GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT | ");
+   if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR)
+  strcat(buf, "GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR | ");
+
+   int n = strlen(buf);
+   if (n >= 3) {
+  /* rm the trailing " | " */
+  buf[n-3] = 0;
+   }
+   else {
+  strcat(buf, "(none)");
+   }
+
+   return buf;
+}
+
 static void
 print_context_infos(void)
 {
GLint majorVersion;
GLint minorVersion;
-   GLint profileMask;
-   const char *version;
+   GLint profileMask, flags;
+   const char *version, *vendor, *renderer;

fprintf(stdout, "Context Informations\n");

version = (const char *)glGetString(GL_VERSION);
fprintf(stdout, "GL_VERSION: %s\n", version);

+   vendor = (const char *)glGetString(GL_VENDOR);
+   fprintf(stdout, "GL_VENDOR: %s\n", vendor);
+
+   renderer = (const char *)glGetString(GL_RENDERER);
+   fprintf(stdout, "GL_RENDERER: %s\n", renderer);
+
// Request informations with the new 3.x features.
if (sscanf(version, "%d.%d", , ) != 2)
   return;
@@ -90,10 +134,28 @@ print_context_infos(void)
if (majorVersion >= 3) {
   glGetIntegerv(GL_MAJOR_VERSION, );
   glGetIntegerv(GL_MINOR_VERSION, );
-  glGetIntegerv(GL_CONTEXT_PROFILE_MASK, );
   fprintf(stdout, "GL_MAJOR_VERSION: %d\n", majorVersion);
   fprintf(stdout, "GL_MINOR_VERSION: %d\n", minorVersion);
-  fprintf(stdout, "GL_CONTEXT_PROFILE_MASK: %s\n", 
profile_mask_to_string(profileMask));
+   }
+   if (majorVersion * 10 + minorVersion >= 32) {
+  glGetIntegerv(GL_CONTEXT_PROFILE_MASK, );
+  glGetIntegerv(GL_CONTEXT_FLAGS, );
+  fprintf(stdout, "GL_CONTEXT_PROFILE_MASK: %s\n",
+  profile_mask_to_string(profileMask));
+  fprintf(stdout, "GL_CONTEXT_FLAGS: %s\n",
+  context_flags_to_string(flags));
+   }
+
+   /* Test if deprecated features work or generate an error */
+   while (glGetError() != GL_NO_ERROR)
+  ;
+
+   (void) glGenLists(1);
+   if (glGetError()) {
+  fprintf(stdout, "glGenLists generated an error.\n");
+   }
+   else {
+  fprintf(stdout, "glGenLists generated no error.\n");
}
 }

@@ -107,13 +169,6 @@ create_context(int majorVersion, int minorVersion, int 
profileMask, int contextF
int pixelFormat;
HGLRC tmp, ctx;
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
-   int attribsList[] = {
-  WGL_CONTEXT_MAJOR_VERSION_ARB, 1,
-  WGL_CONTEXT_MINOR_VERSION_ARB, 0,
-  WGL

Re: [Mesa-dev] [PATCH] svga: add texture size/levels sanity check code in svga_texture_create()

2017-06-28 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, June 28, 2017 3:13 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: add texture size/levels sanity check code in 
svga_texture_create()

The state tracker should never ask us to create a texture with invalid
dimensions / mipmap levels.  Do some assertions to check that.

No Piglit regressions.
---
 src/gallium/drivers/svga/svga_resource_texture.c | 33 
 1 file changed, 33 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c 
b/src/gallium/drivers/svga/svga_resource_texture.c
index 670100c..84441d1 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -916,6 +916,39 @@ svga_texture_create(struct pipe_screen *screen,
   goto fail_notex;
}

+   /* Verify the number of mipmap levels isn't impossibly large.  For example,
+* if the base 2D image is 16x16, we can't have 8 mipmap levels.
+* The state tracker should never ask us to create a resource with invalid
+* parameters.
+*/
+   {
+  unsigned max_dim = template->width0;
+
+  switch (template->target) {
+  case PIPE_TEXTURE_1D:
+  case PIPE_TEXTURE_1D_ARRAY:
+ // nothing
+ break;
+  case PIPE_TEXTURE_2D:
+  case PIPE_TEXTURE_CUBE:
+  case PIPE_TEXTURE_CUBE_ARRAY:
+  case PIPE_TEXTURE_2D_ARRAY:
+ max_dim = MAX2(max_dim, template->height0);
+ break;
+  case PIPE_TEXTURE_3D:
+ max_dim = MAX3(max_dim, template->height0, template->depth0);
+ break;
+  case PIPE_TEXTURE_RECT:
+  case PIPE_BUFFER:
+ assert(template->last_level == 0);
+ /* the assertion below should always pass */
+ break;
+  default:
+ debug_printf("Unexpected texture target type\n");
+  }
+  assert(1 << template->last_level <= max_dim);
+   }
+
tex = CALLOC_STRUCT(svga_texture);
if (!tex) {
   goto fail_notex;
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: add some missing SVGA_STATS_* enum values, prefix strings

2017-06-16 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Friday, June 16, 2017 12:21 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: add some missing SVGA_STATS_* enum values, prefix strings

To fix the build when VMX86_STATS is defined.
Also, some minor whitespace changes to match upstream code.
---
 src/gallium/drivers/svga/svga_winsys.h | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_winsys.h 
b/src/gallium/drivers/svga/svga_winsys.h
index 376707d..8b8b45b 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -35,7 +35,6 @@
 #ifndef SVGA_WINSYS_H_
 #define SVGA_WINSYS_H_

-
 #include "svga_types.h"
 #include "svga_reg.h"
 #include "svga3d_reg.h"
@@ -101,6 +100,7 @@ struct svga_winsys_stats_timeframe {

 enum svga_stats_count {
SVGA_STATS_COUNT_BLENDSTATE,
+   SVGA_STATS_COUNT_BLITBLITTERCOPY,
SVGA_STATS_COUNT_DEPTHSTENCILSTATE,
SVGA_STATS_COUNT_RASTERIZERSTATE,
SVGA_STATS_COUNT_SAMPLER,
@@ -112,11 +112,16 @@ enum svga_stats_count {
 };

 enum svga_stats_time {
+   SVGA_STATS_TIME_BLIT,
+   SVGA_STATS_TIME_BLITBLITTER,
+   SVGA_STATS_TIME_BLITFALLBACK,
SVGA_STATS_TIME_BUFFERSFLUSH,
SVGA_STATS_TIME_BUFFERTRANSFERMAP,
SVGA_STATS_TIME_BUFFERTRANSFERUNMAP,
SVGA_STATS_TIME_CONTEXTFINISH,
SVGA_STATS_TIME_CONTEXTFLUSH,
+   SVGA_STATS_TIME_COPYREGION,
+   SVGA_STATS_TIME_COPYREGIONFALLBACK,
SVGA_STATS_TIME_CREATEBACKEDSURFACEVIEW,
SVGA_STATS_TIME_CREATEBUFFER,
SVGA_STATS_TIME_CREATECONTEXT,
@@ -134,6 +139,7 @@ enum svga_stats_time {
SVGA_STATS_TIME_EMITFS,
SVGA_STATS_TIME_EMITGS,
SVGA_STATS_TIME_EMITVS,
+   SVGA_STATS_TIME_EMULATESURFACEVIEW,
SVGA_STATS_TIME_FENCEFINISH,
SVGA_STATS_TIME_GENERATEINDICES,
SVGA_STATS_TIME_HWTNLDRAWARRAYS,
@@ -165,20 +171,26 @@ enum svga_stats_time {

 #define SVGA_STATS_COUNT_NAMES\
SVGA_STATS_PREFIX "BlendState",\
+   SVGA_STATS_PREFIX "BlitBlitterCopy",   \
SVGA_STATS_PREFIX "DepthStencilState", \
SVGA_STATS_PREFIX "RasterizerState",   \
SVGA_STATS_PREFIX "Sampler",   \
SVGA_STATS_PREFIX "SamplerView",   \
SVGA_STATS_PREFIX "SurfaceWriteFlush", \
SVGA_STATS_PREFIX "TextureReadback",   \
-   SVGA_STATS_PREFIX "VertexElement"
+   SVGA_STATS_PREFIX "VertexElement"  \

 #define SVGA_STATS_TIME_NAMES   \
+   SVGA_STATS_PREFIX "Blit",\
+   SVGA_STATS_PREFIX "BlitBlitter", \
+   SVGA_STATS_PREFIX "BlitFallback",\
SVGA_STATS_PREFIX "BuffersFlush",\
SVGA_STATS_PREFIX "BufferTransferMap",   \
SVGA_STATS_PREFIX "BufferTransferUnmap", \
SVGA_STATS_PREFIX "ContextFinish",   \
SVGA_STATS_PREFIX "ContextFlush",\
+   SVGA_STATS_PREFIX "CopyRegion",  \
+   SVGA_STATS_PREFIX "CopyRegionFallback",  \
SVGA_STATS_PREFIX "CreateBackedSurfaceView", \
SVGA_STATS_PREFIX "CreateBuffer",\
SVGA_STATS_PREFIX "CreateContext",   \
@@ -196,6 +208,7 @@ enum svga_stats_time {
SVGA_STATS_PREFIX "EmitFS",  \
SVGA_STATS_PREFIX "EmitGS",  \
SVGA_STATS_PREFIX "EmitVS",  \
+   SVGA_STATS_PREFIX "EmulateSurfaceView",  \
SVGA_STATS_PREFIX "FenceFinish", \
SVGA_STATS_PREFIX "GenerateIndices", \
SVGA_STATS_PREFIX "HWtnlDrawArrays", \
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] draw: check for line_width != 1.0f in validate_pipeline()

2017-06-15 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Thursday, June 15, 2017 10:42:00 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] draw: check for line_width != 1.0f in validate_pipeline()

We shouldn't use the wide line stage if the line width is 1.
This check isn't strictly needed because all drivers are (now)
specifying a line wide threshold of at least 1.0 pixels, but
let's play it safe.
---
 src/gallium/auxiliary/draw/draw_pipe_validate.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c 
b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index 01d0759..846cd4d 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -156,9 +156,10 @@ static struct draw_stage *validate_pipeline( struct 
draw_stage *stage )
 */
stage->next = next;

-   /* drawing wide lines? */
-   wide_lines = (roundf(rast->line_width) > draw->pipeline.wide_line_threshold
- && !rast->line_smooth);
+   /* drawing wide, non-AA lines? */
+   wide_lines = rast->line_width != 1.0f &&
+roundf(rast->line_width) > draw->pipeline.wide_line_threshold 
&&
+!rast->line_smooth;

/* drawing large/sprite points (but not AA points)? */
if (rast->sprite_coord_enable && draw->pipeline.point_sprite)
--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] wglgears: fix up wglChoosePixelFormatARB() attribute list

2017-05-03 Thread Charmaine Lee

Looks great.

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, May 3, 2017 12:49:40 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] wglgears: fix up wglChoosePixelFormatARB() attribute list

Specify WGL_DRAW_TO_WINDOW_ARB and WGL_COLOR_BITS_ARB.
Improve some comments, per Charmaine.
---
 src/wgl/wglgears.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c
index 7d43822..d673143 100644
--- a/src/wgl/wglgears.c
+++ b/src/wgl/wglgears.c
@@ -421,11 +421,12 @@ make_window(const char *name, int x, int y, int width, 
int height)
}

if (use_srgb) {
-  /* For sRGB we need to use the wglChoosePixelFormatARB() function,
-   * and then create a new context, window, etc.
+  /* We can't query/use extension functions until after we've
+   * created and bound a rendering context (done above).
*
-   * Note: we can't query/use extension functions until after we've
-   * creatend and bound a rendering context.
+   * We can only set the pixel format of the window once, so we need to
+   * create a new device context in order to use the pixel format returned
+   * from wglChoosePixelFormatARB, and then create a new window.
*/
   PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB_func =
  (PFNWGLCHOOSEPIXELFORMATARBPROC)
@@ -434,8 +435,8 @@ make_window(const char *name, int x, int y, int width, int 
height)

   static const int int_attribs[] = {
  WGL_SUPPORT_OPENGL_ARB, TRUE,
- //WGL_COLOR_BITS_ARB, 24,
- //WGL_ALPHA_BITS_ARB, 8,
+ WGL_DRAW_TO_WINDOW_ARB, TRUE,
+ WGL_COLOR_BITS_ARB, 24,  // at least 24-bits of RGB
  WGL_DEPTH_BITS_ARB, 24,
  WGL_DOUBLE_BUFFER_ARB, TRUE,
  WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, TRUE,
--
1.9.1

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


Re: [Mesa-dev] [PATCH 1/2] wglgears.c: add -srgb option

2017-04-27 Thread Charmaine Lee

Series looks good.  One typo below:


>From: Brian Paul <bri...@vmware.com>
>Sent: Thursday, April 27, 2017 10:19 AM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee; Neha Bhende
>Subject: [PATCH 1/2] wglgears.c: add -srgb option

>To test sRGB pixel format selection and sRGB rendering.
>This involves choosing a new pixel format, creating a new context, etc.
>---
> src/wgl/wglgears.c | 91 --
> 1 file changed, 88 insertions(+), 3 deletions(-)

>diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c
>index d90d603..7d43822 100644
>--- a/src/wgl/wglgears.c
>+++ b/src/wgl/wglgears.c
>@@ -30,6 +30,7 @@
>  * 25th October 2004
>  */

...


>+   if (use_srgb) {
>+  /* For sRGB we need to use the wglChoosePixelFormatARB() function,
>+   * and then create a new context, window, etc.
>+   *
>+   * Note: we can't query/use extension functions until after we've
>+   * creatend and bound a rendering context.

s/creatend/created

BTW, can you also add a comment that we can only set the pixel format of the 
window
once, so we need to create a new device context in order to use the pixel 
format returned
from wglChoosePixelFormatARB.


Other than that,  

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


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


Re: [Mesa-dev] [PATCH] svga: remove pre-SVGA3D_HWVERSION_WS8_B1 code

2017-04-06 Thread Charmaine Lee

Looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Thursday, April 6, 2017 11:49 AM
To: mesa-dev@lists.freedesktop.org
Cc: Jose Fonseca; Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: remove pre-SVGA3D_HWVERSION_WS8_B1 code

3D wasn't officially supported before virtual HW version 8 so we can
remove this old code.
---
 src/gallium/drivers/svga/svga_state_constants.c | 76 ++---
 1 file changed, 5 insertions(+), 71 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_constants.c 
b/src/gallium/drivers/svga/svga_state_constants.c
index 8d6b46a..31e4be0 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -264,50 +264,6 @@ svga_get_extra_gs_constants(struct svga_context *svga, 
float *dest)
return count;
 }

-/**
- * Check and emit one shader constant register.
- * \param shader  PIPE_SHADER_FRAGMENT or PIPE_SHADER_VERTEX
- * \param i  which float[4] constant to change
- * \param value  the new float[4] value
- */
-static enum pipe_error
-emit_const(struct svga_context *svga, enum pipe_shader_type shader, unsigned i,
-   const float *value)
-{
-   enum pipe_error ret = PIPE_OK;
-
-   assert(shader < PIPE_SHADER_TYPES);
-   assert(i < SVGA3D_CONSTREG_MAX);
-   assert(!svga_have_vgpu10(svga));
-
-   if (memcmp(svga->state.hw_draw.cb[shader][i], value,
-  4 * sizeof(float)) != 0) {
-  if (SVGA_DEBUG & DEBUG_CONSTS)
- debug_printf("%s %s %u: %f %f %f %f\n",
-  __FUNCTION__,
-  shader == PIPE_SHADER_VERTEX ? "VERT" : "FRAG",
-  i,
-  value[0],
-  value[1],
-  value[2],
-  value[3]);
-
-  ret = SVGA3D_SetShaderConst( svga->swc,
-   i,
-   svga_shader_type(shader),
-   SVGA3D_CONST_TYPE_FLOAT,
-   value );
-  if (ret != PIPE_OK)
- return ret;
-
-  memcpy(svga->state.hw_draw.cb[shader][i], value, 4 * sizeof(float));
-
-  svga->hud.num_const_updates++;
-   }
-
-   return ret;
-}
-

 /*
  * Check and emit a range of shader constant registers, trying to coalesce
@@ -442,11 +398,9 @@ static enum pipe_error
 emit_consts_vgpu9(struct svga_context *svga, enum pipe_shader_type shader)
 {
const struct pipe_constant_buffer *cbuf;
-   struct svga_screen *ss = svga_screen(svga->pipe.screen);
struct pipe_transfer *transfer = NULL;
unsigned count;
const float (*data)[4] = NULL;
-   unsigned i;
enum pipe_error ret = PIPE_OK;
const unsigned offset = 0;

@@ -469,24 +423,13 @@ emit_consts_vgpu9(struct svga_context *svga, enum 
pipe_shader_type shader)
   }

   /* sanity check */
-  assert(cbuf->buffer->width0 >=
- cbuf->buffer_size);
+  assert(cbuf->buffer->width0 >= cbuf->buffer_size);

   /* Use/apply the constant buffer size and offsets here */
   count = cbuf->buffer_size / (4 * sizeof(float));
   data += cbuf->buffer_offset / (4 * sizeof(float));

-  if (ss->hw_version >= SVGA3D_HWVERSION_WS8_B1) {
- ret = emit_const_range( svga, shader, offset, count, data );
-  }
-  else {
- for (i = 0; i < count; i++) {
-ret = emit_const( svga, shader, offset + i, data[i] );
-if (ret != PIPE_OK) {
-   break;
-}
- }
-  }
+  ret = emit_const_range( svga, shader, offset, count, data );

   pipe_buffer_unmap(>pipe, transfer);

@@ -500,7 +443,7 @@ emit_consts_vgpu9(struct svga_context *svga, enum 
pipe_shader_type shader)
   const struct svga_shader_variant *variant = NULL;
   unsigned offset;
   float extras[MAX_EXTRA_CONSTS][4];
-  unsigned count, i;
+  unsigned count;

   switch (shader) {
   case PIPE_SHADER_VERTEX:
@@ -521,17 +464,8 @@ emit_consts_vgpu9(struct svga_context *svga, enum 
pipe_shader_type shader)
   assert(count <= ARRAY_SIZE(extras));

   if (count > 0) {
- if (ss->hw_version >= SVGA3D_HWVERSION_WS8_B1) {
-ret = emit_const_range(svga, shader, offset, count,
-   (const float (*) [4])extras);
- }
- else {
-for (i = 0; i < count; i++) {
-   ret = emit_const(svga, shader, offset + i, extras[i]);
-   if (ret != PIPE_OK)
-  return ret;
-}
- }
+ ret = emit_const_range(svga, shader, offset, count,
+(const float (*) [4])extras);
   }
}

--
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] svga: fix crash regression since e027935a795

2017-03-01 Thread Charmaine Lee

Change series looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, March 1, 2017 6:45:54 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: fix crash regression since e027935a795

During the first update of the hw_clear_state atoms, we may not yet
have a current rasterizer state object.  So, svga->curr.rast may be
NULL and we crash.

Add a few null pointer checks to work around this.  Note that these
are only needed in the state update functions which are called for
'clear' validation.
---
 src/gallium/drivers/svga/svga_state_framebuffer.c | 4 ++--
 src/gallium/drivers/svga/svga_state_need_swtnl.c  | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c 
b/src/gallium/drivers/svga/svga_state_framebuffer.c
index 8584c5d..b2b037d 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -393,7 +393,7 @@ emit_viewport( struct svga_context *svga,
/* Enable prescale to adjust vertex positions to match
   VGPU10 convention only if rasterization is enabled.
 */
-   if (svga->curr.rast->templ.rasterizer_discard) {
+   if (svga->curr.rast && svga->curr.rast->templ.rasterizer_discard) {
   degenerate = TRUE;
   goto out;
} else {
@@ -497,7 +497,7 @@ emit_viewport( struct svga_context *svga,
 * screen-space coordinates slightly relative to D3D which is
 * what hardware implements natively.
 */
-   if (svga->curr.rast->templ.half_pixel_center) {
+   if (svga->curr.rast && svga->curr.rast->templ.half_pixel_center) {
   float adjust_x = 0.0;
   float adjust_y = 0.0;

diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c 
b/src/gallium/drivers/svga/svga_state_need_swtnl.c
index b07c62d..f9cea14 100644
--- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -66,7 +66,8 @@ update_need_pipeline(struct svga_context *svga, unsigned 
dirty)

/* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
 */
-   if (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim)) {
+   if (svga->curr.rast &&
+   (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim))) {
   SVGA_DBG(DEBUG_SWTNL, "%s: rast need_pipeline (0x%x) & prim (0x%x)\n",
  __FUNCTION__,
  svga->curr.rast->need_pipeline,
@@ -103,7 +104,7 @@ update_need_pipeline(struct svga_context *svga, unsigned 
dirty)

/* SVGA_NEW_FS, SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
 */
-   if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
+   if (svga->curr.rast && svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
   unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable;
   unsigned generic_inputs =
  svga->curr.fs ? svga->curr.fs->generic_inputs : 0;
--
1.9.1

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


[Mesa-dev] [PATCH 1/2] st: add ST_FLUSH_WAIT to st_context_flush()

2017-02-22 Thread Charmaine Lee
When st_context_flush() is called with ST_FLUSH_WAIT,
the function will return after the fence is completed.
---
 src/gallium/include/state_tracker/st_api.h | 1 +
 src/mesa/state_tracker/st_manager.c| 7 +++
 2 files changed, 8 insertions(+)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index daa1f23..a999774 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -160,6 +160,7 @@ enum st_context_resource_type {
  */
 #define ST_FLUSH_FRONT(1 << 0)
 #define ST_FLUSH_END_OF_FRAME (1 << 1)
+#define ST_FLUSH_WAIT (1 << 2)
 
 /**
  * Value to st_manager->get_param function.
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index c3d8286..e663b01 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -504,6 +504,13 @@ st_context_flush(struct st_context_iface *stctxi, unsigned 
flags,
}
 
st_flush(st, fence, pipe_flags);
+
+   if ((flags & ST_FLUSH_WAIT) && fence) {
+  st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence,
+ PIPE_TIMEOUT_INFINITE);
+  st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL);
+   }
+
if (flags & ST_FLUSH_FRONT)
   st_manager_flush_frontbuffer(st);
 }
-- 
1.9.1

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


[Mesa-dev] [PATCH 2/2] st/wgl: flush with ST_FLUSH_WAIT before releasing shared contexts

2017-02-22 Thread Charmaine Lee
Before releasing a shared context, flush the context
with ST_FLUSH_WAIT to make sure all commands are executed.
This ensures that rendering to any shared resources is completed
before they will be referenced by another context.

Fixes an intermittent flickering with Photoshop. (VMware bug# 1779340)
---
 src/gallium/state_trackers/wgl/stw_context.c | 16 ++--
 src/gallium/state_trackers/wgl/stw_context.h |  1 +
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_context.c 
b/src/gallium/state_trackers/wgl/stw_context.c
index b1e5f5e..85cffa6 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -104,8 +104,11 @@ DrvShareLists(DHGLRC dhglrc1, DHGLRC dhglrc2)
ctx1 = stw_lookup_context_locked( dhglrc1 );
ctx2 = stw_lookup_context_locked( dhglrc2 );
 
-   if (ctx1 && ctx2 && ctx2->st->share)
+   if (ctx1 && ctx2 && ctx2->st->share) {
   ret = ctx2->st->share(ctx2->st, ctx1->st);
+  ctx1->shared = TRUE;
+  ctx2->shared = TRUE;
+   }
 
stw_unlock_contexts(stw_dev);
 
@@ -175,6 +178,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC 
hShareContext,
if (hShareContext != 0) {
   stw_lock_contexts(stw_dev);
   shareCtx = stw_lookup_context_locked( hShareContext );
+  shareCtx->shared = TRUE;
   stw_unlock_contexts(stw_dev);
}
 
@@ -184,6 +188,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC 
hShareContext,
 
ctx->hdc = hdc;
ctx->iPixelFormat = iPixelFormat;
+   ctx->shared = shareCtx != NULL;
 
memset(, 0, sizeof(attribs));
attribs.visual = pfi->stvis;
@@ -403,7 +408,14 @@ stw_make_current(HDC hdc, DHGLRC dhglrc)
 return TRUE;
  }
   } else {
- old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL);
+ if (old_ctx->shared) {
+struct pipe_fence_handle *fence = NULL;
+old_ctx->st->flush(old_ctx->st,
+   ST_FLUSH_FRONT | ST_FLUSH_WAIT, );
+ }
+ else {
+old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL);
+ }
   }
}
 
diff --git a/src/gallium/state_trackers/wgl/stw_context.h 
b/src/gallium/state_trackers/wgl/stw_context.h
index 6bfa715..0f180c8 100644
--- a/src/gallium/state_trackers/wgl/stw_context.h
+++ b/src/gallium/state_trackers/wgl/stw_context.h
@@ -40,6 +40,7 @@ struct stw_context
DHGLRC dhglrc;
int iPixelFormat;
HDC hdc;
+   BOOL shared;
 
struct stw_framebuffer *current_framebuffer;
 
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 00/11] Gallium common uploaders (v2)

2017-02-09 Thread Charmaine Lee

Series tested with vmware svga driver. Changes looks good.

Tested-by: Charmaine Lee <charmai...@vmware.com>

From: mesa-dev <mesa-dev-boun...@lists.freedesktop.org> on behalf of Marek 
Olšák <mar...@gmail.com>
Sent: Wednesday, February 8, 2017 4:11:01 PM
To: mesa-dev@lists.freedesktop.org
Subject: [Mesa-dev] [PATCH 00/11] Gallium common uploaders (v2)

Hi,

Since the last version, I added pipe_context::const_uploader and
documentation.

Changed patches: 1, 3, 9.
New patch: 11.

Please review.

Thanks,
Marek

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=Ang1qmMo4GwCmRUnLE-f31kqPa6AOnoS-OAMUzQyM0M=XSJrU78OKHut9MP5JzTo6E_q9zUryi8toIq7t-vPBMs=QXqaX6b025NySDn7FRrLOOs6w2aXs4qV_Yb47UZSODg=
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa commit a5e733c

2016-12-21 Thread Charmaine Lee

>From: Rob Clark <robdcl...@gmail.com>

>On Wed, Dec 21, 2016 at 12:32 PM, Charmaine Lee <charmai...@vmware.com> wrote:
>>
>> Hi Rob,
>>
>> Your mesa commit a5e733c mesa: drop current draw/read buffer when ctx is 
>> released
>> is causing rendering issue when running with vmware svga driver.
>>
>> The problem is when the winsys draw/read buffers are unreferenced, the whole 
>> object
>> including the underlying resource can be prematurely destroyed. When the 
>> buffers are bound
>> to a context again, the whole object hierarchy is recreated but we already 
>> lost the previous
>> content, hence causing rendering corruption.

>It's possible perhaps that something else needs to be holding a
>reference to the corresponding EGL level object?  IIRC the EGL level
>object was freed but not mesa/st level object, leading to new EGL
>surface being allocated w/ same ptr address and confusing mesa/st.
>Which *definitely* seems wrong.

Dangling object is dangerous.

>> I believe the winsys draw/read buffers are purposely there to be not 
>> unreferenced at
>> context unbind time. There are timestamps in st_framebuffer and 
>> st_framebuffer_iface
>> to keep track of when the frame buffer needs to be re-validated. Could it be
>> somehow those stamps are out-of-sync in your case? Is there a better fix
>> to your original problem?

>*Maybe* but I don't totally understand how the timestamp thing is
>expected to work.  But it is already a couple months ago that I was
>debugging it and I won't really have the android setup again for a
>while.

>But somehow we either need to hold reference to the EGL surface while
>we have a ptr to it or drop the reference so we don't have a stale ptr
>that we can be confused by after a new EGL surface is created.

It will be ideal if st_framebuffer_iface object can hold a ptr to the associated
st_framebuffer object. So when an EGL surface is destroyed, it can follow the
chain to free the st objects as well. But since st_framebuffer object is 
context specific,
there can be multiple st_framebuffer objects for an st_framebuffer_iface object,
so currently the mapping of st_framebuffer to st_framebuffer_iface is kept in 
the
st_framebuffer object, causing it difficult to drop the reference when
st_framebuffer_iface for the EGL surface is deleted.
We can probably move the mapping to st_manager itself which already knows
the st_framebuffer_iface objects bound to a context, so when a
st_framebuffer_iface for an EGL surface is destroyed, we can notify
the st_manager to unreference the st_framebuffer_iface object from any of the 
st_framebuffer_iface to context mapping.

-Charmaine

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


Re: [Mesa-dev] [PATCH v3 2/3] svga: Fix a strict-aliasing violation in shader dumper

2016-12-13 Thread Charmaine Lee

Change looks fine to me. Thanks.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Roland Scheidegger
Sent: Tuesday, December 13, 2016 10:38 AM
To: Edward O'Callaghan; mesa-dev@lists.freedesktop.org
Cc: Brian Paul; Charmaine Lee
Subject: Re: [Mesa-dev] [PATCH v3 2/3] svga: Fix a strict-aliasing violation in 
shader dumper

adding CC: Charmaine

Am 12.12.2016 um 06:23 schrieb Edward O'Callaghan:
> Brian/Roland ping?
>
> On 12/07/2016 10:30 AM, Edward O'Callaghan wrote:
>> As per the C spec, it is illegal to alias pointers to different
>> types. This results in undefined behaviour after optimization
>> passes, resulting in very subtle bugs that happen only on a
>> full moon..
>>
>> Use a memcpy() as a well defined coercion between the isomorphic
>> bit-field interpretations of memory.
>>
>> V.2: Use C99 compat STATIC_ASSERT() over C11 static_assert().
>>
>> Signed-off-by: Edward O'Callaghan <funfunc...@folklore1984.net>
>> ---
>>  src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c 
>> b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
>> index 4ee1bf2..46126a5 100644
>> --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
>> +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
>> @@ -30,6 +30,9 @@
>>   * @author Michal Krol <mic...@vmware.com>
>>   */
>>
>> +#include 
>> +#include 
>> +
>>  #include "svga_shader.h"
>>  #include "svga_shader_dump.h"
>>  #include "svga_shader_op.h"
>> @@ -413,6 +416,11 @@ dump_dstreg(struct sh_dstreg dstreg,
>>
>>  static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, 
>> const struct dump_info *di )
>>  {
>> +   struct sh_reg srcreg_sh = {0};
>> +   /* bit-fields carefully aligned, ensure they stay that way. */
>> +   STATIC_ASSERT(sizeof(struct sh_reg) == sizeof(struct sh_srcreg));
>> +   memcpy(_sh, , sizeof(srcreg_sh));
>> +
>> switch (srcreg.modifier) {
>> case SVGA3DSRCMOD_NEG:
>> case SVGA3DSRCMOD_BIASNEG:
>> @@ -427,7 +435,7 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct 
>> sh_srcreg *indreg, cons
>> case SVGA3DSRCMOD_NOT:
>>_debug_printf( "!" );
>> }
>> -   dump_reg( *(struct sh_reg *) , indreg, di );
>> +   dump_reg(srcreg_sh, indreg, di );
>> switch (srcreg.modifier) {
>> case SVGA3DSRCMOD_NONE:
>> case SVGA3DSRCMOD_NEG:
>>
>

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


[Mesa-dev] [PATCH] util: fix memory leak from the fragment shaders for SINT <-> UINT blits

2016-11-23 Thread Charmaine Lee
This patch deletes those fragment shaders in util_blitter_destroy().
---
 src/gallium/auxiliary/util/u_blitter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 98b5421..45dc033 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -453,7 +453,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
}
 
for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) {
-  for (unsigned type = 0; type < 3; ++type) {
+  for (unsigned type = 0; type < ARRAY_SIZE(ctx->fs_texfetch_col); ++type) 
{
  if (ctx->fs_texfetch_col[type][i])
 ctx->delete_fs_state(pipe, ctx->fs_texfetch_col[type][i]);
  if (ctx->fs_texfetch_col_msaa[type][i])
-- 
1.9.1

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


[Mesa-dev] [PATCH] util: fix missing swizzle components in the SINT <-> UINT conversion string

2016-11-22 Thread Charmaine Lee
Fixes tgsi error introduced in commit 3817a7a. The error complains missing
swizzle component in the conversion string "UMIN TEMP[0], TEMP[0], IMM[0].x".
---
 src/gallium/auxiliary/util/u_simple_shaders.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c 
b/src/gallium/auxiliary/util/u_simple_shaders.c
index 8be31be..7342b3d 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -633,14 +633,14 @@ util_make_fs_blit_msaa_color(struct pipe_context *pipe,
 
   if (dtype == TGSI_RETURN_TYPE_SINT) {
  conversion_decl = "IMM[0] UINT32 {2147483647, 0, 0, 0}\n";
- conversion = "UMIN TEMP[0], TEMP[0], IMM[0].x\n";
+ conversion = "UMIN TEMP[0], TEMP[0], IMM[0].\n";
   }
} else if (stype == TGSI_RETURN_TYPE_SINT) {
   samp_type = "SINT";
 
   if (dtype == TGSI_RETURN_TYPE_UINT) {
  conversion_decl = "IMM[0] INT32 {0, 0, 0, 0}\n";
- conversion = "IMAX TEMP[0], TEMP[0], IMM[0].x\n";
+ conversion = "IMAX TEMP[0], TEMP[0], IMM[0].\n";
   }
} else {
   assert(dtype == TGSI_RETURN_TYPE_FLOAT);
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] gallium/hud: call fflush() after printing error messages

2016-11-02 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, November 2, 2016 3:08 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] gallium/hud: call fflush() after printing error messages

For Windows.  Otherwise, we don't see the message until the program exits.
---
 src/gallium/auxiliary/hud/hud_context.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c 
b/src/gallium/auxiliary/hud/hud_context.c
index 3772f3c..ceb157a 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -875,9 +875,12 @@ parse_string(const char *s, char *out)

*out = 0;

-   if (*s && !i)
+   if (*s && !i) {
   fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) while "
   "parsing a string\n", *s, *s);
+  fflush(stderr);
+   }
+
return i;
 }

@@ -937,6 +940,7 @@ read_pane_settings(char *str, unsigned * const x, unsigned 
* const y,

   default:
  fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *str);
+ fflush(stderr);
   }

}
@@ -1139,6 +1143,7 @@ hud_parse_env_var(struct hud_context *hud, const char 
*env)
 if (!hud_driver_query_install(>batch_query, pane, hud->pipe,
   name)) {
fprintf(stderr, "gallium_hud: unknown driver query '%s'\n", 
name);
+   fflush(stderr);
 }
  }
   }
@@ -1149,6 +1154,7 @@ hud_parse_env_var(struct hud_context *hud, const char 
*env)
  if (!pane) {
 fprintf(stderr, "gallium_hud: syntax error: unexpected ':', "
 "expected a name\n");
+fflush(stderr);
 break;
  }

@@ -1162,6 +1168,7 @@ hud_parse_env_var(struct hud_context *hud, const char 
*env)
  else {
 fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) "
 "after ':'\n", *env, *env);
+fflush(stderr);
  }
   }

@@ -1205,6 +1212,7 @@ hud_parse_env_var(struct hud_context *hud, const char 
*env)

   default:
  fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *env);
+ fflush(stderr);
   }

   /* Reset to defaults for the next pane in case these were modified. */
--
1.9.1

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


Re: [Mesa-dev] [PATCH 6/6] vbo: clean up with 'indent', whitespace fixes, etc in vbo_exec_array.c

2016-10-19 Thread Charmaine Lee

Series looks fine to me.
Some minor nit below.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


>From: Brian Paul <bri...@vmware.com>
>Sent: Wednesday, October 19, 2016 3:07 PM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee
>Subject: [PATCH 6/6] vbo: clean up with 'indent', whitespace fixes, etc in 
>vbo_exec_array.c

>---
> src/mesa/vbo/vbo_exec_array.c | 537 ++
> 1 file changed, 281 insertions(+), 256 deletions(-)

>diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c

>@@ -687,12 +688,13 @@ vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, 
>GLint first, GLsizei count
> static void
> dump_element_buffer(struct gl_context *ctx, GLenum type)
> {
>-   const GLvoid *map =
>-  ctx->Driver.MapBufferRange(ctx, 0,
>-ctx->Array.VAO->IndexBufferObj->Size,
>-GL_MAP_READ_BIT,
>- ctx->Array.VAO->IndexBufferObj,
>- MAP_INTERNAL);
>+   const GLvoid *map = ctx->Driver.MapBufferRange(ctx, 0,
>+  ctx->Array.VAO->
>+  IndexBufferObj->Size,

I prefer not to break up this line. It makes it less readable.

>+  GL_MAP_READ_BIT,
>+  ctx->Array.VAO->
>+  IndexBufferObj,

Same here.

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


Re: [Mesa-dev] [PATCH] svga: minor code improvements in svga_validate_pipe_sampler_view()

2016-10-18 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Tuesday, October 18, 2016 9:36 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] svga: minor code improvements in 
svga_validate_pipe_sampler_view()

Use the 'texture' local var in more places.
Rename 'pFormat' to 'viewFormat'.
---
 src/gallium/drivers/svga/svga_state_sampler.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_sampler.c 
b/src/gallium/drivers/svga/svga_state_sampler.c
index 53bb80f..445afcc 100644
--- a/src/gallium/drivers/svga/svga_state_sampler.c
+++ b/src/gallium/drivers/svga/svga_state_sampler.c
@@ -135,21 +135,21 @@ svga_validate_pipe_sampler_view(struct svga_context *svga,
   SVGA3dSurfaceFormat format;
   SVGA3dResourceType resourceDim;
   SVGA3dShaderResourceViewDesc viewDesc;
-  enum pipe_format pformat = sv->base.format;
+  enum pipe_format viewFormat = sv->base.format;

   /* vgpu10 cannot create a BGRX view for a BGRA resource, so force it to
* create a BGRA view (and vice versa).
*/
-  if (pformat == PIPE_FORMAT_B8G8R8X8_UNORM &&
-  sv->base.texture->format == PIPE_FORMAT_B8G8R8A8_UNORM) {
- pformat = PIPE_FORMAT_B8G8R8A8_UNORM;
+  if (viewFormat == PIPE_FORMAT_B8G8R8X8_UNORM &&
+  texture->format == PIPE_FORMAT_B8G8R8A8_UNORM) {
+ viewFormat = PIPE_FORMAT_B8G8R8A8_UNORM;
   }
-  else if (pformat == PIPE_FORMAT_B8G8R8A8_UNORM &&
-  sv->base.texture->format == PIPE_FORMAT_B8G8R8X8_UNORM) {
- pformat = PIPE_FORMAT_B8G8R8X8_UNORM;
+  else if (viewFormat == PIPE_FORMAT_B8G8R8A8_UNORM &&
+  texture->format == PIPE_FORMAT_B8G8R8X8_UNORM) {
+ viewFormat = PIPE_FORMAT_B8G8R8X8_UNORM;
   }

-  format = svga_translate_format(ss, pformat,
+  format = svga_translate_format(ss, viewFormat,
  PIPE_BIND_SAMPLER_VIEW);
   assert(format != SVGA3D_FORMAT_INVALID);

--
1.9.1

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


Re: [Mesa-dev] [PATCH 8/8] st/mesa: small optimization in swizzle_swizzle()

2016-09-23 Thread Charmaine Lee

Series looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Friday, September 23, 2016 8:48 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH 8/8] st/mesa: small optimization in swizzle_swizzle()

Usually, there's no user-specified texture swizzle so we can optimize
the swizzle_swizzle() function and skip the loop/switch.
---
 src/mesa/state_tracker/st_atom_texture.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_atom_texture.c 
b/src/mesa/state_tracker/st_atom_texture.c
index a613533..19df662 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -59,6 +59,11 @@ swizzle_swizzle(unsigned swizzle1, unsigned swizzle2)
 {
unsigned i, swz[4];

+   if (swizzle1 == SWIZZLE_XYZW) {
+  /* identity swizzle, no change to swizzle2 */
+  return swizzle2;
+   }
+
for (i = 0; i < 4; i++) {
   unsigned s = GET_SWZ(swizzle1, i);
   switch (s) {
--
1.9.1

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


Re: [Mesa-dev] [PATCH 1/8] svga: eliminate unneeded gotos in svga_validate_surface_view()

2016-09-23 Thread Charmaine Lee


>From: Brian Paul <bri...@vmware.com>
>Sent: Friday, September 23, 2016 8:48 AM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee
>Subject: [PATCH 1/8] svga: eliminate unneeded gotos in 
>svga_validate_surface_view()

>---
> src/gallium/drivers/svga/svga_surface.c | 9 +++--
> 1 file changed, 3 insertions(+), 6 deletions(-)

>diff --git a/src/gallium/drivers/svga/svga_surface.c 
>b/src/gallium/drivers/svga/svga_surface.c
>index 7cc7ef1..91bd4ca 100644
>--- a/src/gallium/drivers/svga/svga_surface.c
>+++ b/src/gallium/drivers/svga/svga_surface.c
>@@ -426,14 +426,12 @@ svga_validate_surface_view(struct svga_context *svga, 
>struct >svga_surface *s)
>   "same resource used in shaderResource and renderTarget 
> 0x%x\n",
>   s->handle);
>  s = create_backed_surface_view(svga, s);
>- if (!s)
>-goto done;
>-
>+ /* s may be null here if the function failed */
>  break;
>   }
>}

>-   if (s->view_id == SVGA3D_INVALID_ID) {
>+   if (s && s->view_id == SVGA3D_INVALID_ID) {
>   SVGA3dResourceType resType;
>   SVGA3dRenderTargetViewDesc desc;

>@@ -478,11 +476,10 @@ svga_validate_surface_view(struct svga_context *svga, 
>struct >svga_surface *s)
>   if (ret != PIPE_OK) {
>  util_bitmask_clear(svga->surface_view_id_bm, s->view_id);
>  s->view_id = SVGA3D_INVALID_ID;
>- goto done;
>+ s = NULL;
>   }
>}

>-done:
>SVGA_STATS_TIME_POP(svga_sws(svga));

>return >base;

We want to return NULL when we fail to create RenderTargetView.

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


Re: [Mesa-dev] [PATCH 1/8] svga: eliminate unneeded gotos in svga_validate_surface_view()

2016-09-23 Thread Charmaine Lee


>From: Brian Paul <bri...@vmware.com>
>Sent: Friday, September 23, 2016 8:48 AM
>To: mesa-dev@lists.freedesktop.org
>Cc: Charmaine Lee
>Subject: [PATCH 1/8] svga: eliminate unneeded gotos in 
>svga_validate_surface_view()

>---
> src/gallium/drivers/svga/svga_surface.c | 9 +++--
> 1 file changed, 3 insertions(+), 6 deletions(-)

>diff --git a/src/gallium/drivers/svga/svga_surface.c 
>b/src/gallium/drivers/svga/svga_surface.c
>index 7cc7ef1..91bd4ca 100644
>--- a/src/gallium/drivers/svga/svga_surface.c
>+++ b/src/gallium/drivers/svga/svga_surface.c
>@@ -426,14 +426,12 @@ svga_validate_surface_view(struct svga_context *svga, 
>struct >svga_surface *s)
>   "same resource used in shaderResource and renderTarget 
> 0x%x\n",
>   s->handle);
>  s = create_backed_surface_view(svga, s);
>- if (!s)
>-goto done;
>-
>+ /* s may be null here if the function failed */
>  break;
>   }
>}

>-   if (s->view_id == SVGA3D_INVALID_ID) {
>+   if (s && s->view_id == SVGA3D_INVALID_ID) {
>   SVGA3dResourceType resType;
>   SVGA3dRenderTargetViewDesc desc;

>@@ -478,11 +476,10 @@ svga_validate_surface_view(struct svga_context *svga, 
>struct >svga_surface *s)
>   if (ret != PIPE_OK) {
>  util_bitmask_clear(svga->surface_view_id_bm, s->view_id);
>  s->view_id = SVGA3D_INVALID_ID;
>- goto done;
>+ s = NULL;
>   }
>}

>-done:
>SVGA_STATS_TIME_POP(svga_sws(svga));

>return >base;

We want to return NULL when we fail to create RenderTargetView.

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


Re: [Mesa-dev] [PATCH 2/2] svga: minor simplification in svga_validate_surface_view()

2016-09-21 Thread Charmaine Lee

For the series, Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, September 21, 2016 8:25 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH 2/2] svga: minor simplification in svga_validate_surface_view()

Get rid of unneeded local var.
---
 src/gallium/drivers/svga/svga_surface.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_surface.c 
b/src/gallium/drivers/svga/svga_surface.c
index 42636bc..7cc7ef1 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -405,9 +405,9 @@ svga_validate_surface_view(struct svga_context *svga, 
struct svga_surface *s)
 {
enum pipe_error ret = PIPE_OK;
enum pipe_shader_type shader;
-   struct pipe_surface *surf = NULL;

assert(svga_have_vgpu10(svga));
+   assert(s);

SVGA_STATS_TIME_PUSH(svga_sws(svga),
 SVGA_STATS_TIME_VALIDATESURFACEVIEW);
@@ -481,12 +481,11 @@ svga_validate_surface_view(struct svga_context *svga, 
struct svga_surface *s)
  goto done;
   }
}
-   surf = >base;

 done:
SVGA_STATS_TIME_POP(svga_sws(svga));

-   return surf;
+   return >base;
 }


--
1.9.1

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


Re: [Mesa-dev] [PATCH] mesa: check for no matrix change in _mesa_LoadMatrixf()

2016-09-15 Thread Charmaine Lee

Looks good.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Thursday, September 15, 2016 8:34 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] mesa: check for no matrix change in _mesa_LoadMatrixf()

Some apps issue redundant glLoadMatrixf() calls with the same matrix.
Try to avoid setting dirty state in that situation.

This reduces the number of constant buffer updates by about half in
ET Quake Wars.

Tested with Piglit, ETQW, Sauerbraten, Google Earth, etc.
---
 src/mesa/main/matrix.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index b30b983..83f081e 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -356,9 +356,11 @@ _mesa_LoadMatrixf( const GLfloat *m )
   m[2], m[6], m[10], m[14],
   m[3], m[7], m[11], m[15]);

-   FLUSH_VERTICES(ctx, 0);
-   _math_matrix_loadf( ctx->CurrentStack->Top, m );
-   ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+   if (memcmp(m, ctx->CurrentStack->Top->m, 16 * sizeof(GLfloat)) != 0) {
+  FLUSH_VERTICES(ctx, 0);
+  _math_matrix_loadf( ctx->CurrentStack->Top, m );
+  ctx->NewState |= ctx->CurrentStack->DirtyFlag;
+   }
 }


--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: s/unsigned/enum pipe_shader_type/

2016-08-29 Thread Charmaine Lee

Reviewed-by:  Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Monday, August 29, 2016 9:16:09 AM
To: mesa-dev@lists.freedesktop.org
Cc: Neha Bhende; Charmaine Lee
Subject: [PATCH] svga: s/unsigned/enum pipe_shader_type/

---
 src/gallium/drivers/svga/svga_draw.c|  4 ++--
 src/gallium/drivers/svga/svga_pipe_sampler.c|  2 +-
 src/gallium/drivers/svga/svga_sampler_view.h|  2 +-
 src/gallium/drivers/svga/svga_shader.c  |  3 ++-
 src/gallium/drivers/svga/svga_shader.h  |  5 +++--
 src/gallium/drivers/svga/svga_state_constants.c | 12 ++--
 src/gallium/drivers/svga/svga_state_fs.c|  2 +-
 src/gallium/drivers/svga/svga_state_sampler.c   |  6 +++---
 src/gallium/drivers/svga/svga_state_tss.c   |  6 +++---
 src/gallium/drivers/svga/svga_state_vs.c|  2 +-
 src/gallium/drivers/svga/svga_surface.c |  2 +-
 11 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_draw.c 
b/src/gallium/drivers/svga/svga_draw.c
index 9e0dfe5..f8d3ae5 100644
--- a/src/gallium/drivers/svga/svga_draw.c
+++ b/src/gallium/drivers/svga/svga_draw.c
@@ -311,7 +311,7 @@ xlate_index_format(unsigned indexWidth)
 static enum pipe_error
 validate_sampler_resources(struct svga_context *svga)
 {
-   unsigned shader;
+   enum pipe_shader_type shader;

assert(svga_have_vgpu10(svga));

@@ -376,7 +376,7 @@ validate_sampler_resources(struct svga_context *svga)
 static enum pipe_error
 validate_constant_buffers(struct svga_context *svga)
 {
-   unsigned shader;
+   enum pipe_shader_type shader;

assert(svga_have_vgpu10(svga));

diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c 
b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 4a2b3c3..5d7af70 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -529,7 +529,7 @@ done:
 void
 svga_cleanup_sampler_state(struct svga_context *svga)
 {
-   unsigned shader;
+   enum pipe_shader_type shader;

if (!svga_have_vgpu10(svga))
   return;
diff --git a/src/gallium/drivers/svga/svga_sampler_view.h 
b/src/gallium/drivers/svga/svga_sampler_view.h
index b36f089..7521a82 100644
--- a/src/gallium/drivers/svga/svga_sampler_view.h
+++ b/src/gallium/drivers/svga/svga_sampler_view.h
@@ -102,7 +102,7 @@ svga_sampler_view_reference(struct svga_sampler_view **ptr, 
struct svga_sampler_
 boolean
 svga_check_sampler_view_resource_collision(struct svga_context *svga,
struct svga_winsys_surface *res,
-   unsigned shader);
+   enum pipe_shader_type shader);

 boolean
 svga_check_sampler_framebuffer_resource_collision(struct svga_context *svga,
diff --git a/src/gallium/drivers/svga/svga_shader.c 
b/src/gallium/drivers/svga/svga_shader.c
index 9ba6055..55f7922 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -166,7 +166,8 @@ svga_remap_generic_index(int8_t 
remap_table[MAX_GENERIC_VARYING],
  * state.  This is basically the texture-related state.
  */
 void
-svga_init_shader_key_common(const struct svga_context *svga, unsigned shader,
+svga_init_shader_key_common(const struct svga_context *svga,
+enum pipe_shader_type shader,
 struct svga_compile_key *key)
 {
unsigned i, idx = 0;
diff --git a/src/gallium/drivers/svga/svga_shader.h 
b/src/gallium/drivers/svga/svga_shader.h
index b53a4bf..ec116c0 100644
--- a/src/gallium/drivers/svga/svga_shader.h
+++ b/src/gallium/drivers/svga/svga_shader.h
@@ -253,7 +253,8 @@ svga_remap_generic_index(int8_t 
remap_table[MAX_GENERIC_VARYING],
  int generic_index);

 void
-svga_init_shader_key_common(const struct svga_context *svga, unsigned shader,
+svga_init_shader_key_common(const struct svga_context *svga,
+enum pipe_shader_type shader,
 struct svga_compile_key *key);

 struct svga_shader_variant *
@@ -310,7 +311,7 @@ svga_shader_too_large(const struct svga_context *svga,
  * Convert from PIPE_SHADER_* to SVGA3D_SHADERTYPE_*
  */
 static inline SVGA3dShaderType
-svga_shader_type(unsigned shader)
+svga_shader_type(enum pipe_shader_type shader)
 {
switch (shader) {
case PIPE_SHADER_VERTEX:
diff --git a/src/gallium/drivers/svga/svga_state_constants.c 
b/src/gallium/drivers/svga/svga_state_constants.c
index 8784f47..dc80edf 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -65,7 +65,7 @@
 static unsigned
 svga_get_extra_constants_common(struct svga_context *svga,
 const struct svga_shader_variant *variant,
-unsigned shader, float *dest)
+enum pipe_shader

Re: [Mesa-dev] [PATCH 2/2] svga: fix src/dst typo in can_blit_via_copy_region_vgpu10()

2016-08-17 Thread Charmaine Lee


Series looks good to me.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, August 17, 2016 7:40:13 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: fix src/dst typo in can_blit_via_copy_region_vgpu10()

The function was always returning false because of this typo.

Retested with piglit.  There's some sRGB-related blit failures, but
that seems unrelated.
---
 src/gallium/drivers/svga/svga_pipe_blit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c 
b/src/gallium/drivers/svga/svga_pipe_blit.c
index 1f6382e..9d8c4fe 100644
--- a/src/gallium/drivers/svga/svga_pipe_blit.c
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -223,7 +223,7 @@ can_blit_via_copy_region_vgpu10(struct svga_context *svga,
   return false;

stex = svga_texture(blit_info->src.resource);
-   dtex = svga_texture(blit_info->src.resource);
+   dtex = svga_texture(blit_info->dst.resource);

// can't copy within one resource
if (stex->handle == dtex->handle)
--
1.9.1

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


Re: [Mesa-dev] [PATCH] svga: remove incorrect buffer invalidation code

2016-08-15 Thread Charmaine Lee

Reviewed-by: Charmaine Lee <charmai...@vmware.com>


From: Brian Paul <bri...@vmware.com>
Sent: Monday, August 15, 2016 3:43:22 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] svga: remove incorrect buffer invalidation code

Fixes regression with team_fortress_2 trace.
This change has been in our in-house tree for some time.
---
 src/gallium/drivers/svga/svga_screen_cache.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen_cache.c 
b/src/gallium/drivers/svga/svga_screen_cache.c
index bce46df..86a0413 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.c
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -558,11 +558,6 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen,
 * that case.
 */
if (SVGA_SURFACE_CACHE_ENABLED && key->cachable) {
-
-  /* Invalidate the surface before putting it into the recycle pool */
-  if (key->format != SVGA3D_BUFFER)
- sws->surface_invalidate(sws, *p_handle);
-
   svga_screen_cache_add(svgascreen, key, p_handle);
}
else {
--
1.9.1

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


  1   2   >