Re: [Mesa-dev] [PATCH] gallium/r600: Replace ALIGN_DIVUP with DIV_ROUND_UP

2016-01-06 Thread Krzysztof A. Sobiecki
Nicolai Hähnle  writes:

> On 30.12.2015 13:44, Krzysztof A. Sobiecki wrote:
>> Nicolai Hähnle  writes:
>>
>>> On 30.12.2015 08:42, Krzysztof A. Sobiecki wrote:
>>>> Nicolai Hähnle  writes:
>>>>
>>>>> On 29.12.2015 14:27, Krzysztof A. Sobiecki wrote:
>>>>>> From: Krzysztof Sobiecki 
>>>>>>
>>>>>> ALIGN_DIVUP is a driver specific(r600g) macro that duplicates 
>>>>>> DIV_ROUND_UP functionality.
>>>>>> Replacing it with DIV_ROUND_UP eliminates this problems.
>>>>>
>>>>> Those macros are actually slightly different, and the assembly
>>>>> generated by the ALIGN_DIVUP looks clearly better to me.
>>>>>
>>>>> I remember seeing a very long thread about this not so long ago - what
>>>>> was the resolution there?
>>>>>
>>>>> Cheers,
>>>>> Nicolai
>>>>>
>>>> I would like to remove ALIGN_DIVUP first and then debate with
>>>> implementation DIV_ROUND_UP should use.
>>>>
>>>> btw. I prefer 1 + ((x - 1) / y)
>>>
>>> That produces an incorrect result when x is an unsigned type and equal
>>> to 0 -- and that is something that existing code definitely relies on.
>>>
>>> Cheers,
>>> Nicolai
>>>
>> Then what about (x / y) + (i % y != 0)
>
> Generates similar assembly to the DIV_ROUND_UP version.
>
> Anyway, now that I look at it again I'd say just go ahead and add my
> R-b. Yes, the assembly looks slightly worse, but only slightly, and
> avoiding surprises with overflows down the line seems like a good
> idea.
>
> Cheers,
> Nicolai
>
I don't have commit access, can you push it, sorry.
-- 
X was an interactive protocol: 
alpha blending a full-screen image looked like slugs racing down the monitor. 
http://www.keithp.com/~keithp/talks/usenix2000/render.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium/r600: Replace ALIGN_DIVUP with DIV_ROUND_UP

2015-12-30 Thread Krzysztof A. Sobiecki
Nicolai Hähnle  writes:

> On 30.12.2015 08:42, Krzysztof A. Sobiecki wrote:
>> Nicolai Hähnle  writes:
>>
>>> On 29.12.2015 14:27, Krzysztof A. Sobiecki wrote:
>>>> From: Krzysztof Sobiecki 
>>>>
>>>> ALIGN_DIVUP is a driver specific(r600g) macro that duplicates DIV_ROUND_UP 
>>>> functionality.
>>>> Replacing it with DIV_ROUND_UP eliminates this problems.
>>>
>>> Those macros are actually slightly different, and the assembly
>>> generated by the ALIGN_DIVUP looks clearly better to me.
>>>
>>> I remember seeing a very long thread about this not so long ago - what
>>> was the resolution there?
>>>
>>> Cheers,
>>> Nicolai
>>>
>> I would like to remove ALIGN_DIVUP first and then debate with
>> implementation DIV_ROUND_UP should use.
>>
>> btw. I prefer 1 + ((x - 1) / y)
>
> That produces an incorrect result when x is an unsigned type and equal
> to 0 -- and that is something that existing code definitely relies on.
>
> Cheers,
> Nicolai
>
Then what about (x / y) + (i % y != 0)

-- 
X was an interactive protocol: 
alpha blending a full-screen image looked like slugs racing down the monitor. 
http://www.keithp.com/~keithp/talks/usenix2000/render.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium/r600: Replace ALIGN_DIVUP with DIV_ROUND_UP

2015-12-30 Thread Krzysztof A. Sobiecki
Nicolai Hähnle  writes:

> On 29.12.2015 14:27, Krzysztof A. Sobiecki wrote:
>> From: Krzysztof Sobiecki 
>>
>> ALIGN_DIVUP is a driver specific(r600g) macro that duplicates DIV_ROUND_UP 
>> functionality.
>> Replacing it with DIV_ROUND_UP eliminates this problems.
>
> Those macros are actually slightly different, and the assembly
> generated by the ALIGN_DIVUP looks clearly better to me.
>
> I remember seeing a very long thread about this not so long ago - what
> was the resolution there?
>
> Cheers,
> Nicolai
>
I would like to remove ALIGN_DIVUP first and then debate with
implementation DIV_ROUND_UP should use.

btw. I prefer 1 + ((x - 1) / y)

-- 
X was an interactive protocol: 
alpha blending a full-screen image looked like slugs racing down the monitor. 
http://www.keithp.com/~keithp/talks/usenix2000/render.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/r600: Replace ALIGN_DIVUP with DIV_ROUND_UP

2015-12-29 Thread Krzysztof A. Sobiecki
From: Krzysztof Sobiecki 

ALIGN_DIVUP is a driver specific(r600g) macro that duplicates DIV_ROUND_UP 
functionality.
Replacing it with DIV_ROUND_UP eliminates this problems.

Signed-off-by: Krzysztof A. Sobiecki 
---
 src/gallium/drivers/r600/evergreen_state.c | 2 +-
 src/gallium/drivers/r600/r600_pipe.h   | 1 -
 src/gallium/drivers/r600/r600_state.c  | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 1aee7dd..9dfb849 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1956,7 +1956,7 @@ static void evergreen_emit_constant_buffers(struct 
r600_context *rctx,
 
if (!gs_ring_buffer) {
radeon_set_context_reg_flag(cs, reg_alu_constbuf_size + 
buffer_index * 4,
-   
ALIGN_DIVUP(cb->buffer_size, 256), pkt_flags);
+   
DIV_ROUND_UP(cb->buffer_size, 256), pkt_flags);
radeon_set_context_reg_flag(cs, reg_alu_const_cache + 
buffer_index * 4, va >> 8,
pkt_flags);
}
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 31f2a72..0e4dd16 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -946,7 +946,6 @@ static inline uint32_t S_FIXED(float value, uint32_t 
frac_bits)
 {
return value * (1 << frac_bits);
 }
-#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
 
 /* 12.4 fixed-point */
 static inline unsigned r600_pack_float_12p4(float x)
diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index 43b8074..f60e304 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1768,7 +1768,7 @@ static void r600_emit_constant_buffers(struct 
r600_context *rctx,
 
if (!gs_ring_buffer) {
radeon_set_context_reg(cs, reg_alu_constbuf_size + 
buffer_index * 4,
-  ALIGN_DIVUP(cb->buffer_size, 
256));
+  DIV_ROUND_UP(cb->buffer_size, 
256));
radeon_set_context_reg(cs, reg_alu_const_cache + 
buffer_index * 4, offset >> 8);
}
 
-- 
2.7.0.rc0.173.g4a846af

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


Re: [Mesa-dev] [PATCH] st/fbo: use pipe_surface_release instead of pipe_surface_reference

2015-10-14 Thread Krzysztof A. Sobiecki
Brian Paul  writes:
> Reviewed-by: Brian Paul 
>
> Do you need me to commit this for you?
>
> -Brian
>
Yes, it would be nice.
Thanks.
-- 
X was an interactive protocol: 
alpha blending a full-screen image looked like slugs racing down the monitor. 
http://www.keithp.com/~keithp/talks/usenix2000/render.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] st/fbo: use pipe_surface_release instead of pipe_surface_reference

2015-10-14 Thread Krzysztof A. Sobiecki
From: Krzysztof Sobiecki 

pipe_surface_reference have problems with deleted contexts,
so use of pipe_surface_release might be more appropriate.

Fixes Wasteland 2 Director's Cut crash on start.
---
 src/mesa/state_tracker/st_cb_fbo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index ff703fa..2a2eb09 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -456,7 +456,7 @@ st_update_renderbuffer_surface(struct st_context *st,
   surf_tmpl.u.tex.first_layer = first_layer;
   surf_tmpl.u.tex.last_layer = last_layer;
 
-  pipe_surface_reference(&strb->surface, NULL);
+  pipe_surface_release(pipe, &strb->surface);
 
   strb->surface = pipe->create_surface(pipe, resource, &surf_tmpl);
}
-- 
2.6.1.204.gc021fdf

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


[Mesa-dev] [PATCH] st/nine: Disable NV path, it's broken right now.

2015-08-21 Thread Krzysztof A. Sobiecki
st/nine: Disable NV path, it's broken right now.

Signed-off-by: Krzysztof Sobiecki 
---
 src/gallium/state_trackers/nine/device9.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 673b7a4..555f11d 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -310,10 +310,12 @@ NineDevice9_ctor( struct NineDevice9 *This,
 
 if (strstr(pScreen->get_name(pScreen), "AMD") ||
 strstr(pScreen->get_name(pScreen), "ATI")) {
-This->prefer_user_constbuf = TRUE;
 This->driver_bugs.buggy_barycentrics = TRUE;
 }
 
+/* Disable NV path for now, needs some fixes */
+This->prefer_user_constbuf = TRUE;
+
 tmpl.target = PIPE_BUFFER;
 tmpl.format = PIPE_FORMAT_R8_UNORM;
 tmpl.height0 = 1;
-- 
2.5.0.276.gf5e568e

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


Re: [Mesa-dev] Potential fix for #70410

2014-02-04 Thread Krzysztof A. Sobiecki
"Armin K."  writes:
> This would be easier to fix in LLVM. The newline is rather unnecessary
> in the output.
I'm neither able or willing to hack LLVM, but
https://bugs.freedesktop.org/attachment.cgi?id=91751 looks nice?

-- 
X was an interactive protocol: 
alpha blending a full-screen image looked like slugs racing down the monitor. 
http://www.keithp.com/~keithp/talks/usenix2000/render.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Potential fix for #70410

2014-02-04 Thread Krzysztof A. Sobiecki
A small patch to work around a llvm-config-3.5 change, with a newline
hack.

Signed-off-by: Krzysztof Sobiecki  gmail.com>
Tested-by: Kai Wasserbäch 
---

LLVM 3.5 added --system-libs to llvm-config, fix build failure.
Fixes #70410

diff --git a/configure.ac b/configure.ac
index ba158e8..c31d962 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1843,7 +1843,12 @@ dnl in LLVM_LIBS.
 
 if test "x$MESA_LLVM" != x0; then
 
-LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
+if test $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5 ; then
+LLVM_LIBS="`$LLVM_CONFIG --system-libs --libs ${LLVM_COMPONENTS} |tr "\n" " "`"
+dnl Because my llvm-config adds a new line...
+else
+LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
+fi
 
 if test "x$with_llvm_shared_libs" = xyes; then
 dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,

-- 
X was an interactive protocol: 
alpha blending a full-screen image looked like slugs racing down the monitor. 
http://www.keithp.com/~keithp/talks/usenix2000/render.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev