Re: [Mesa-dev] [PATCH 01/11] nvc0: allocate more space before a counter is configured

2014-07-08 Thread Ilia Mirkin
On Sat, Jul 5, 2014 at 7:41 PM, Martin Peres  wrote:
> On 05/07/2014 20:49, Samuel Pitoiset wrote:
>>
>> On nvc0, a counter can up to 6 sources instead of only one
>> for nve4+. This fixes a crash when a counter uses more than
>> one source.
>
> The verb is missing in the first sentence :)

Yeah, he accidentally the whole sentence[1]. But I fixed it up before
pushing it.

  -ilia

[1] http://ultimate-photos.com/share/i-just-accidentally-a-coca-cola-bottle.jpg
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/11] nvc0: allocate more space before a counter is configured

2014-07-08 Thread Martin Peres

On 05/07/2014 20:49, Samuel Pitoiset wrote:

On nvc0, a counter can up to 6 sources instead of only one
for nve4+. This fixes a crash when a counter uses more than
one source.

The verb is missing in the first sentence :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/11] nvc0: allocate more space before a counter is configured

2014-07-05 Thread Ilia Mirkin
On Sat, Jul 5, 2014 at 2:49 PM, Samuel Pitoiset
 wrote:
> On nvc0, a counter can up to 6 sources instead of only one
> for nve4+. This fixes a crash when a counter uses more than
> one source.
>
> Signed-off-by: Samuel Pitoiset 

Reviewed-by: Ilia Mirkin 

> ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> index 70fe270..50cef1e 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> @@ -1067,6 +1067,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, 
> struct nvc0_query *q)
>  {
> struct nvc0_screen *screen = nvc0->screen;
> struct nouveau_pushbuf *push = nvc0->base.pushbuf;
> +   const boolean is_nve4 = screen->base.class_3d >= NVE4_3D_CLASS;
> const struct nvc0_mp_pm_query_cfg *cfg;
> unsigned i, c;
> unsigned num_ab[2] = { 0, 0 };
> @@ -1084,7 +1085,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, 
> struct nvc0_query *q)
> }
>
> assert(cfg->num_counters <= 4);
> -   PUSH_SPACE(push, 4 * 8 + 6);
> +   PUSH_SPACE(push, 4 * 8 * (is_nve4 ? 1 : 6) + 6);
>
> if (!screen->pm.mp_counters_enabled) {
>screen->pm.mp_counters_enabled = TRUE;
> @@ -1118,7 +1119,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, 
> struct nvc0_query *q)
>assert(c <= (d * 4 + 3)); /* must succeed, already checked for space */
>
>/* configure and reset the counter(s) */
> -  if (screen->base.class_3d >= NVE4_3D_CLASS) {
> +  if (is_nve4) {
>   if (d == 0)
>  BEGIN_NVC0(push, NVE4_COMPUTE(MP_PM_A_SIGSEL(c & 3)), 1);
>   else
> --
> 2.0.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/11] nvc0: allocate more space before a counter is configured

2014-07-05 Thread Samuel Pitoiset
On nvc0, a counter can up to 6 sources instead of only one
for nve4+. This fixes a crash when a counter uses more than
one source.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 70fe270..50cef1e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -1067,6 +1067,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, struct 
nvc0_query *q)
 {
struct nvc0_screen *screen = nvc0->screen;
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
+   const boolean is_nve4 = screen->base.class_3d >= NVE4_3D_CLASS;
const struct nvc0_mp_pm_query_cfg *cfg;
unsigned i, c;
unsigned num_ab[2] = { 0, 0 };
@@ -1084,7 +1085,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, struct 
nvc0_query *q)
}
 
assert(cfg->num_counters <= 4);
-   PUSH_SPACE(push, 4 * 8 + 6);
+   PUSH_SPACE(push, 4 * 8 * (is_nve4 ? 1 : 6) + 6);
 
if (!screen->pm.mp_counters_enabled) {
   screen->pm.mp_counters_enabled = TRUE;
@@ -1118,7 +1119,7 @@ nvc0_mp_pm_query_begin(struct nvc0_context *nvc0, struct 
nvc0_query *q)
   assert(c <= (d * 4 + 3)); /* must succeed, already checked for space */
 
   /* configure and reset the counter(s) */
-  if (screen->base.class_3d >= NVE4_3D_CLASS) {
+  if (is_nve4) {
  if (d == 0)
 BEGIN_NVC0(push, NVE4_COMPUTE(MP_PM_A_SIGSEL(c & 3)), 1);
  else
-- 
2.0.0

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