Mesa (master): dri/common: fix gbm-symbols-check regression

2015-09-20 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 8f6fd57db2275df8f86a5a173575b7d807508625
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f6fd57db2275df8f86a5a173575b7d807508625

Author: Marcin Ślusarz <marcin.slus...@gmail.com>
Date:   Sun Sep 20 13:40:10 2015 +0200

dri/common: fix gbm-symbols-check regression

Broken by commit c228514c72cb2fd5fb9e510808e29204fc9e7ae1
"dri/common: use sysconfdir when looking for drirc".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92054
Signed-off-by: Marcin Ślusarz <marcin.slus...@gmail.com>

---

 src/mesa/drivers/dri/common/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/Makefile.am 
b/src/mesa/drivers/dri/common/Makefile.am
index ea52cb5..2973a06 100644
--- a/src/mesa/drivers/dri/common/Makefile.am
+++ b/src/mesa/drivers/dri/common/Makefile.am
@@ -34,7 +34,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary \
$(LIBDRM_CFLAGS) \
$(DEFINES) \
-   -DSYSCONFDIR=\"$(sysconfdir)\"
+   -DSYSCONFDIR=\"$(sysconfdir)\" \
$(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \

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


Mesa (master): dri/common: use sysconfdir when looking for drirc

2015-09-19 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: c228514c72cb2fd5fb9e510808e29204fc9e7ae1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c228514c72cb2fd5fb9e510808e29204fc9e7ae1

Author: Marcin Ślusarz <marcin.slus...@gmail.com>
Date:   Sat Sep 19 19:17:34 2015 +0200

dri/common: use sysconfdir when looking for drirc

Useful when locally installed mesa has more quirks than the system one.

Signed-off-by: Marcin Ślusarz <marcin.slus...@gmail.com>
Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---

 docs/autoconf.html  |9 -
 src/mesa/drivers/dri/common/Makefile.am |1 +
 src/mesa/drivers/dri/common/xmlconfig.c |6 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/docs/autoconf.html b/docs/autoconf.html
index 2ef8c63..5c29e5e 100644
--- a/docs/autoconf.html
+++ b/docs/autoconf.html
@@ -87,6 +87,13 @@ created in a lib64 directory at the top of the 
Mesa source
 tree.
 
 
+--sysconfdir=DIR
+This option specifies the directory where the configuration
+files will be installed. The default is ${prefix}/etc.
+Currently there's only one config file provided when dri drivers are
+enabled - it's drirc.
+
+
 --enable-static, --disable-shared
 By default, Mesa
 will build shared libraries. Either of these options will force static
@@ -217,7 +224,7 @@ GLX.
 --with-expat=DIR
 DEPRECATED, use PKG_CONFIG_PATH 
instead.
 The DRI-enabled libGL uses expat to
-parse the DRI configuration files in /etc/drirc and
+parse the DRI configuration files in ${sysconfdir}/drirc and
 ~/.drirc. This option allows a specific expat installation
 to be used. For example, --with-expat=/usr/local will
 search for expat headers and libraries in /usr/local/include
diff --git a/src/mesa/drivers/dri/common/Makefile.am 
b/src/mesa/drivers/dri/common/Makefile.am
index b307f10..ea52cb5 100644
--- a/src/mesa/drivers/dri/common/Makefile.am
+++ b/src/mesa/drivers/dri/common/Makefile.am
@@ -34,6 +34,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary \
$(LIBDRM_CFLAGS) \
$(DEFINES) \
+   -DSYSCONFDIR=\"$(sysconfdir)\"
$(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c 
b/src/mesa/drivers/dri/common/xmlconfig.c
index f17693e..b8ab480 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -935,9 +935,13 @@ static void parseOneConfigFile (XML_Parser p) {
 #undef BUF_SIZE
 }
 
+#ifndef SYSCONFDIR
+#define SYSCONFDIR "/etc"
+#endif
+
 void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
  int screenNum, const char *driverName) {
-char *filenames[2] = {"/etc/drirc", NULL};
+char *filenames[2] = { SYSCONFDIR "/drirc", NULL};
 char *home;
 uint32_t i;
 struct OptConfData userData;

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


Mesa (master): nouveau: synchronize scratch runout destruction with the command stream

2015-03-31 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: f9e2295560f9b4869fa2a94933c1881ec7970af4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9e2295560f9b4869fa2a94933c1881ec7970af4

Author: Marcin Ślusarz marcin.slus...@gmail.com
Date:   Tue Mar 31 22:04:31 2015 +0200

nouveau: synchronize scratch runout destruction with the command stream

When nvc0_push_vbo calls nouveau_scratch_done it does not mean
scratch buffers can be freed immediately. It means when hardware
advances to this place in the command stream the scratch buffers
can be freed.

To fix it, just postpone scratch runout destruction after current
fence is signalled.

The bug existed for a very long time. Nobody noticed, because
scratch runout code path is rarely executed.

Fixes hang at the very beginning of first mission in Serious Sam 3
on nve7/gk107. It manifested as:

nouveau E[   PFIFO][:01:00.0] read fault at 0x000a9e [PTE] from 
GR/GPC0/PE_2 on channel 0x007f853000 [Sam3[17056]]

Cc: 10.4 10.5 mesa-sta...@lists.freedesktop.org
Reviewed-by: Ilia Mirkin imir...@alum.mit.edu

---

 src/gallium/drivers/nouveau/nouveau_buffer.c  |   48 -
 src/gallium/drivers/nouveau/nouveau_context.h |8 +++--
 2 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c 
b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 49ff100..32fa65c 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -846,17 +846,28 @@ nouveau_scratch_bo_alloc(struct nouveau_context *nv, 
struct nouveau_bo **pbo,
  4096, size, NULL, pbo);
 }
 
+static void
+nouveau_scratch_unref_bos(void *d)
+{
+   struct runout *b = d;
+   int i;
+
+   for (i = 0; i  b-nr; ++i)
+  nouveau_bo_ref(NULL, b-bo[i]);
+
+   FREE(b);
+}
+
 void
 nouveau_scratch_runout_release(struct nouveau_context *nv)
 {
-   if (!nv-scratch.nr_runout)
+   if (!nv-scratch.runout)
+  return;
+
+   if (!nouveau_fence_work(nv-screen-fence.current, 
nouveau_scratch_unref_bos,
+ nv-scratch.runout))
   return;
-   do {
-  --nv-scratch.nr_runout;
-  nouveau_bo_ref(NULL, nv-scratch.runout[nv-scratch.nr_runout]);
-   } while (nv-scratch.nr_runout);
 
-   FREE(nv-scratch.runout);
nv-scratch.end = 0;
nv-scratch.runout = NULL;
 }
@@ -868,21 +879,26 @@ static INLINE boolean
 nouveau_scratch_runout(struct nouveau_context *nv, unsigned size)
 {
int ret;
-   const unsigned n = nv-scratch.nr_runout++;
+   unsigned n;
 
-   nv-scratch.runout = REALLOC(nv-scratch.runout,
-(n + 0) * sizeof(*nv-scratch.runout),
-(n + 1) * sizeof(*nv-scratch.runout));
-   nv-scratch.runout[n] = NULL;
-
-   ret = nouveau_scratch_bo_alloc(nv, nv-scratch.runout[n], size);
+   if (nv-scratch.runout)
+  n = nv-scratch.runout-nr;
+   else
+  n = 0;
+   nv-scratch.runout = REALLOC(nv-scratch.runout, n == 0 ? 0 :
+(sizeof(*nv-scratch.runout) + (n + 0) * 
sizeof(void *)),
+ sizeof(*nv-scratch.runout) + (n + 1) * 
sizeof(void *));
+   nv-scratch.runout-nr = n + 1;
+   nv-scratch.runout-bo[n] = NULL;
+
+   ret = nouveau_scratch_bo_alloc(nv, nv-scratch.runout-bo[n], size);
if (!ret) {
-  ret = nouveau_bo_map(nv-scratch.runout[n], 0, NULL);
+  ret = nouveau_bo_map(nv-scratch.runout-bo[n], 0, NULL);
   if (ret)
- nouveau_bo_ref(NULL, nv-scratch.runout[--nv-scratch.nr_runout]);
+ nouveau_bo_ref(NULL, 
nv-scratch.runout-bo[--nv-scratch.runout-nr]);
}
if (!ret) {
-  nv-scratch.current = nv-scratch.runout[n];
+  nv-scratch.current = nv-scratch.runout-bo[n];
   nv-scratch.offset = 0;
   nv-scratch.end = size;
   nv-scratch.map = nv-scratch.current-map;
diff --git a/src/gallium/drivers/nouveau/nouveau_context.h 
b/src/gallium/drivers/nouveau/nouveau_context.h
index 14608d3..c2ba015 100644
--- a/src/gallium/drivers/nouveau/nouveau_context.h
+++ b/src/gallium/drivers/nouveau/nouveau_context.h
@@ -40,8 +40,10 @@ struct nouveau_context {
   unsigned end;
   struct nouveau_bo *bo[NOUVEAU_MAX_SCRATCH_BUFS];
   struct nouveau_bo *current;
-  struct nouveau_bo **runout;
-  unsigned nr_runout;
+  struct runout {
+ unsigned nr;
+ struct nouveau_bo *bo[0];
+  } *runout;
   unsigned bo_size;
} scratch;
 
@@ -71,7 +73,7 @@ static INLINE void
 nouveau_scratch_done(struct nouveau_context *nv)
 {
nv-scratch.wrap = nv-scratch.id;
-   if (unlikely(nv-scratch.nr_runout))
+   if (unlikely(nv-scratch.runout))
   nouveau_scratch_runout_release(nv);
 }
 

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


Mesa (master): dri/nouveau: fix crash in nouveau_flush

2013-03-07 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 17f1cb1d99e66227d1e05925ef937643f5c1089a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=17f1cb1d99e66227d1e05925ef937643f5c1089a

Author: Jan de Groot j...@jgc.homeip.net
Date:   Thu Mar  7 19:48:13 2013 +0100

dri/nouveau: fix crash in nouveau_flush

https://bugs.freedesktop.org/show_bug.cgi?id=61947

Note: this is a candidate for the stable branches

---

 src/mesa/drivers/dri/nouveau/nouveau_driver.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index f56b3b2..6c119d5 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -69,7 +69,8 @@ nouveau_flush(struct gl_context *ctx)
__DRIdri2LoaderExtension *dri2 = screen-dri2.loader;
__DRIdrawable *drawable = nctx-dri_context-driDrawablePriv;
 
-   dri2-flushFrontBuffer(drawable, drawable-loaderPrivate);
+   if (drawable  drawable-loaderPrivate)
+   dri2-flushFrontBuffer(drawable, 
drawable-loaderPrivate);
}
 }
 

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


Mesa (master): dri/nouveau: NV17_3D class is not available for NV1a chipset

2013-03-05 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: f4ebcd133b9c952fc57ce6d5df8bce8e2282d868
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4ebcd133b9c952fc57ce6d5df8bce8e2282d868

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Feb 16 23:25:08 2013 +0100

dri/nouveau: NV17_3D class is not available for NV1a chipset

Should fix https://bugs.freedesktop.org/show_bug.cgi?id=60510

Note: this is a candidate for the stable branches

Acked-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nv10_context.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 7eda4e0..4ffc4ef 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -469,7 +469,7 @@ nv10_context_create(struct nouveau_screen *screen, const 
struct gl_config *visua
goto fail;
 
/* 3D engine. */
-   if (context_chipset(ctx) = 0x17)
+   if (context_chipset(ctx) = 0x17  context_chipset(ctx) != 0x1a)
celsius_class = NV17_3D_CLASS;
else if (context_chipset(ctx) = 0x11)
celsius_class = NV15_3D_CLASS;

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


Mesa (9.0): nouveau: use pre-calculated stride for resource_get_handle

2012-10-21 Thread Marcin Ślusarz
Module: Mesa
Branch: 9.0
Commit: 77b1d2e09cfe968a01978a9042ad4edcaad3ada2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77b1d2e09cfe968a01978a9042ad4edcaad3ada2

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Oct  2 01:52:23 2012 +0200

nouveau: use pre-calculated stride for resource_get_handle

Fixes FDO#55294.

NOTE: This is a candidate for the 9.0 branch.
(cherry picked from commit 93eba269351c6e256db3a4cc7c7018f5a3fae5a1)

---

 src/gallium/drivers/nv30/nv30_miptree.c |3 +--
 src/gallium/drivers/nv50/nv50_miptree.c |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_miptree.c 
b/src/gallium/drivers/nv30/nv30_miptree.c
index 7e67729..18e40e1 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -56,8 +56,7 @@ nv30_miptree_get_handle(struct pipe_screen *pscreen,
if (!mt || !mt-base.bo)
   return FALSE;
 
-   stride = util_format_get_stride(mt-base.base.format,
-   mt-base.base.width0);
+   stride = mt-level[0].pitch;
 
return nouveau_screen_bo_get_handle(pscreen, mt-base.bo, stride, handle);
 }
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c 
b/src/gallium/drivers/nv50/nv50_miptree.c
index 7b8dfb8..70e8c77 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -133,8 +133,7 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
if (!mt || !mt-base.bo)
   return FALSE;
 
-   stride = util_format_get_stride(mt-base.base.format,
-   mt-base.base.width0);
+   stride = mt-level[0].pitch;
 
return nouveau_screen_bo_get_handle(pscreen,
mt-base.bo,

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


Mesa (master): nv50: fix build after nv50: fix printf warning

2012-10-09 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 63a15117a5eb495924bbcb70c067b6e11ab04476
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=63a15117a5eb495924bbcb70c067b6e11ab04476

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Oct  9 22:36:35 2012 +0200

nv50: fix build after nv50: fix printf warning

When compiled with C++ compiler, inttypes.h defines PRI* macros only when
__STDC_FORMAT_MACROS is defined.

---

 src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp 
b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
index 4c522ee..ded4f61 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
@@ -22,6 +22,8 @@
 
 #include nv50_ir.h
 #include nv50_ir_target.h
+
+#define __STDC_FORMAT_MACROS
 #include inttypes.h
 
 namespace nv50_ir {

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


Mesa (master): nouveau: use pre-calculated stride for resource_get_handle

2012-10-09 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 93eba269351c6e256db3a4cc7c7018f5a3fae5a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=93eba269351c6e256db3a4cc7c7018f5a3fae5a1

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Oct  2 01:52:23 2012 +0200

nouveau: use pre-calculated stride for resource_get_handle

Fixes FDO#55294.

NOTE: This is a candidate for the 9.0 branch.

---

 src/gallium/drivers/nv30/nv30_miptree.c |3 +--
 src/gallium/drivers/nv50/nv50_miptree.c |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_miptree.c 
b/src/gallium/drivers/nv30/nv30_miptree.c
index 5a9a63b..9700fa8 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -56,8 +56,7 @@ nv30_miptree_get_handle(struct pipe_screen *pscreen,
if (!mt || !mt-base.bo)
   return FALSE;
 
-   stride = util_format_get_stride(mt-base.base.format,
-   mt-base.base.width0);
+   stride = mt-level[0].pitch;
 
return nouveau_screen_bo_get_handle(pscreen, mt-base.bo, stride, handle);
 }
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c 
b/src/gallium/drivers/nv50/nv50_miptree.c
index 7b8dfb8..70e8c77 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -133,8 +133,7 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
if (!mt || !mt-base.bo)
   return FALSE;
 
-   stride = util_format_get_stride(mt-base.base.format,
-   mt-base.base.width0);
+   stride = mt-level[0].pitch;
 
return nouveau_screen_bo_get_handle(pscreen,
mt-base.bo,

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


Mesa (master): nv50/ir: make colorful ir dump output optional

2012-06-27 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 96259b51285469a229c3740c2b467d4455ed0c8d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96259b51285469a229c3740c2b467d4455ed0c8d

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun 26 15:02:55 2012 +0200

nv50/ir: make colorful ir dump output optional

---

 src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp |   22 +++
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp 
b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
index 9d92b7b..daa0ec6 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
@@ -37,9 +37,8 @@ enum TextStyle
TXT_INSN
 };
 
-static const char *colour[8] =
+static const char *_colour[8] =
 {
-#if 1
\x1b[00m,
\x1b[34m,
\x1b[35m,
@@ -48,11 +47,23 @@ static const char *colour[8] =
\x1b[33m,
\x1b[37m,
\x1b[32m
-#else
-   , , , , , , , 
-#endif
 };
 
+static const char *_nocolour[8] =
+{
+  , , , , , , , 
+};
+
+static const char **colour;
+
+static void init_colours()
+{
+   if (getenv(NV50_PROG_DEBUG_NO_COLORS) != NULL)
+  colour = _nocolour;
+   else
+  colour = _colour;
+}
+
 static const char *OpClassStr[OPCLASS_OTHER + 1] =
 {
MOVE,
@@ -620,6 +631,7 @@ void
 Program::print()
 {
PrintPass pass;
+   init_colours();
pass.run(this, true, false);
 }
 

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


Mesa (master): nv50: streamline screen_create error handling

2012-06-27 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 0fceaee4fd8f745e71cbc4e1d24520ac7e11c2cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fceaee4fd8f745e71cbc4e1d24520ac7e11c2cd

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun 26 16:22:43 2012 +0200

nv50: streamline screen_create error handling

Remove macro which changes control flow (it's evil).
Make all fail paths print (correct) error message.

---

 src/gallium/drivers/nv50/nv50_screen.c |   84 +--
 1 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 6c3f69f..873946f 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -310,7 +310,7 @@ nv50_screen_fence_update(struct pipe_screen *pscreen)
return nv50_screen(pscreen)-fence.map[0];
 }
 
-static int
+static void
 nv50_screen_init_hwctx(struct nv50_screen *screen, unsigned tls_space)
 {
struct nouveau_pushbuf *push = screen-base.pushbuf;
@@ -506,17 +506,8 @@ nv50_screen_init_hwctx(struct nv50_screen *screen, 
unsigned tls_space)
PUSH_DATA (push, 1);
 
PUSH_KICK (push);
-
-   return 0;
 }
 
-#define FAIL_SCREEN_INIT(str, err)\
-   do {   \
-  NOUVEAU_ERR(str, err);  \
-  nv50_screen_destroy(pscreen);   \
-  return NULL;\
-   } while(0)
-
 struct pipe_screen *
 nv50_screen_create(struct nouveau_device *dev)
 {
@@ -534,8 +525,10 @@ nv50_screen_create(struct nouveau_device *dev)
pscreen = screen-base.base;
 
ret = nouveau_screen_init(screen-base, dev);
-   if (ret)
-  FAIL_SCREEN_INIT(nouveau_screen_init failed: %d\n, ret);
+   if (ret) {
+  NOUVEAU_ERR(nouveau_screen_init failed: %d\n, ret);
+  goto fail;
+   }
 
/* TODO: Prevent FIFO prefetch before transfer of index buffers and
 *  admit them to VRAM.
@@ -563,8 +556,11 @@ nv50_screen_create(struct nouveau_device *dev)
 
ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, 4096,
 NULL, screen-fence.bo);
-   if (ret)
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate fence bo: %d\n, ret);
   goto fail;
+   }
+
nouveau_bo_map(screen-fence.bo, 0, NULL);
screen-fence.map = screen-fence.bo-map;
screen-base.fence.emit = nv50_screen_fence_emit;
@@ -573,20 +569,24 @@ nv50_screen_create(struct nouveau_device *dev)
ret = nouveau_object_new(chan, 0xbeef0301, NOUVEAU_NOTIFIER_CLASS,
 (struct nv04_notify){ .length = 32 },
 sizeof(struct nv04_notify), screen-sync);
-   if (ret)
-  FAIL_SCREEN_INIT(Error allocating notifier: %d\n, ret);
-
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate notifier: %d\n, ret);
+  goto fail;
+   }
 
ret = nouveau_object_new(chan, 0xbeef5039, NV50_M2MF_CLASS,
 NULL, 0, screen-m2mf);
-   if (ret)
-  FAIL_SCREEN_INIT(Error allocating PGRAPH context for M2MF: %d\n, ret);
-
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate PGRAPH context for M2MF: %d\n, ret);
+  goto fail;
+   }
 
ret = nouveau_object_new(chan, 0xbeef502d, NV50_2D_CLASS,
 NULL, 0, screen-eng2d);
-   if (ret)
-  FAIL_SCREEN_INIT(Error allocating PGRAPH context for 2D: %d\n, ret);
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate PGRAPH context for 2D: %d\n, ret);
+  goto fail;
+   }
 
switch (dev-chipset  0xf0) {
case 0x50:
@@ -612,21 +612,24 @@ nv50_screen_create(struct nouveau_device *dev)
   }
   break;
default:
-  FAIL_SCREEN_INIT(Not a known NV50 chipset: NV%02x\n, dev-chipset);
-  break;
+  NOUVEAU_ERR(Not a known NV50 chipset: NV%02x\n, dev-chipset);
+  goto fail;
}
screen-base.class_3d = tesla_class;
 
ret = nouveau_object_new(chan, 0xbeef5097, tesla_class,
 NULL, 0, screen-tesla);
-   if (ret)
-  FAIL_SCREEN_INIT(Error allocating PGRAPH context for 3D: %d\n, ret);
-
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate PGRAPH context for 3D: %d\n, ret);
+  goto fail;
+   }
 
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1  16,
 3  NV50_CODE_BO_SIZE_LOG2, NULL, screen-code);
-   if (ret)
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate code bo: %d\n, ret);
   goto fail;
+   }
 
nouveau_heap_init(screen-vp_code_heap, 0, 1  NV50_CODE_BO_SIZE_LOG2);
nouveau_heap_init(screen-gp_code_heap, 0, 1  NV50_CODE_BO_SIZE_LOG2);
@@ -641,8 +644,10 @@ nv50_screen_create(struct nouveau_device *dev)
 
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1  16, stack_size, NULL,
 screen-stack_bo);
-   if (ret)
-  FAIL_SCREEN_INIT(Failed to allocate stack bo: %d\n, ret);
+   if (ret) {
+  NOUVEAU_ERR(Failed to allocate stack bo: %d\n, ret);
+  goto 

Mesa (master): nv50: dynamically allocate space for shader local storage

2012-06-27 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 1906d2b46b21a8e7496409e0639d8463ad86dcfe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1906d2b46b21a8e7496409e0639d8463ad86dcfe

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Wed Jun 27 14:45:17 2012 +0200

nv50: dynamically allocate space for shader local storage

Fixes 21 piglit tests:
spec/glsl-1.10/execution/variable-indexing/
fs-temp-array-mat4-index-col-row-wr
vs-temp-array-mat4-index-col-row-wr
vs-temp-array-mat4-index-row-wr

spec/glsl-1.20/execution/variable-indexing/
fs-temp-array-mat3-index-col-row-rd
fs-temp-array-mat3-index-row-rd
fs-temp-array-mat4-col-row-wr
fs-temp-array-mat4-index-col-row-rd
fs-temp-array-mat4-index-col-row-wr
fs-temp-array-mat4-index-row-rd
fs-temp-array-mat4-index-row-wr
vs-temp-array-mat3-index-col-row-rd
vs-temp-array-mat3-index-col-row-wr
vs-temp-array-mat3-index-row-rd
vs-temp-array-mat3-index-row-wr
vs-temp-array-mat4-col-row-wr
vs-temp-array-mat4-index-col-row-rd
vs-temp-array-mat4-index-col-row-wr
vs-temp-array-mat4-index-col-wr
vs-temp-array-mat4-index-row-rd
vs-temp-array-mat4-index-row-wr
vs-temp-array-mat4-index-wr

... and prevents a lot of GPU lockups

---

 src/gallium/drivers/nv50/nv50_context.h  |1 +
 src/gallium/drivers/nv50/nv50_program.c  |7 ++
 src/gallium/drivers/nv50/nv50_program.h  |4 +-
 src/gallium/drivers/nv50/nv50_screen.c   |  107 +-
 src/gallium/drivers/nv50/nv50_screen.h   |7 ++-
 src/gallium/drivers/nv50/nv50_shader_state.c |7 +-
 6 files changed, 108 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.h 
b/src/gallium/drivers/nv50/nv50_context.h
index 5da0473..818c3bb 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -97,6 +97,7 @@ struct nv50_context {
   boolean flushed;
   boolean rasterizer_discard;
   uint8_t tls_required;
+  boolean new_tls_space;
   uint8_t num_vtxbufs;
   uint8_t num_vtxelts;
   uint8_t num_textures[3];
diff --git a/src/gallium/drivers/nv50/nv50_program.c 
b/src/gallium/drivers/nv50/nv50_program.c
index 9c5a080..72d14a6 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -350,6 +350,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t 
chipset)
prog-code_size = info-bin.codeSize;
prog-fixups = info-bin.relocData;
prog-max_gpr = MAX2(4, (info-bin.maxGPR  1) + 1);
+   prog-tls_space = info-bin.tlsSpace;
 
if (prog-type == PIPE_SHADER_FRAGMENT) {
   if (info-prop.fp.writesDepth) {
@@ -399,6 +400,12 @@ nv50_program_upload_code(struct nv50_context *nv50, struct 
nv50_program *prog)
}
prog-code_base = prog-mem-start;
 
+   ret = nv50_tls_realloc(nv50-screen, prog-tls_space);
+   if (ret  0)
+  return FALSE;
+   if (ret  0)
+  nv50-state.new_tls_space = TRUE;
+
if (prog-fixups)
   nv50_ir_relocate_code(prog-fixups, prog-code, prog-code_base, 0, 0);
 
diff --git a/src/gallium/drivers/nv50/nv50_program.h 
b/src/gallium/drivers/nv50/nv50_program.h
index f56268b..24eaebf 100644
--- a/src/gallium/drivers/nv50/nv50_program.h
+++ b/src/gallium/drivers/nv50/nv50_program.h
@@ -28,8 +28,6 @@ struct nv50_context;
 #include pipe/p_state.h
 #include pipe/p_shader_tokens.h
 
-#define NV50_CAP_MAX_PROGRAM_TEMPS 64
-
 struct nv50_varying {
uint8_t id; /* tgsi index */
uint8_t hw; /* hw index, nv50 wants flat FP inputs last */
@@ -56,7 +54,6 @@ struct nv50_program {
 
ubyte type;
boolean translated;
-   boolean uses_lmem;
 
uint32_t *code;
unsigned code_size;
@@ -64,6 +61,7 @@ struct nv50_program {
uint32_t *immd;
unsigned immd_size;
unsigned parm_size; /* size limit of uniform buffer */
+   uint32_t tls_space; /* required local memory per thread */
 
ubyte max_gpr; /* REG_ALLOC_TEMP */
ubyte max_out; /* REG_ALLOC_RESULT or FP_RESULT_COUNT */
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 873946f..8c30c96 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -28,11 +28,21 @@
 #include nv50_screen.h
 
 #include nouveau/nv_object.xml.h
+#include errno.h
 
 #ifndef NOUVEAU_GETPARAM_GRAPH_UNITS
 # define NOUVEAU_GETPARAM_GRAPH_UNITS 13
 #endif
 
+/* affected by LOCAL_WARPS_LOG_ALLOC / LOCAL_WARPS_NO_CLAMP */
+#define LOCAL_WARPS_ALLOC 32
+/* affected by STACK_WARPS_LOG_ALLOC / STACK_WARPS_NO_CLAMP */
+#define STACK_WARPS_ALLOC 32
+
+#define THREADS_IN_WARP 32
+
+#define ONE_TEMP_SIZE (4/*vector*/ * sizeof(float))
+
 static boolean
 nv50_screen_is_format_supported(struct pipe_screen *pscreen,
 enum pipe_format format,
@@ -209,7 +219,7 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, 
unsigned shader,
case PIPE_SHADER_CAP_MAX_PREDS:
   return 0;
case PIPE_SHADER_CAP_MAX_TEMPS:
-  return 

Mesa (master): st/mesa: fix transform feedback of unsubscripted gl_ClipDistance array

2012-06-20 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 7e63b613a5a067462c450338e0bdce5b5976f6f1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e63b613a5a067462c450338e0bdce5b5976f6f1

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Jun 16 20:30:14 2012 +0200

st/mesa: fix transform feedback of unsubscripted gl_ClipDistance array

gl_ClipDistance needs special treatment in form of lowering pass
which transforms gl_ClipDistance representation from float[] to
vec4[]. There are 2 implementations - at glsl linker level (enabled
by LowerClipDistance option) and at glsl_to_tgsi level (enabled
unconditionally for gallium drivers). Second implementation is
incomplete - it does not take into account transform feedback (see
commit 642e5b413e0890b2070ba78fde42db381eaf02e5 mesa: Fix transform
feedback of unsubscripted gl_ClipDistance array for details).

There are 2 possible fixes:
- adding transform feedback support into glsl_to_tgsi version
- ripping gl_ClipDistance support from glsl_to_tgsi and enabling
  gl_ClipDistance lowering on glsl linker side

This patch implements 2nd option. All it does is:
- reverts most of the commit 59be691638200797583bce39a83f641d30d97492
  st/mesa: add support for gl_ClipDistance
- changes LowerClipDistance to true

Fixes Piglit tests EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{2,3,4,5,6,7,8}]-no-subscript at least on nv50
and evergreen cards.

---

 src/mesa/state_tracker/st_extensions.c |1 +
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   49 +++-
 2 files changed, 6 insertions(+), 44 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 17f271f..dacad9b 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -222,6 +222,7 @@ void st_init_limits(struct st_context *st)
  options-MaxUnrollIterations = MIN2(screen-get_shader_param(screen, 
sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
   else
  options-MaxUnrollIterations = 255; /* SM3 limit */
+  options-LowerClipDistance = true;
}
 
/* PIPE_SHADER_CAP_MAX_INPUTS for the FS specifies the maximum number
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5802b52..b6abe84 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -304,7 +304,6 @@ public:
int samplers_used;
bool indirect_addr_temps;
bool indirect_addr_consts;
-   int num_clip_distances;

int glsl_version;
bool native_integers;
@@ -2825,7 +2824,6 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
samplers_used = 0;
indirect_addr_temps = false;
indirect_addr_consts = false;
-   num_clip_distances = 0;
glsl_version = 0;
native_integers = false;
mem_ctx = ralloc_context(NULL);
@@ -4593,17 +4591,9 @@ st_translate_program(
   }
 
   for (i = 0; i  numOutputs; i++) {
- if (outputSemanticName[i] == TGSI_SEMANTIC_CLIPDIST) {
-int mask = ((1  (program-num_clip_distances - 
4*outputSemanticIndex[i])) - 1)  TGSI_WRITEMASK_XYZW;
-t-outputs[i] = ureg_DECL_output_masked(ureg,
-outputSemanticName[i],
-outputSemanticIndex[i],
-mask);
- } else {
-t-outputs[i] = ureg_DECL_output(ureg,
- outputSemanticName[i],
- outputSemanticIndex[i]);
- }
+ t-outputs[i] = ureg_DECL_output(ureg,
+  outputSemanticName[i],
+  outputSemanticIndex[i]);
   }
   if (passthrough_edgeflags)
  emit_edgeflags(t);
@@ -4759,8 +4749,7 @@ out:
 static struct gl_program *
 get_mesa_program(struct gl_context *ctx,
  struct gl_shader_program *shader_program,
- struct gl_shader *shader,
- int num_clip_distances)
+ struct gl_shader *shader)
 {
glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
struct gl_program *prog;
@@ -4800,7 +4789,6 @@ get_mesa_program(struct gl_context *ctx,
v-options = options;
v-glsl_version = ctx-Const.GLSLVersion;
v-native_integers = ctx-Const.NativeIntegers;
-   v-num_clip_distances = num_clip_distances;
 
_mesa_generate_parameters_list_for_uniforms(shader_program, shader,
   prog-Parameters);
@@ -4925,25 +4913,6 @@ get_mesa_program(struct gl_context *ctx,
return prog;
 }
 
-/**
- * Searches through the IR for a declaration of gl_ClipDistance and returns the
- * declared size of the gl_ClipDistance array.  Returns 0 if gl_ClipDistance is
- * not declared in the IR.
- */
-int get_clip_distance_size(exec_list *ir)
-{
-   

Mesa (master): nv50: fix buffer reuse issues

2012-06-20 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 19fd04f5eaf76f6ea5effa69d91c415bba75ba8e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19fd04f5eaf76f6ea5effa69d91c415bba75ba8e

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun 19 23:38:34 2012 +0200

nv50: fix buffer reuse issues

1) We need to insert a barrier between consecutive transform feedback calls.
2) VBO cache needs to be flushed when TFB output is used as VBO draw input.

Fixes Piglit test EXT_transform_feedback/immediate-reuse.

Thanks to Christoph Bumiller for pointing out bugs in previous versions
of this patch.

---

 src/gallium/drivers/nv50/nv50_shader_state.c |6 ++
 src/gallium/drivers/nv50/nv50_vbo.c  |   12 
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c 
b/src/gallium/drivers/nv50/nv50_shader_state.c
index 1ddcd3c..586eefe 100644
--- a/src/gallium/drivers/nv50/nv50_shader_state.c
+++ b/src/gallium/drivers/nv50/nv50_shader_state.c
@@ -564,6 +564,12 @@ nv50_stream_output_validate(struct nv50_context *nv50)
   return;
}
 
+   /* previous TFB needs to complete */
+   if (nv50-screen-base.class_3d  NVA0_3D_CLASS) {
+  BEGIN_NV04(push, SUBC_3D(NV50_GRAPH_SERIALIZE), 1);
+  PUSH_DATA (push, 0);
+   }
+
ctrl = so-ctrl;
if (nv50-screen-base.class_3d = NVA0_3D_CLASS)
   ctrl |= NVA0_3D_STRMOUT_BUFFERS_CTRL_LIMIT_MODE_OFFSET;
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c 
b/src/gallium/drivers/nv50/nv50_vbo.c
index 1875d4d..6e81b7b 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -293,6 +293,18 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
else
   nv50-vbo_fifo = 0;
 
+   if (!nv50-vbo_fifo) {
+  /* if vertex buffer was written by GPU - flush VBO cache */
+  for (i = 0; i  nv50-num_vtxbufs; ++i) {
+ struct nv04_resource *buf = nv04_resource(nv50-vtxbuf[i].buffer);
+ if (buf  buf-status  NOUVEAU_BUFFER_STATUS_GPU_WRITING) {
+buf-status = ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
+nv50-base.vbo_dirty = TRUE;
+break;
+ }
+  }
+   }
+
/* update vertex format state */
BEGIN_NV04(push, NV50_3D(VERTEX_ARRAY_ATTRIB(0)), n);
if (nv50-vbo_fifo) {

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


Mesa (master): nv50,nvc0: fix stream output target buffer leak

2012-06-14 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: fc782bcbf04f036990f69b14e01304e1e6dc8fd1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc782bcbf04f036990f69b14e01304e1e6dc8fd1

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Thu Jun 14 21:48:46 2012 +0200

nv50,nvc0: fix stream output target buffer leak

It manifests at exit as:
WARNING: destroying GPU memory cache with some buffers still in use

---

 src/gallium/drivers/nv50/nv50_state.c |1 +
 src/gallium/drivers/nvc0/nvc0_state.c |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_state.c 
b/src/gallium/drivers/nv50/nv50_state.c
index 81c3fa2..2052f91 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -983,6 +983,7 @@ nv50_so_target_destroy(struct pipe_context *pipe,
struct nv50_so_target *targ = nv50_so_target(ptarg);
if (targ-pq)
   pipe-destroy_query(pipe, targ-pq);
+   pipe_resource_reference(targ-pipe.buffer, NULL);
FREE(targ);
 }
 
diff --git a/src/gallium/drivers/nvc0/nvc0_state.c 
b/src/gallium/drivers/nvc0/nvc0_state.c
index cce2a48..1bd5434 100644
--- a/src/gallium/drivers/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nvc0/nvc0_state.c
@@ -899,6 +899,7 @@ nvc0_so_target_destroy(struct pipe_context *pipe,
 {
struct nvc0_so_target *targ = nvc0_so_target(ptarg);
pipe-destroy_query(pipe, targ-pq);
+   pipe_resource_reference(targ-pipe.buffer, NULL);
FREE(targ);
 }
 

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


Mesa (master): glsl: fix deref_hash memory leak in constant_expression_value

2012-06-08 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: ea055e19c2757dfe97dd13c1deee2bfa177eae3f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea055e19c2757dfe97dd13c1deee2bfa177eae3f

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun  5 21:10:33 2012 +0200

glsl: fix deref_hash memory leak in constant_expression_value

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/glsl/ir_constant_expression.cpp |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp 
b/src/glsl/ir_constant_expression.cpp
index 7a4d15f..38a1ed9 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -1322,8 +1322,11 @@ 
ir_function_signature::constant_expression_value(exec_list *actual_parameters, s
 
foreach_list(n, actual_parameters) {
   ir_constant *constant = ((ir_rvalue *) 
n)-constant_expression_value(variable_context);
-  if (constant == NULL)
-return NULL;
+  if (constant == NULL) {
+ hash_table_dtor(deref_hash);
+ return NULL;
+  }
+
 
   ir_variable *var = (ir_variable *)parameter_info;
   hash_table_insert(deref_hash, constant, var);

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


Mesa (master): nv50: fix symbol table memory leak

2012-06-05 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: cfa7cb991ce7d2fd77ea7f5abf96c90d8a1ea68c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cfa7cb991ce7d2fd77ea7f5abf96c90d8a1ea68c

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun  5 20:18:33 2012 +0200

nv50: fix symbol table memory leak

---

 src/gallium/drivers/nv50/nv50_program.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c 
b/src/gallium/drivers/nv50/nv50_program.c
index ca40ac2..67f8629 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -343,6 +343,9 @@ nv50_program_translate(struct nv50_program *prog, uint16_t 
chipset)
   NOUVEAU_ERR(shader translation failed: %i\n, ret);
   goto out;
}
+   if (info-bin.syms) /* we don't need them yet */
+  FREE(info-bin.syms);
+
prog-code = info-bin.code;
prog-code_size = info-bin.codeSize;
prog-fixups = info-bin.relocData;

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


Mesa (master): nv50: fix nv50_stream_output_state leak

2012-06-05 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 3232a86efe76df9fcee869c4ed4af8d68824920c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3232a86efe76df9fcee869c4ed4af8d68824920c

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun  5 20:26:54 2012 +0200

nv50: fix nv50_stream_output_state leak

---

 src/gallium/drivers/nv50/nv50_program.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c 
b/src/gallium/drivers/nv50/nv50_program.c
index 67f8629..9c5a080 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -427,6 +427,9 @@ nv50_program_destroy(struct nv50_context *nv50, struct 
nv50_program *p)
if (p-fixups)
   FREE(p-fixups);
 
+   if (p-so)
+  FREE(p-so);
+
memset(p, 0, sizeof(*p));
 
p-pipe = pipe;

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


Mesa (master): nouveau: fix scratch buffer leak

2012-06-05 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 17e047242e82111859eb8220369c601c79a26350
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=17e047242e82111859eb8220369c601c79a26350

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jun  5 23:26:05 2012 +0200

nouveau: fix scratch buffer leak

...and create common function for destroying nouveau_context

---

 src/gallium/drivers/nouveau/nouveau_context.h |   12 
 src/gallium/drivers/nv30/nv30_context.c   |2 +-
 src/gallium/drivers/nv50/nv50_context.c   |2 +-
 src/gallium/drivers/nvc0/nvc0_context.c   |2 +-
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_context.h 
b/src/gallium/drivers/nouveau/nouveau_context.h
index 531c623..b3fe05b 100644
--- a/src/gallium/drivers/nouveau/nouveau_context.h
+++ b/src/gallium/drivers/nouveau/nouveau_context.h
@@ -2,6 +2,7 @@
 #define __NOUVEAU_CONTEXT_H__
 
 #include pipe/p_context.h
+#include libdrm/nouveau.h
 
 #define NOUVEAU_MAX_SCRATCH_BUFS 4
 
@@ -72,4 +73,15 @@ void *
 nouveau_scratch_get(struct nouveau_context *, unsigned size, uint64_t 
*gpu_addr,
 struct nouveau_bo **);
 
+static INLINE void
+nouveau_context_destroy(struct nouveau_context *ctx)
+{
+   int i;
+
+   for (i = 0; i  NOUVEAU_MAX_SCRATCH_BUFS; ++i)
+  if (ctx-scratch.bo[i])
+ nouveau_bo_ref(NULL, ctx-scratch.bo[i]);
+
+   FREE(ctx);
+}
 #endif
diff --git a/src/gallium/drivers/nv30/nv30_context.c 
b/src/gallium/drivers/nv30/nv30_context.c
index b16cb23..42e844f 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -92,7 +92,7 @@ nv30_context_destroy(struct pipe_context *pipe)
if (nv30-screen-cur_ctx == nv30)
   nv30-screen-cur_ctx = NULL;
 
-   FREE(nv30);
+   nouveau_context_destroy(nv30-base);
 }
 
 #define FAIL_CONTEXT_INIT(str, err)   \
diff --git a/src/gallium/drivers/nv50/nv50_context.c 
b/src/gallium/drivers/nv50/nv50_context.c
index 952dc03..cb9dd41 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -111,7 +111,7 @@ nv50_destroy(struct pipe_context *pipe)
draw_destroy(nv50-draw);
 #endif
 
-   FREE(nv50);
+   nouveau_context_destroy(nv50-base);
 }
 
 struct pipe_context *
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c 
b/src/gallium/drivers/nvc0/nvc0_context.c
index f930814..b021f2e 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -99,7 +99,7 @@ nvc0_destroy(struct pipe_context *pipe)
draw_destroy(nvc0-draw);
 #endif
 
-   FREE(nvc0);
+   nouveau_context_destroy(nvc0-base);
 }
 
 void

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


Mesa (master): nv50: hook up forgotten short constant buffer upload method

2012-05-29 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 89241336276deeef525b35bf5dc7db345a18a3e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89241336276deeef525b35bf5dc7db345a18a3e1

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue May 29 20:13:55 2012 +0200

nv50: hook up forgotten short constant buffer upload method

Fixes crash in xorg st.

---

 src/gallium/drivers/nv50/nv50_context.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.c 
b/src/gallium/drivers/nv50/nv50_context.c
index 1e6bbaf..952dc03 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -140,6 +140,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
nv50-base.screen= screen-base;
nv50-base.copy_data = nv50_m2mf_copy_linear;
nv50-base.push_data = nv50_sifc_linear_u8;
+   nv50-base.push_cb   = nv50_cb_push;
 
nv50-screen = screen;
pipe-screen = pscreen;

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


Mesa (master): xorg/nouveau: switch to libdrm_nouveau-2.0

2012-04-13 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: f2509df95cd1d055e91b1558c5d9c5a935067d78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2509df95cd1d055e91b1558c5d9c5a935067d78

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Fri Apr 13 21:55:56 2012 +0200

xorg/nouveau: switch to libdrm_nouveau-2.0

---

 src/gallium/targets/xorg-nouveau/nouveau_xorg.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c 
b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
index 43470a1..d0c1b83 100644
--- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
@@ -29,7 +29,7 @@
  */
 
 #include ../../state_trackers/xorg/xorg_winsys.h
-#include nouveau_drmif.h
+#include nouveau.h
 #include xorg/dri.h
 #include xf86drmMode.h
 
@@ -139,7 +139,7 @@ nouveau_xorg_pci_probe(DriverPtr driver,
 }
 busid = DRICreatePCIBusID(device);
 
-ret = nouveau_device_open(dev, busid);
+ret = nouveau_device_open(busid, dev);
 if (ret) {
xf86DrvMsg(-1, X_ERROR, [drm] failed to open device\n);
free(busid);
@@ -147,7 +147,7 @@ nouveau_xorg_pci_probe(DriverPtr driver,
 }
 
 chipset = dev-chipset;
-nouveau_device_close(dev);
+nouveau_device_del(dev);
 
 ret = drmCheckModesettingSupported(busid);
 free(busid);

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


Mesa (master): targets/{xvmc, vdpau, va}: remove all objects on make clean

2012-04-01 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 68e4c83ffa9319c934a96ca1daf25e81b78a6d90
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=68e4c83ffa9319c934a96ca1daf25e81b78a6d90

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Apr  1 17:31:51 2012 +0200

targets/{xvmc,vdpau,va}: remove all objects on make clean

---

 src/gallium/targets/Makefile.va|2 +-
 src/gallium/targets/Makefile.vdpau |2 +-
 src/gallium/targets/Makefile.xvmc  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/Makefile.va b/src/gallium/targets/Makefile.va
index 884b59d..a6e775c 100644
--- a/src/gallium/targets/Makefile.va
+++ b/src/gallium/targets/Makefile.va
@@ -63,7 +63,7 @@ tags:
 
 # Remove .o and backup files
 clean:
-   -rm -f *.o *~ *.so $(SYMLINKS)
+   -rm -f $(OBJECTS) *~ *.so $(SYMLINKS)
-rm -f depend depend.bak
 
 install: default
diff --git a/src/gallium/targets/Makefile.vdpau 
b/src/gallium/targets/Makefile.vdpau
index a9e7a9c..fba3cdf 100644
--- a/src/gallium/targets/Makefile.vdpau
+++ b/src/gallium/targets/Makefile.vdpau
@@ -63,7 +63,7 @@ tags:
 
 # Remove .o and backup files
 clean:
-   -rm -f *.o *~ *.so $(SYMLINKS)
+   -rm -f $(OBJECTS) *~ *.so $(SYMLINKS)
-rm -f depend depend.bak
 
 install: default
diff --git a/src/gallium/targets/Makefile.xvmc 
b/src/gallium/targets/Makefile.xvmc
index 217481e..ad9dd2d 100644
--- a/src/gallium/targets/Makefile.xvmc
+++ b/src/gallium/targets/Makefile.xvmc
@@ -63,7 +63,7 @@ tags:
 
 # Remove .o and backup files
 clean:
-   -rm -f *.o *~ *.so $(SYMLINKS)
+   -rm -f $(OBJECTS) *~ *.so $(SYMLINKS)
-rm -f depend depend.bak
 
 install: default

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


Mesa (master): nouveau: get rid of winsys object

2011-12-13 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 10e931219f0619c01456dd13fea65b8c21f3b87b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=10e931219f0619c01456dd13fea65b8c21f3b87b

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Fri Dec  2 22:02:51 2011 +0100

nouveau: get rid of winsys object

Its only purpose was to destroy itself.

---

 src/gallium/drivers/nouveau/Android.mk |4 ++-
 src/gallium/drivers/nouveau/Makefile   |3 ++
 src/gallium/drivers/nouveau/nouveau_screen.c   |7 ++--
 src/gallium/drivers/nouveau/nouveau_winsys.h   |6 ++--
 src/gallium/drivers/nv50/nv50_context.c|2 -
 src/gallium/drivers/nv50/nv50_screen.c |3 +-
 src/gallium/drivers/nv50/nv50_screen.h |1 -
 src/gallium/drivers/nvc0/nvc0_context.c|2 -
 src/gallium/drivers/nvc0/nvc0_screen.c |3 +-
 src/gallium/drivers/nvc0/nvc0_screen.h |1 -
 src/gallium/drivers/nvfx/nvfx_context.c|5 ---
 src/gallium/drivers/nvfx/nvfx_context.h|1 -
 src/gallium/drivers/nvfx/nvfx_screen.c |3 +-
 src/gallium/drivers/nvfx/nvfx_screen.h |1 -
 src/gallium/winsys/nouveau/drm/nouveau_dri.h   |   28 -
 .../winsys/nouveau/drm/nouveau_drm_winsys.c|   32 +--
 .../winsys/nouveau/drm/nouveau_drm_winsys.h|   28 -
 17 files changed, 17 insertions(+), 113 deletions(-)

diff --git a/src/gallium/drivers/nouveau/Android.mk 
b/src/gallium/drivers/nouveau/Android.mk
index 1094497..782b7ce 100644
--- a/src/gallium/drivers/nouveau/Android.mk
+++ b/src/gallium/drivers/nouveau/Android.mk
@@ -29,7 +29,9 @@ include $(LOCAL_PATH)/Makefile.sources
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
-LOCAL_C_INCLUDES := $(DRM_TOP)
+LOCAL_C_INCLUDES := $(DRM_TOP) \
+   $(DRM_TOP)/include/drm \
+   $(DRM_TOP)/nouveau
 
 LOCAL_MODULE := libmesa_pipe_nouveau
 
diff --git a/src/gallium/drivers/nouveau/Makefile 
b/src/gallium/drivers/nouveau/Makefile
index eb35c1f..d583324 100644
--- a/src/gallium/drivers/nouveau/Makefile
+++ b/src/gallium/drivers/nouveau/Makefile
@@ -7,6 +7,9 @@ LIBRARY_INCLUDES = \
$(LIBDRM_CFLAGS) \
-I$(TOP)/src/gallium/drivers/nouveau/include
 
+LIBRARY_INCLUDES += $(shell $(PKG_CONFIG) libdrm libdrm_nouveau 
--cflags-only-I)
+LIBRARY_DEFINES += $(shell $(PKG_CONFIG) libdrm libdrm_nouveau 
--cflags-only-other)
+
 # get C_SOURCES
 include Makefile.sources
 
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index cdc2bff..99546a2 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -22,6 +22,8 @@
 #include state_tracker/drm_driver.h
 #include util/u_simple_screen.h
 
+#include nouveau_drmif.h
+
 int nouveau_mesa_debug = 0;
 
 static const char *
@@ -234,14 +236,11 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
 void
 nouveau_screen_fini(struct nouveau_screen *screen)
 {
-   struct pipe_winsys *ws = screen-base.winsys;
-
nouveau_mm_destroy(screen-mm_GART);
nouveau_mm_destroy(screen-mm_VRAM);
 
nouveau_channel_free(screen-channel);
 
-   if (ws)
-   ws-destroy(ws);
+   nouveau_device_close(screen-device);
 }
 
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h 
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 524e636..1abfa79 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -42,12 +42,12 @@ nouveau_screen_transfer_flags(unsigned pipe)
 }
 
 extern struct pipe_screen *
-nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
+nvfx_screen_create(struct nouveau_device *);
 
 extern struct pipe_screen *
-nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
+nv50_screen_create(struct nouveau_device *);
 
 extern struct pipe_screen *
-nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
+nvc0_screen_create(struct nouveau_device *);
 
 #endif
diff --git a/src/gallium/drivers/nv50/nv50_context.c 
b/src/gallium/drivers/nv50/nv50_context.c
index a48b864..3b0f8f0 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -109,7 +109,6 @@ nv50_destroy(struct pipe_context *pipe)
 struct pipe_context *
 nv50_create(struct pipe_screen *pscreen, void *priv)
 {
-   struct pipe_winsys *pipe_winsys = pscreen-winsys;
struct nv50_screen *screen = nv50_screen(pscreen);
struct nv50_context *nv50;
struct pipe_context *pipe;
@@ -124,7 +123,6 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
nv50-base.copy_data = nv50_m2mf_copy_linear;
nv50-base.push_data = nv50_sifc_linear_u8;
 
-   pipe-winsys = pipe_winsys;
pipe-screen = pscreen;
pipe-priv = priv;
 
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 

Mesa (7.11): nv50, nvc0: use screen instead of context for flush notifier

2011-12-11 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: 0e9b79c22a53efb8413ba6b4e49085a08221a5d3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e9b79c22a53efb8413ba6b4e49085a08221a5d3

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Thu Jul  7 14:58:29 2011 +0200

nv50,nvc0: use screen instead of context for flush notifier

Context may become NULL and we still have to be able to flush
pending fences.

(Cherry picked from commit 3069a7eaa5d83e7f41616347ba244c0dc0d944ae)
Fixes crash on screen shutdown: 
https://bugs.freedesktop.org/show_bug.cgi?id=43428

---

 src/gallium/drivers/nv50/nv50_context.c|   13 +
 src/gallium/drivers/nv50/nv50_screen.c |2 ++
 src/gallium/drivers/nv50/nv50_state_validate.c |3 +--
 src/gallium/drivers/nv50/nv50_vbo.c|7 +++
 src/gallium/drivers/nvc0/nvc0_context.c|   13 +
 src/gallium/drivers/nvc0/nvc0_screen.c |8 ++--
 src/gallium/drivers/nvc0/nvc0_state_validate.c |3 +--
 src/gallium/drivers/nvc0/nvc0_vbo.c|7 +++
 8 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.c 
b/src/gallium/drivers/nv50/nv50_context.c
index ceb83f6..ac3e361 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -60,13 +60,13 @@ nv50_texture_barrier(struct pipe_context *pipe)
 void
 nv50_default_flush_notify(struct nouveau_channel *chan)
 {
-   struct nv50_context *nv50 = chan-user_private;
+   struct nv50_screen *screen = chan-user_private;
 
-   if (!nv50)
+   if (!screen)
   return;
 
-   nouveau_fence_update(nv50-screen-base, TRUE);
-   nouveau_fence_next(nv50-screen-base);
+   nouveau_fence_update(screen-base, TRUE);
+   nouveau_fence_next(screen-base);
 }
 
 static void
@@ -100,10 +100,8 @@ nv50_destroy(struct pipe_context *pipe)
 
draw_destroy(nv50-draw);
 
-   if (nv50-screen-cur_ctx == nv50) {
-  nv50-screen-base.channel-user_private = NULL;
+   if (nv50-screen-cur_ctx == nv50)
   nv50-screen-cur_ctx = NULL;
-   }
 
FREE(nv50);
 }
@@ -140,7 +138,6 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
 
if (!screen-cur_ctx)
   screen-cur_ctx = nv50;
-   screen-base.channel-user_private = nv50;
screen-base.channel-flush_notify = nv50_default_flush_notify;
 
nv50_init_query_functions(nv50);
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 9606c99..4fcf529 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -215,6 +215,7 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
   nouveau_fence_wait(screen-base.fence.current);
   nouveau_fence_ref (NULL, screen-base.fence.current);
}
+   screen-base.channel-user_private = NULL;
 
nouveau_bo_ref(NULL, screen-code);
nouveau_bo_ref(NULL, screen-tls_bo);
@@ -304,6 +305,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
   FAIL_SCREEN_INIT(nouveau_screen_init failed: %d\n, ret);
 
chan = screen-base.channel;
+   chan-user_private = screen;
 
pscreen-winsys = ws;
pscreen-destroy = nv50_screen_destroy;
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c 
b/src/gallium/drivers/nv50/nv50_state_validate.c
index 11561f5..d29c1e9 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -282,8 +282,7 @@ nv50_switch_pipe_context(struct nv50_context *ctx_to)
if (!ctx_to-zsa)
   ctx_to-dirty = ~NV50_NEW_ZSA;
 
-   ctx_to-screen-base.channel-user_private = ctx_to-screen-cur_ctx =
-  ctx_to;
+   ctx_to-screen-cur_ctx = ctx_to;
 }
 
 static struct state_validate {
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c 
b/src/gallium/drivers/nv50/nv50_vbo.c
index bb08941..f23008a 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -389,11 +389,11 @@ nv50_prim_gl(unsigned prim)
 static void
 nv50_draw_vbo_flush_notify(struct nouveau_channel *chan)
 {
-   struct nv50_context *nv50 = chan-user_private;
+   struct nv50_screen *screen = chan-user_private;
 
-   nouveau_fence_update(nv50-screen-base, TRUE);
+   nouveau_fence_update(screen-base, TRUE);
 
-   nv50_bufctx_emit_relocs(nv50);
+   nv50_bufctx_emit_relocs(screen-cur_ctx);
 }
 
 static void
@@ -650,7 +650,6 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
nv50_state_validate(nv50);
 
chan-flush_notify = nv50_draw_vbo_flush_notify;
-   chan-user_private = nv50;
 
if (nv50-vbo_fifo) {
   nv50_push_vbo(nv50, info);
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c 
b/src/gallium/drivers/nvc0/nvc0_context.c
index 2679b7f..983db23 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -89,10 +89,8 @@ nvc0_destroy(struct pipe_context *pipe)
 
draw_destroy(nvc0-draw);
 
-   if (nvc0-screen-cur_ctx == nvc0) {

Mesa (7.11): nv50/nvc0: fix crash when channel allocation fails

2011-12-11 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: 237d6fa97a3c94b1ffb9d0ce230b8c7b95fccae4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=237d6fa97a3c94b1ffb9d0ce230b8c7b95fccae4

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Fri Nov 11 20:45:08 2011 +0100

nv50/nvc0: fix crash when channel allocation fails

---

 src/gallium/drivers/nv50/nv50_screen.c |3 ++-
 src/gallium/drivers/nvc0/nvc0_screen.c |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 4fcf529..f176a86 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -215,7 +215,8 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
   nouveau_fence_wait(screen-base.fence.current);
   nouveau_fence_ref (NULL, screen-base.fence.current);
}
-   screen-base.channel-user_private = NULL;
+   if (screen-base.channel)
+  screen-base.channel-user_private = NULL;
 
nouveau_bo_ref(NULL, screen-code);
nouveau_bo_ref(NULL, screen-tls_bo);
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index 0946fd7..43eb6ce 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -202,7 +202,8 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
   nouveau_fence_wait(screen-base.fence.current);
   nouveau_fence_ref(NULL, screen-base.fence.current);
}
-   screen-base.channel-user_private = NULL;
+   if (screen-base.channel)
+  screen-base.channel-user_private = NULL;
 
nouveau_bo_ref(NULL, screen-text);
nouveau_bo_ref(NULL, screen-tls);

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


Mesa (master): nv50/nvc0: fix crash when channel allocation fails

2011-12-02 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 27e77cb902b4f7f5e127dcd78951e3167f13d59c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=27e77cb902b4f7f5e127dcd78951e3167f13d59c

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Fri Nov 11 20:45:08 2011 +0100

nv50/nvc0: fix crash when channel allocation fails

---

 src/gallium/drivers/nv50/nv50_screen.c |3 ++-
 src/gallium/drivers/nvc0/nvc0_screen.c |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 47eba85..3cd5fdf 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -228,7 +228,8 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
   nouveau_fence_wait(screen-base.fence.current);
   nouveau_fence_ref (NULL, screen-base.fence.current);
}
-   screen-base.channel-user_private = NULL;
+   if (screen-base.channel)
+  screen-base.channel-user_private = NULL;
if (screen-blitctx)
   FREE(screen-blitctx);
 
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index 38f918a..79c3e36 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -220,7 +220,8 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
   nouveau_fence_wait(screen-base.fence.current);
   nouveau_fence_ref(NULL, screen-base.fence.current);
}
-   screen-base.channel-user_private = NULL;
+   if (screen-base.channel)
+  screen-base.channel-user_private = NULL;
 
if (screen-blitctx)
   FREE(screen-blitctx);

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


Mesa (master): st/xorg: remove target library on make clean

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: adbab41e6722a428d12b19db48d7a4644eab920b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=adbab41e6722a428d12b19db48d7a4644eab920b

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct 16 14:37:36 2011 +0200

st/xorg: remove target library on make clean

---

 src/gallium/targets/Makefile.xorg |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index d1231ca..be0cb4c 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -60,7 +60,7 @@ $(TOP)/$(LIB_DIR)/gallium:
mkdir -p $@
 
 clean:
-   rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME).a depend depend.bak
+   rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME) depend depend.bak
 
 install:
$(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)

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


Mesa (master): gallium/targets: use c++ compiler for linking

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 757390491cfa3b861fab76940a8c6e508d1f1a25
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=757390491cfa3b861fab76940a8c6e508d1f1a25

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Thu Oct 13 21:45:45 2011 +0200

gallium/targets: use c++ compiler for linking

As pointed out by Michel Dänzer, gcc -lstdc++ doesn't work on all systems,
because it may require other libraries which are only pulled in implicitly
by g++. And libstdc++ is available only with GNU compiler.

Use c++ compiler for linking and remove redundant LDFLAGS += -lstdc++
all over the tree.

---

 configure.ac  |2 +-
 src/gallium/targets/Makefile.dri  |2 -
 src/gallium/targets/Makefile.va   |9 ++-
 src/gallium/targets/Makefile.vdpau|9 ++-
 src/gallium/targets/Makefile.xorg |   11 ++---
 src/gallium/targets/Makefile.xvmc |   10 ++--
 src/gallium/targets/gbm/Makefile  |   34 
 src/gallium/targets/xa-vmwgfx/Makefile|9 ++-
 src/gallium/targets/xorg-nouveau/Makefile |2 +
 src/gallium/targets/xvmc-nouveau/Makefile |2 +
 10 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3f951ec..0864b55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1748,7 +1748,7 @@ if test x$enable_gallium_llvm = xyes; then
 if test x$LLVM_CONFIG != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version`
LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed 's/-DNDEBUG\//g'`
-   LLVM_LIBS=`$LLVM_CONFIG --libs` -lstdc++
+   LLVM_LIBS=`$LLVM_CONFIG --libs`
 
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
DEFINES=$DEFINES -D__STDC_CONSTANT_MACROS
diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
index 857ebfe..a26b3ee 100644
--- a/src/gallium/targets/Makefile.dri
+++ b/src/gallium/targets/Makefile.dri
@@ -4,8 +4,6 @@
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)
 DRIVER_EXTRAS = $(LLVM_LIBS)
-else
-LDFLAGS += -lstdc++
 endif
 
 MESA_MODULES = \
diff --git a/src/gallium/targets/Makefile.va b/src/gallium/targets/Makefile.va
index 7ced430..920f130 100644
--- a/src/gallium/targets/Makefile.va
+++ b/src/gallium/targets/Makefile.va
@@ -17,8 +17,13 @@ STATE_TRACKER_LIB = 
$(TOP)/src/gallium/state_trackers/va/libvatracker.a
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)
 DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
 else
-LDFLAGS += -lstdc++
+  ifeq ($(LINK_WITH_CXX),1)
+LD=$(CXX)
+  else
+LD=$(CC)
+  endif
 endif
 
 # XXX: Hack, VA public funcs aren't exported
@@ -39,7 +44,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
-   $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+   $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VA_MAJOR) -minor $(VA_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) 
$(DRIVER_EXTRAS)
diff --git a/src/gallium/targets/Makefile.vdpau 
b/src/gallium/targets/Makefile.vdpau
index c634915..39984e2 100644
--- a/src/gallium/targets/Makefile.vdpau
+++ b/src/gallium/targets/Makefile.vdpau
@@ -17,8 +17,13 @@ STATE_TRACKER_LIB = 
$(TOP)/src/gallium/state_trackers/vdpau/libvdpautracker.a
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)
 DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
 else
-LDFLAGS += -lstdc++
+  ifeq ($(LINK_WITH_CXX),1)
+LD=$(CXX)
+  else
+LD=$(CC)
+  endif
 endif
 
 # XXX: Hack, VDPAU public funcs aren't exported if we link to 
libvdpautracker.a :(
@@ -39,7 +44,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
-   $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+   $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VDPAU_MAJOR) -minor $(VDPAU_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) 
$(DRIVER_EXTRAS)
diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index c96eded..d1231ca 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -29,12 +29,15 @@ INCLUDES = \
 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
 
 ifeq ($(MESA_LLVM),1)
-LD = $(CXX)
 LDFLAGS += $(LLVM_LDFLAGS)
-USE_CXX=1
 DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
+LD=$(CXX)
 else
-LDFLAGS += -lstdc++
+  ifeq ($(LINK_WITH_CXX),1)
+LD=$(CXX)
+  else
+LD=$(CC)
+  endif
 endif
 
 
@@ -43,7 +46,7 @@ endif
 default: depend 

Mesa (master): targets/va/vdpau/xvmc: don't rebuild target lib every time

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 106c99fee52fe712ee5792e876b83aa318740b7d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=106c99fee52fe712ee5792e876b83aa318740b7d

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct 16 18:51:11 2011 +0200

targets/va/vdpau/xvmc: don't rebuild target lib every time

Dependency on target directory caused unnecessary relink. Remove them.

---

 src/gallium/targets/Makefile.va|2 +-
 src/gallium/targets/Makefile.vdpau |2 +-
 src/gallium/targets/Makefile.xvmc  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/Makefile.va b/src/gallium/targets/Makefile.va
index 920f130..7215fc3 100644
--- a/src/gallium/targets/Makefile.va
+++ b/src/gallium/targets/Makefile.va
@@ -43,7 +43,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VA_MAJOR) -minor $(VA_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
diff --git a/src/gallium/targets/Makefile.vdpau 
b/src/gallium/targets/Makefile.vdpau
index 39984e2..c59cd02 100644
--- a/src/gallium/targets/Makefile.vdpau
+++ b/src/gallium/targets/Makefile.vdpau
@@ -43,7 +43,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VDPAU_MAJOR) -minor $(VDPAU_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
diff --git a/src/gallium/targets/Makefile.xvmc 
b/src/gallium/targets/Makefile.xvmc
index cb35d3c..8c7b7f4 100644
--- a/src/gallium/targets/Makefile.xvmc
+++ b/src/gallium/targets/Makefile.xvmc
@@ -43,7 +43,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \

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


Mesa (master): st/xorg: fix build when /lib/ gallium directory does not exist yet

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 638d5a10f31aebe8642e862de7d0a1eaf977ebae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=638d5a10f31aebe8642e862de7d0a1eaf977ebae

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct 16 20:13:49 2011 +0200

st/xorg: fix build when /lib/gallium directory does not exist yet

TARGET was not defined, so make checked directory instead of file

---

 src/gallium/targets/Makefile.xorg |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index be0cb4c..481e3d6 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -26,7 +26,7 @@ INCLUDES = \
-I$(TOP)/src/gallium/winsys \
$(DRIVER_INCLUDES)
 
-LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
+LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)

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


Mesa (7.11): nouveau: fix crash during fence emission

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: 8d1f1eae93a873fae3639134581de6ac1f6d413e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d1f1eae93a873fae3639134581de6ac1f6d413e

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Sep 25 16:01:19 2011 +0200

nouveau: fix crash during fence emission

Fence emission can flush the push buffer, which through flush_notify
unreferences recently emitted fence. If ref count is increased after
fence emission, unreference deletes the fence, which causes SIGSEGV.

Backtrace:
nouveau_fence_del
nouveau_fence_ref
nouveau_fence_next
nouveau_pushbuf_flush
MARK_RING
nv50_screen_fence_emit
nouveau_fence_emit
nv50_flush

This bug manifested as an assertion failure in nouveau_fence.c, because
SIGSEGV handler tried to shutdown the application and used messed up
fence.

This issue was reported by Maxim Levitsky.

(commit e1e03ce4928edf4ea0ef43d853cb869f70b126aa in master)

---

 src/gallium/drivers/nouveau/nouveau_fence.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index ea2038c..26e4775 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -93,8 +93,6 @@ nouveau_fence_emit(struct nouveau_fence *fence)
/* set this now, so that if fence.emit triggers a flush we don't recurse */
fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 
-   screen-fence.emit(screen-base, fence-sequence);
-
++fence-ref;
 
if (screen-fence.tail)
@@ -103,6 +101,8 @@ nouveau_fence_emit(struct nouveau_fence *fence)
   screen-fence.head = fence;
 
screen-fence.tail = fence;
+
+   screen-fence.emit(screen-base, fence-sequence);
 }
 
 void

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


Mesa (7.11): nouveau: fix fence hang

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: 08fa61dab601d299541778f3a381e859f8f25e1e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08fa61dab601d299541778f3a381e859f8f25e1e

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Oct  8 23:05:25 2011 +0200

nouveau: fix fence hang

If there is not enough space in pushbuffer for fence emission
(nouveau_fence_emit - nv50_screen_fence_emit - MARK_RING),
the pushbuffer is flushed, which through flush_notify -
nv50_default_flush_notify - nouveau_fence_update marks currently
emitting fence as flushed. But actual emission is done after this mark.
So later when there is a need to wait on this fence and pushbuffer
was not flushed in between, fence wait will never finish causing
application to hang.

To fix this, introduce new fence state between AVAILABLE and EMITTED,
set it before emission and handle it everywhere.

Additionally obtain fence sequence numbers after possible flush in
MARK_RING, because we want to emit fences in correct order.

Reviewed-by: Christoph Bumiller e0425...@student.tuwien.ac.at

(commit 9849f366cbfd781ebeca725058029b70c96836f9 in master)

---

 src/gallium/drivers/nouveau/nouveau_fence.c  |   17 +++--
 src/gallium/drivers/nouveau/nouveau_fence.h  |7 ---
 src/gallium/drivers/nouveau/nouveau_screen.h |2 +-
 src/gallium/drivers/nv50/nv50_screen.c   |8 ++--
 src/gallium/drivers/nvc0/nvc0_screen.c   |8 ++--
 5 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index 26e4775..a2fcafe 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -86,12 +86,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 {
struct nouveau_screen *screen = fence-screen;
 
-   fence-sequence = ++screen-fence.sequence;
-
assert(fence-state == NOUVEAU_FENCE_STATE_AVAILABLE);
 
/* set this now, so that if fence.emit triggers a flush we don't recurse */
-   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
+   fence-state = NOUVEAU_FENCE_STATE_EMITTING;
 
++fence-ref;
 
@@ -102,7 +100,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 
screen-fence.tail = fence;
 
-   screen-fence.emit(screen-base, fence-sequence);
+   screen-fence.emit(screen-base, fence-sequence);
+
+   assert(fence-state == NOUVEAU_FENCE_STATE_EMITTING);
+   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 }
 
 void
@@ -162,7 +163,8 @@ nouveau_fence_update(struct nouveau_screen *screen, boolean 
flushed)
 
if (flushed) {
   for (fence = next; fence; fence = fence-next)
- fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
+ if (fence-state == NOUVEAU_FENCE_STATE_EMITTED)
+fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
}
 }
 
@@ -185,6 +187,9 @@ nouveau_fence_wait(struct nouveau_fence *fence)
struct nouveau_screen *screen = fence-screen;
uint32_t spins = 0;
 
+   /* wtf, someone is waiting on a fence in flush_notify handler? */
+   assert(fence-state != NOUVEAU_FENCE_STATE_EMITTING);
+
if (fence-state  NOUVEAU_FENCE_STATE_EMITTED) {
   nouveau_fence_emit(fence);
 
@@ -216,7 +221,7 @@ nouveau_fence_wait(struct nouveau_fence *fence)
 void
 nouveau_fence_next(struct nouveau_screen *screen)
 {
-   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTED)
+   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTING)
   nouveau_fence_emit(screen-fence.current);
 
nouveau_fence_ref(NULL, screen-fence.current);
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.h 
b/src/gallium/drivers/nouveau/nouveau_fence.h
index 680c75e..3984a9a 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.h
+++ b/src/gallium/drivers/nouveau/nouveau_fence.h
@@ -6,9 +6,10 @@
 #include util/u_double_list.h
 
 #define NOUVEAU_FENCE_STATE_AVAILABLE 0
-#define NOUVEAU_FENCE_STATE_EMITTED   1
-#define NOUVEAU_FENCE_STATE_FLUSHED   2
-#define NOUVEAU_FENCE_STATE_SIGNALLED 3
+#define NOUVEAU_FENCE_STATE_EMITTING  1
+#define NOUVEAU_FENCE_STATE_EMITTED   2
+#define NOUVEAU_FENCE_STATE_FLUSHED   3
+#define NOUVEAU_FENCE_STATE_SIGNALLED 4
 
 struct nouveau_fence_work {
struct list_head list;
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index d910809..40d2351 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -24,7 +24,7 @@ struct nouveau_screen {
struct nouveau_fence *current;
u32 sequence;
u32 sequence_ack;
-   void (*emit)(struct pipe_screen *, u32 sequence);
+   void (*emit)(struct pipe_screen *, u32 *sequence);
u32  (*update)(struct pipe_screen *);
} fence;
 
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index cc921d0..9606c99 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ 

Mesa (master): st/xorg: fix build without LLVM

2011-10-13 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 349e4db99e938f8ee8826b0d27e490c66a1e8356
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=349e4db99e938f8ee8826b0d27e490c66a1e8356

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Thu Oct 13 18:44:40 2011 +0200

st/xorg: fix build without LLVM

---

 src/gallium/targets/Makefile.xorg |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index 9269375..c96eded 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -33,6 +33,8 @@ LD = $(CXX)
 LDFLAGS += $(LLVM_LDFLAGS)
 USE_CXX=1
 DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
+else
+LDFLAGS += -lstdc++
 endif
 
 

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


Mesa (master): nv50: don't crash on TXD opcode

2011-10-11 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 7f3de70c3c8e9ec9dfc34ddd3a08c4b73c007541
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f3de70c3c8e9ec9dfc34ddd3a08c4b73c007541

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Mon Oct 10 23:31:04 2011 +0200

nv50: don't crash on TXD opcode

It doesn't implement full TXD, but at least it does not crash.
Fixes arb_shader_texture_lod-texgrad and glsl-fs-shadow2DGradARB-*
piglit tests.

---

 src/gallium/drivers/nv50/nv50_tgsi_to_nc.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c 
b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index 4b11ae1..717a902 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -847,6 +847,7 @@ translate_opcode(uint opcode)
case TGSI_OPCODE_TXP: return NV_OP_TEX;
case TGSI_OPCODE_TXB: return NV_OP_TXB;
case TGSI_OPCODE_TXL: return NV_OP_TXL;
+   case TGSI_OPCODE_TXD: return NV_OP_TEX;
case TGSI_OPCODE_XOR: return NV_OP_XOR;
default:
   return NV_OP_NOP;
@@ -1960,6 +1961,7 @@ bld_instruction(struct bld_context *bld,
case TGSI_OPCODE_TXB:
case TGSI_OPCODE_TXL:
case TGSI_OPCODE_TXP:
+   case TGSI_OPCODE_TXD: // fake
   bld_tex(bld, dst0, insn);
   break;
case TGSI_OPCODE_XPD:

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


Mesa (master): nv50,nvc0: avoid unnecessary flushes

2011-10-09 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: f03810fbdd41012422f6920c2026c49927bcb820
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f03810fbdd41012422f6920c2026c49927bcb820

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct  9 00:10:47 2011 +0200

nv50,nvc0: avoid unnecessary flushes

Relocations don't consume pushbuffer space, so there is no need to
ensure there is any space in pushbuffer.

---

 src/gallium/drivers/nv50/nv50_context.c |2 +-
 src/gallium/drivers/nv50/nv50_screen.c  |2 +-
 src/gallium/drivers/nvc0/nvc0_context.c |2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c  |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.c 
b/src/gallium/drivers/nv50/nv50_context.c
index 0d46406..a48b864 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -205,7 +205,7 @@ nv50_bufctx_emit_relocs(struct nv50_context *nv50)
n  = nv50-residents_size / sizeof(struct resident);
n += NV50_SCREEN_RESIDENT_BO_COUNT;
 
-   MARK_RING(nv50-screen-base.channel, n, n);
+   MARK_RING(nv50-screen-base.channel, 0, n);
 
for (ctx = 0; ctx  NV50_BUFCTX_COUNT; ++ctx) {
   array = nv50-residents[ctx];
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 7ff11ea..fe8712d 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -641,7 +641,7 @@ nv50_screen_make_buffers_resident(struct nv50_screen 
*screen)
 
const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
 
-   MARK_RING(chan, 5, 5);
+   MARK_RING(chan, 0, 5);
nouveau_bo_validate(chan, screen-code, flags);
nouveau_bo_validate(chan, screen-uniforms, flags);
nouveau_bo_validate(chan, screen-txc, flags);
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c 
b/src/gallium/drivers/nvc0/nvc0_context.c
index 8fa1675..d493d4b 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -209,7 +209,7 @@ nvc0_bufctx_emit_relocs(struct nvc0_context *nvc0)
n  = nvc0-residents_size / sizeof(struct resident);
n += NVC0_SCREEN_RESIDENT_BO_COUNT;
 
-   MARK_RING(nvc0-screen-base.channel, n, n);
+   MARK_RING(nvc0-screen-base.channel, 0, n);
 
for (ctx = 0; ctx  NVC0_BUFCTX_COUNT; ++ctx) {
   array = nvc0-residents[ctx];
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index 292cbdd..0da7be4 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -659,7 +659,7 @@ nvc0_screen_make_buffers_resident(struct nvc0_screen 
*screen)
 
const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
 
-   MARK_RING(chan, 5, 5);
+   MARK_RING(chan, 0, 5);
nouveau_bo_validate(chan, screen-text, flags);
nouveau_bo_validate(chan, screen-uniforms, flags);
nouveau_bo_validate(chan, screen-txc, flags);

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


Mesa (master): nouveau: fix fence hang

2011-10-09 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 9849f366cbfd781ebeca725058029b70c96836f9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9849f366cbfd781ebeca725058029b70c96836f9

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Oct  8 23:05:25 2011 +0200

nouveau: fix fence hang

If there is not enough space in pushbuffer for fence emission
(nouveau_fence_emit - nv50_screen_fence_emit - MARK_RING),
the pushbuffer is flushed, which through flush_notify -
nv50_default_flush_notify - nouveau_fence_update marks currently
emitting fence as flushed. But actual emission is done after this mark.
So later when there is a need to wait on this fence and pushbuffer
was not flushed in between, fence wait will never finish causing
application to hang.

To fix this, introduce new fence state between AVAILABLE and EMITTED,
set it before emission and handle it everywhere.

Additionally obtain fence sequence numbers after possible flush in
MARK_RING, because we want to emit fences in correct order.

Reviewed-by: Christoph Bumiller e0425...@student.tuwien.ac.at

Note: This is a candidate for the 7.11 branch.

---

 src/gallium/drivers/nouveau/nouveau_fence.c  |   17 +++--
 src/gallium/drivers/nouveau/nouveau_fence.h  |7 ---
 src/gallium/drivers/nouveau/nouveau_screen.h |2 +-
 src/gallium/drivers/nv50/nv50_screen.c   |8 ++--
 src/gallium/drivers/nvc0/nvc0_screen.c   |8 ++--
 5 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index 26e4775..a2fcafe 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -86,12 +86,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 {
struct nouveau_screen *screen = fence-screen;
 
-   fence-sequence = ++screen-fence.sequence;
-
assert(fence-state == NOUVEAU_FENCE_STATE_AVAILABLE);
 
/* set this now, so that if fence.emit triggers a flush we don't recurse */
-   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
+   fence-state = NOUVEAU_FENCE_STATE_EMITTING;
 
++fence-ref;
 
@@ -102,7 +100,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 
screen-fence.tail = fence;
 
-   screen-fence.emit(screen-base, fence-sequence);
+   screen-fence.emit(screen-base, fence-sequence);
+
+   assert(fence-state == NOUVEAU_FENCE_STATE_EMITTING);
+   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 }
 
 void
@@ -162,7 +163,8 @@ nouveau_fence_update(struct nouveau_screen *screen, boolean 
flushed)
 
if (flushed) {
   for (fence = next; fence; fence = fence-next)
- fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
+ if (fence-state == NOUVEAU_FENCE_STATE_EMITTED)
+fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
}
 }
 
@@ -185,6 +187,9 @@ nouveau_fence_wait(struct nouveau_fence *fence)
struct nouveau_screen *screen = fence-screen;
uint32_t spins = 0;
 
+   /* wtf, someone is waiting on a fence in flush_notify handler? */
+   assert(fence-state != NOUVEAU_FENCE_STATE_EMITTING);
+
if (fence-state  NOUVEAU_FENCE_STATE_EMITTED) {
   nouveau_fence_emit(fence);
 
@@ -216,7 +221,7 @@ nouveau_fence_wait(struct nouveau_fence *fence)
 void
 nouveau_fence_next(struct nouveau_screen *screen)
 {
-   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTED)
+   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTING)
   nouveau_fence_emit(screen-fence.current);
 
nouveau_fence_ref(NULL, screen-fence.current);
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.h 
b/src/gallium/drivers/nouveau/nouveau_fence.h
index 680c75e..3984a9a 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.h
+++ b/src/gallium/drivers/nouveau/nouveau_fence.h
@@ -6,9 +6,10 @@
 #include util/u_double_list.h
 
 #define NOUVEAU_FENCE_STATE_AVAILABLE 0
-#define NOUVEAU_FENCE_STATE_EMITTED   1
-#define NOUVEAU_FENCE_STATE_FLUSHED   2
-#define NOUVEAU_FENCE_STATE_SIGNALLED 3
+#define NOUVEAU_FENCE_STATE_EMITTING  1
+#define NOUVEAU_FENCE_STATE_EMITTED   2
+#define NOUVEAU_FENCE_STATE_FLUSHED   3
+#define NOUVEAU_FENCE_STATE_SIGNALLED 4
 
 struct nouveau_fence_work {
struct list_head list;
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index cf291c6..808500f 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -24,7 +24,7 @@ struct nouveau_screen {
struct nouveau_fence *current;
u32 sequence;
u32 sequence_ack;
-   void (*emit)(struct pipe_screen *, u32 sequence);
+   void (*emit)(struct pipe_screen *, u32 *sequence);
u32  (*update)(struct pipe_screen *);
} fence;
 
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index c36f3cd..7ff11ea 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ 

Mesa (master): nouveau: hide some debugging messages behind environment variable

2011-10-09 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 90dcd6c89ab4afa55ca19d572a1a695cf55cb1b2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=90dcd6c89ab4afa55ca19d572a1a695cf55cb1b2

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Oct  8 23:58:32 2011 +0200

nouveau: hide some debugging messages behind environment variable

They spam console, but are not very useful - hide them behind
NOUVEAU_MESA_DEBUG environment variable.

---

 src/gallium/drivers/nouveau/nouveau_buffer.c |3 ++-
 src/gallium/drivers/nouveau/nouveau_mm.c |5 +++--
 src/gallium/drivers/nouveau/nouveau_screen.c |7 +++
 src/gallium/drivers/nouveau/nouveau_screen.h |2 ++
 src/gallium/drivers/nv50/nv50_screen.c   |5 +++--
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c 
b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 01d3aa4..60d8e37 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -431,7 +431,8 @@ nouveau_buffer_migrate(struct nouveau_context *nv,
  /* keep a system memory copy of our data in case we hit a fallback */
  if (!nouveau_buffer_data_fetch(buf, buf-bo, buf-offset, size))
 return FALSE;
- debug_printf(migrating %u KiB to VRAM\n, size / 1024);
+ if (nouveau_mesa_debug)
+debug_printf(migrating %u KiB to VRAM\n, size / 1024);
   }
 
   offset = buf-offset;
diff --git a/src/gallium/drivers/nouveau/nouveau_mm.c 
b/src/gallium/drivers/nouveau/nouveau_mm.c
index 2a4e322..8d0b7bf 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/src/gallium/drivers/nouveau/nouveau_mm.c
@@ -145,8 +145,9 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order)
 
cache-allocated += size;
 
-   debug_printf(MM: new slab, total memory = %PRIu64 KiB\n,
-cache-allocated / 1024);
+   if (nouveau_mesa_debug)
+  debug_printf(MM: new slab, total memory = %PRIu64 KiB\n,
+   cache-allocated / 1024);
 
return PIPE_OK;
 }
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 223e768..cdc2bff 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -10,6 +10,7 @@
 
 #include stdio.h
 #include errno.h
+#include stdlib.h
 
 #include nouveau/nouveau_bo.h
 #include nouveau/nouveau_mm.h
@@ -21,6 +22,8 @@
 #include state_tracker/drm_driver.h
 #include util/u_simple_screen.h
 
+int nouveau_mesa_debug = 0;
+
 static const char *
 nouveau_screen_get_name(struct pipe_screen *pscreen)
 {
@@ -202,6 +205,10 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
struct pipe_screen *pscreen = screen-base;
int ret;
 
+   char *nv_dbg = getenv(NOUVEAU_MESA_DEBUG);
+   if (nv_dbg)
+  nouveau_mesa_debug = atoi(nv_dbg);
+
ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
512*1024, screen-channel);
if (ret)
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index 808500f..d2003e6 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -5,6 +5,8 @@
 #include util/u_memory.h
 typedef uint32_t u32;
 
+extern int nouveau_mesa_debug;
+
 struct nouveau_bo;
 
 struct nouveau_screen {
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index fe8712d..0bd6057 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -502,8 +502,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
 
screen-tls_size = tls_space * max_warps * 32;
 
-   debug_printf(max_warps = %i, tls_size = %PRIu64 KiB\n,
-max_warps, screen-tls_size  10);
+   if (nouveau_mesa_debug)
+  debug_printf(max_warps = %i, tls_size = %PRIu64 KiB\n,
+ max_warps, screen-tls_size  10);
 
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1  16, screen-tls_size,
 screen-tls_bo);

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


Mesa (master): nouveau: fix crash during fence emission

2011-09-25 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 65b8eea0644fdb7e9150d0e98c06d7f8ba6d5302
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=65b8eea0644fdb7e9150d0e98c06d7f8ba6d5302

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Sep 25 16:01:19 2011 +0200

nouveau: fix crash during fence emission

Fence emission can flush the push buffer, which through flush_notify
unreferences recently emitted fence. If ref count is increased after
fence emission, unreference deletes the fence, which causes SIGSEGV.

Backtrace:
nouveau_fence_del
nouveau_fence_ref
nouveau_fence_next
nouveau_pushbuf_flush
MARK_RING
nv50_screen_fence_emit
nouveau_fence_emit
nv50_flush

This bug manifested as an assertion failure in nouveau_fence.c, because
SIGSEGV handler tried to shutdown the application and used messed up
fence.

This issue was reported by Maxim Levitsky.

Note: This is a candidate for the 7.11 branch.

---

 src/gallium/drivers/nouveau/nouveau_fence.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index ea2038c..26e4775 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -93,8 +93,6 @@ nouveau_fence_emit(struct nouveau_fence *fence)
/* set this now, so that if fence.emit triggers a flush we don't recurse */
fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 
-   screen-fence.emit(screen-base, fence-sequence);
-
++fence-ref;
 
if (screen-fence.tail)
@@ -103,6 +101,8 @@ nouveau_fence_emit(struct nouveau_fence *fence)
   screen-fence.head = fence;
 
screen-fence.tail = fence;
+
+   screen-fence.emit(screen-base, fence-sequence);
 }
 
 void

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


Mesa (master): nv50/nvc0: add support for R4A4_UNORM and A4R4_UNORM formats

2011-09-13 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: f626d99edf17a1d3203b257f6fe6993229ea6866
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f626d99edf17a1d3203b257f6fe6993229ea6866

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Sep 13 15:14:19 2011 +0200

nv50/nvc0: add support for R4A4_UNORM and A4R4_UNORM formats

R4A4 is needed by OSD in mplayer's xvmc output

---

 src/gallium/drivers/nv50/nv50_formats.c |8 
 src/gallium/drivers/nvc0/nvc0_formats.c |8 
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_formats.c 
b/src/gallium/drivers/nv50/nv50_formats.c
index 34502d0..4e0e581 100644
--- a/src/gallium/drivers/nv50/nv50_formats.c
+++ b/src/gallium/drivers/nv50/nv50_formats.c
@@ -575,6 +575,14 @@ const struct nv50_format 
nv50_format_table[PIPE_FORMAT_COUNT] =
 B_(C3, C2, C1, C0, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
 SAMPLER_VIEW },
 
+   [PIPE_FORMAT_R4A4_UNORM] = { 0,
+B_(C0, ZERO, ZERO, C1, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
+SAMPLER_VIEW },
+
+   [PIPE_FORMAT_A4R4_UNORM] = { 0,
+B_(C1, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
+SAMPLER_VIEW },
+
/* FIXED FORMATS - hw doesn't support these, convert on vbo push for now */
 
[PIPE_FORMAT_R32G32B32A32_FIXED] = { 0,
diff --git a/src/gallium/drivers/nvc0/nvc0_formats.c 
b/src/gallium/drivers/nvc0/nvc0_formats.c
index 8dd4419..87d7fd8 100644
--- a/src/gallium/drivers/nvc0/nvc0_formats.c
+++ b/src/gallium/drivers/nvc0/nvc0_formats.c
@@ -576,6 +576,14 @@ const struct nvc0_format 
nvc0_format_table[PIPE_FORMAT_COUNT] =
 B_(C3, C2, C1, C0, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
 SAMPLER_VIEW },
 
+   [PIPE_FORMAT_R4A4_UNORM] = { 0,
+B_(C0, ZERO, ZERO, C1, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
+SAMPLER_VIEW },
+
+   [PIPE_FORMAT_A4R4_UNORM] = { 0,
+B_(C1, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
+SAMPLER_VIEW },
+
/* FIXED FORMATS - hw doesn't support these, convert on vbo push for now */
 
[PIPE_FORMAT_R32G32B32A32_FIXED] = { 0,

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


Mesa (7.11): nouveau: fix nouveau_fence leak

2011-09-13 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: e7794048ca8e4122e9e5de8ba4ab1f93331f2ba8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7794048ca8e4122e9e5de8ba4ab1f93331f2ba8

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Sep  6 16:12:52 2011 +0200

nouveau: fix nouveau_fence leak

(commit 96054375b1ea98d7827f0d4b567168fa2baeb38e in master)

---

 src/gallium/drivers/nouveau/nouveau_fence.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index d8f59dc..ea2038c 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -219,5 +219,7 @@ nouveau_fence_next(struct nouveau_screen *screen)
if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTED)
   nouveau_fence_emit(screen-fence.current);
 
+   nouveau_fence_ref(NULL, screen-fence.current);
+
nouveau_fence_new(screen, screen-fence.current, FALSE);
 }

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


Mesa (master): nv50: fix screen-blitctx memory leak

2011-09-08 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: d8035fe173d87b319d85fcd64192a6d4fbe5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8035fe173d87b319d85fcd64192a6d4fbe5

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Aug 28 01:05:22 2011 +0200

nv50: fix screen-blitctx memory leak

---

 src/gallium/drivers/nv50/nv50_screen.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 235cd82..aa791ae 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -226,6 +226,8 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
   nouveau_fence_ref (NULL, screen-base.fence.current);
}
screen-base.channel-user_private = NULL;
+   if (screen-blitctx)
+  FREE(screen-blitctx);
 
nouveau_bo_ref(NULL, screen-code);
nouveau_bo_ref(NULL, screen-tls_bo);

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


Mesa (master): nouveau: fix nouveau_fence leak

2011-09-08 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 96054375b1ea98d7827f0d4b567168fa2baeb38e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96054375b1ea98d7827f0d4b567168fa2baeb38e

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Sep  6 16:12:52 2011 +0200

nouveau: fix nouveau_fence leak

Note: This is a candidate for the 7.11 branch.

---

 src/gallium/drivers/nouveau/nouveau_fence.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index d8f59dc..ea2038c 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -219,5 +219,7 @@ nouveau_fence_next(struct nouveau_screen *screen)
if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTED)
   nouveau_fence_emit(screen-fence.current);
 
+   nouveau_fence_ref(NULL, screen-fence.current);
+
nouveau_fence_new(screen, screen-fence.current, FALSE);
 }

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


Demos (master): egl/opengl: fix build with cmake

2011-09-06 Thread Marcin Ślusarz
Module: Demos
Branch: master
Commit: e877df6a24b86a8effaedf8fa92390c437eb44f3
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=e877df6a24b86a8effaedf8fa92390c437eb44f3

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Sep  6 20:20:17 2011 +0200

egl/opengl: fix build with cmake

---

 src/egl/opengl/CMakeLists.txt |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/opengl/CMakeLists.txt b/src/egl/opengl/CMakeLists.txt
index ede9ec3..a8b9d02 100644
--- a/src/egl/opengl/CMakeLists.txt
+++ b/src/egl/opengl/CMakeLists.txt
@@ -1,5 +1,6 @@
 include_directories(${EGL_INCLUDE_DIR}
   ../eglut
+  ../../util
   )
 
 add_executable(eglinfo eglinfo.c)

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


Mesa (master): xorg/nouveau: blacklist all pre NV30 cards

2011-06-22 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 50d7d03a7923ababa22af0ad185941c3e7f8b9cb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50d7d03a7923ababa22af0ad185941c3e7f8b9cb

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Jun  5 22:25:26 2011 +0200

xorg/nouveau: blacklist all pre NV30 cards

Bail out early in probe, so other driver can take control of the card.
Doing it in screen_create would be too late.

---

 src/gallium/targets/xorg-nouveau/Makefile   |3 +
 src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   63 +++---
 2 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/src/gallium/targets/xorg-nouveau/Makefile 
b/src/gallium/targets/xorg-nouveau/Makefile
index 16ac954..755969c 100644
--- a/src/gallium/targets/xorg-nouveau/Makefile
+++ b/src/gallium/targets/xorg-nouveau/Makefile
@@ -23,4 +23,7 @@ DRIVER_PIPES = \
 DRIVER_LINKS = \
$(shell pkg-config --libs libdrm libdrm_nouveau)
 
+DRIVER_INCLUDES = \
+   $(shell pkg-config --cflags-only-I libdrm libdrm_nouveau xf86driproto)
+
 include ../Makefile.xorg
diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c 
b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
index a25254a..43470a1 100644
--- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
@@ -29,6 +29,9 @@
  */
 
 #include ../../state_trackers/xorg/xorg_winsys.h
+#include nouveau_drmif.h
+#include xorg/dri.h
+#include xf86drmMode.h
 
 static void nouveau_xorg_identify(int flags);
 static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
@@ -38,16 +41,9 @@ static Bool nouveau_xorg_pci_probe(DriverPtr driver, int 
entity_num,
 static const struct pci_id_match nouveau_xorg_device_match[] = {
 { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
   0x0003, 0x00ff, 0 },
-{ 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
-  0x0003, 0x00ff, 0 },
 {0, 0, 0},
 };
 
-static SymTabRec nouveau_xorg_chipsets[] = {
-{PCI_MATCH_ANY, NVIDIA Graphics Device},
-{-1, NULL}
-};
-
 static PciChipsets nouveau_xorg_pci_devices[] = {
 {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
 {-1, -1, NULL}
@@ -121,8 +117,7 @@ nouveau_xorg_setup(pointer module, pointer opts, int 
*errmaj, int *errmin)
 static void
 nouveau_xorg_identify(int flags)
 {
-xf86PrintChipsets(nouveau2, Driver for Modesetting Kernel Drivers,
- nouveau_xorg_chipsets);
+xf86DrvMsg(0, X_INFO, nouveau2: Gallium3D based 2D driver for NV30+ 
NVIDIA chipsets\n);
 }
 
 static Bool
@@ -131,6 +126,56 @@ nouveau_xorg_pci_probe(DriverPtr driver,
 {
 ScrnInfoPtr scrn = NULL;
 EntityInfoPtr entity;
+struct nouveau_device *dev = NULL;
+char *busid;
+int chipset, ret;
+
+if (device-vendor_id != 0x10DE)
+   return FALSE;
+
+if (!xf86LoaderCheckSymbol(DRICreatePCIBusID)) {
+   xf86DrvMsg(-1, X_ERROR, [drm] No DRICreatePCIBusID symbol\n);
+   return FALSE;
+}
+busid = DRICreatePCIBusID(device);
+
+ret = nouveau_device_open(dev, busid);
+if (ret) {
+   xf86DrvMsg(-1, X_ERROR, [drm] failed to open device\n);
+   free(busid);
+   return FALSE;
+}
+
+chipset = dev-chipset;
+nouveau_device_close(dev);
+
+ret = drmCheckModesettingSupported(busid);
+free(busid);
+if (ret) {
+   xf86DrvMsg(-1, X_ERROR, [drm] KMS not enabled\n);
+   return FALSE;
+}
+
+switch (chipset  0xf0) {
+case 0x00:
+case 0x10:
+case 0x20:
+   xf86DrvMsg(-1, X_NOTICE, Too old chipset: NV%02x\n, chipset);
+   return FALSE;
+case 0x30:
+case 0x40:
+case 0x60:
+case 0x50:
+case 0x80:
+case 0x90:
+case 0xa0:
+case 0xc0:
+   xf86DrvMsg(-1, X_INFO, Detected chipset: NV%02x\n, chipset);
+   break;
+default:
+   xf86DrvMsg(-1, X_ERROR, Unknown chipset: NV%02x\n, chipset);
+   return FALSE;
+}
 
 scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
   NULL, NULL, NULL, NULL, NULL);

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