[Mesa-dev] gallium scaled types

2011-09-11 Thread Dave Airlie
Hi guys,

not really finding a great explaination in my 2 minute search, of what
the USCALED and SSCALED types are representative of

On r600 hw at least we have a SCALED type, which seems to be an
integer in float point format, as well as an INT type which is natural
integers.

Are the gallium scaled types meant to be the first or the second, and
would anyone object to renaming them to UINT/SINT if the latter is the
case,
if its the former, then we need to add a whole set of new UINT/SINT types.

At least the stencil types should be renamed to UINT since they are
always native integers.

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


Re: [Mesa-dev] Fixup: Use C++ style constant member functions for is_one and is_zero.

2011-09-11 Thread Tolga Dalman
Hi Kenneth,

On Fri,  9 Sep 2011 14:41:45 -0700
Kenneth Graunke  wrote:

> -   if (reg->type == BRW_REGISTER_TYPE_F) {
> -  return reg->imm.f == 0.0;
> +   if (type == BRW_REGISTER_TYPE_F) {
> +  return imm.f == 0.0;
[...]
> -   if (reg->type == BRW_REGISTER_TYPE_F) {
> -  return reg->imm.f == 1.0;
> +   if (type == BRW_REGISTER_TYPE_F) {
> +  return imm.f == 1.0;

Shouldn't this rather be something like
fabs(imm.f - 1.0) < std::numeric_limits::eps() ?

Nevertheless, I like your patch.

Best regards
Tolga Dalman


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


[Mesa-dev] [PATCH] pb_buffer: inline 'base' sub-struct

2011-09-11 Thread Marek Olšák
---
 src/gallium/auxiliary/pipebuffer/pb_buffer.h   |   24 ++
 .../auxiliary/pipebuffer/pb_buffer_fenced.c|   32 ++--
 .../auxiliary/pipebuffer/pb_buffer_malloc.c|8 ++--
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |   30 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c |   30 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c|   10 +++---
 .../auxiliary/pipebuffer/pb_bufmgr_ondemand.c  |8 ++--
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c  |   18 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c  |   18 +-
 src/gallium/winsys/r600/drm/r600_hw_context.c  |2 +-
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c  |   18 +-
 src/gallium/winsys/svga/drm/vmw_buffer.c   |8 ++--
 src/gallium/winsys/svga/drm/vmw_context.c  |2 +-
 13 files changed, 102 insertions(+), 106 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h 
b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 5a13f39..a5ec93c 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -97,14 +97,10 @@ typedef unsigned pb_size;
  */
 struct pb_buffer 
 {
-   /* This used to be a pipe_buffer struct:
-*/
-   struct {
-  struct pipe_reference  reference;
-  unsigned   size;
-  unsigned   alignment;
-  unsigned   usage;
-   } base;
+   struct pipe_reference  reference;
+   unsigned   size;
+   unsigned   alignment;
+   unsigned   usage;
 
/**
 * Pointer to the virtual function table.
@@ -169,7 +165,7 @@ pb_map(struct pb_buffer *buf,
assert(buf);
if(!buf)
   return NULL;
-   assert(pipe_is_referenced(&buf->base.reference));
+   assert(pipe_is_referenced(&buf->reference));
return buf->vtbl->map(buf, flags, flush_ctx);
 }
 
@@ -180,7 +176,7 @@ pb_unmap(struct pb_buffer *buf)
assert(buf);
if(!buf)
   return;
-   assert(pipe_is_referenced(&buf->base.reference));
+   assert(pipe_is_referenced(&buf->reference));
buf->vtbl->unmap(buf);
 }
 
@@ -196,11 +192,11 @@ pb_get_base_buffer( struct pb_buffer *buf,
   offset = 0;
   return;
}
-   assert(pipe_is_referenced(&buf->base.reference));
+   assert(pipe_is_referenced(&buf->reference));
assert(buf->vtbl->get_base_buffer);
buf->vtbl->get_base_buffer(buf, base_buf, offset);
assert(*base_buf);
-   assert(*offset < (*base_buf)->base.size);
+   assert(*offset < (*base_buf)->size);
 }
 
 
@@ -232,7 +228,7 @@ pb_destroy(struct pb_buffer *buf)
assert(buf);
if(!buf)
   return;
-   assert(!pipe_is_referenced(&buf->base.reference));
+   assert(!pipe_is_referenced(&buf->reference));
buf->vtbl->destroy(buf);
 }
 
@@ -242,7 +238,7 @@ pb_reference(struct pb_buffer **dst,
 {
struct pb_buffer *old = *dst;
 
-   if (pipe_reference(&(*dst)->base.reference, &src->base.reference))
+   if (pipe_reference(&(*dst)->reference, &src->reference))
   pb_destroy( old );
*dst = src;
 }
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c 
b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index c310f28..9e0cace 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -210,8 +210,8 @@ fenced_manager_dump_locked(struct fenced_manager 
*fenced_mgr)
   assert(!fenced_buf->fence);
   debug_printf("%10p %7u %8u %7s\n",
(void *) fenced_buf,
-   fenced_buf->base.base.size,
-   p_atomic_read(&fenced_buf->base.base.reference.count),
+   fenced_buf->base.size,
+   p_atomic_read(&fenced_buf->base.reference.count),
fenced_buf->buffer ? "gpu" : (fenced_buf->data ? "cpu" : 
"none"));
   curr = next;
   next = curr->next;
@@ -226,8 +226,8 @@ fenced_manager_dump_locked(struct fenced_manager 
*fenced_mgr)
   signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
   debug_printf("%10p %7u %8u %7s %10p %s\n",
(void *) fenced_buf,
-   fenced_buf->base.base.size,
-   p_atomic_read(&fenced_buf->base.base.reference.count),
+   fenced_buf->base.size,
+   p_atomic_read(&fenced_buf->base.reference.count),
"gpu",
(void *) fenced_buf->fence,
signaled == 0 ? "y" : "n");
@@ -244,7 +244,7 @@ static INLINE void
 fenced_buffer_destroy_locked(struct fenced_manager *fenced_mgr,
  struct fenced_buffer *fenced_buf)
 {
-   assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
+   assert(!pipe_is_referenced(&fenced_buf->base.reference));
 
assert(!fenced_buf->fence);
assert(fenced_buf->head.prev);
@@ -269,11 +269,11 @@ static INLINE void
 fenced_buffer_add_locked(

Re: [Mesa-dev] Fixup: Use C++ style constant member functions for is_one and is_zero.

2011-09-11 Thread Corbin Simpson
I haven't read the surrounding code, but I'm relatively sure this
patch covers whether or not the given register can be filled with a
constant zero or one, which would be represented in the shader as a
special swizzle or selector. In that case, you'd only want to match
exact 0.0 and 1.0, but that's okay, because both 0.0 and 1.0 are
relatively common constants.

~ C.

On Sun, Sep 11, 2011 at 4:05 AM, Tolga Dalman
 wrote:
> Hi Kenneth,
>
> On Fri,  9 Sep 2011 14:41:45 -0700
> Kenneth Graunke  wrote:
>
>> -   if (reg->type == BRW_REGISTER_TYPE_F) {
>> -      return reg->imm.f == 0.0;
>> +   if (type == BRW_REGISTER_TYPE_F) {
>> +      return imm.f == 0.0;
> [...]
>> -   if (reg->type == BRW_REGISTER_TYPE_F) {
>> -      return reg->imm.f == 1.0;
>> +   if (type == BRW_REGISTER_TYPE_F) {
>> +      return imm.f == 1.0;
>
> Shouldn't this rather be something like
> fabs(imm.f - 1.0) < std::numeric_limits::eps() ?
>
> Nevertheless, I like your patch.
>
> Best regards
> Tolga Dalman
>
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 
When the facts change, I change my mind. What do you do, sir? ~ Keynes

Corbin Simpson

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


Re: [Mesa-dev] gallium scaled types

2011-09-11 Thread Dave Airlie
On Sun, Sep 11, 2011 at 10:11 AM, Dave Airlie  wrote:
> Hi guys,
>
> not really finding a great explaination in my 2 minute search, of what
> the USCALED and SSCALED types are representative of
>
> On r600 hw at least we have a SCALED type, which seems to be an
> integer in float point format, as well as an INT type which is natural
> integers.

Talked on irc with calim and mareko, makes sense now, need to add
UINT/SINT types
will document things maybe a bit more on my way past.

will also rename the stencil types.

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