[Mesa-dev] exec_list question

2014-01-12 Thread Timothy Arceri
Hi Guys,

I've been chasing my tail most of the afternoon using exec_list
basically I was just trying to copy all but the first element from one
list to another using the code bellow. 

exec_list *copy_dims =
&type->array_specifier->array_dimensions;
int i = 0;
//TODO: has to be better way to copy all dimension but the
first one
foreach_list (node, copy_dims) {
   if(i>0)
  array_specifier->array_dimensions.push_tail(node);
   i++;
}

But when doing this the last element from the list I was coping FROM was
somehow being lost.

Replacing foreach_list with foreach_list_safe seems to have fixed the
problem. However I don't really understand why is someone able to
explain to me what's happening here?


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


Re: [Mesa-dev] exec_list question

2014-01-12 Thread Timothy Arceri
I just tried the below code which is much cleaner but it to causes the
original list to lose the last node. 

exec_node *node = type->array_specifier->array_dimensions.head->next;
for (/* nothing */; !node->is_tail_sentinel(); node = node->next) {
   array_specifier->array_dimensions.push_tail(node);
}

I originally thought the pointer was being freed by an access to the
copied list somewhere but since foreach_list_safe makes things work
there must be something else happening.


On Sun, 2014-01-12 at 19:08 +1100, Timothy Arceri wrote:
> Hi Guys,
> 
> I've been chasing my tail most of the afternoon using exec_list
> basically I was just trying to copy all but the first element from one
> list to another using the code bellow. 
> 
> exec_list *copy_dims =
> &type->array_specifier->array_dimensions;
> int i = 0;
> //TODO: has to be better way to copy all dimension but the
> first one
> foreach_list (node, copy_dims) {
>if(i>0)
>   array_specifier->array_dimensions.push_tail(node);
>i++;
> }
> 
> But when doing this the last element from the list I was coping FROM was
> somehow being lost.
> 
> Replacing foreach_list with foreach_list_safe seems to have fixed the
> problem. However I don't really understand why is someone able to
> explain to me what's happening here?
> 


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


Re: [Mesa-dev] exec_list question

2014-01-12 Thread Timothy Arceri
Ok please ignore I understand how exec_list works now. What I was trying
to do was silly I'll need to figure out a different solution sorry about
the noise.

On Sun, 2014-01-12 at 19:39 +1100, Timothy Arceri wrote:
> I just tried the below code which is much cleaner but it to causes the
> original list to lose the last node. 
> 
> exec_node *node = type->array_specifier->array_dimensions.head->next;
> for (/* nothing */; !node->is_tail_sentinel(); node = node->next) {
>array_specifier->array_dimensions.push_tail(node);
> }
> 
> I originally thought the pointer was being freed by an access to the
> copied list somewhere but since foreach_list_safe makes things work
> there must be something else happening.
> 
> 
> On Sun, 2014-01-12 at 19:08 +1100, Timothy Arceri wrote:
> > Hi Guys,
> > 
> > I've been chasing my tail most of the afternoon using exec_list
> > basically I was just trying to copy all but the first element from one
> > list to another using the code bellow. 
> > 
> > exec_list *copy_dims =
> > &type->array_specifier->array_dimensions;
> > int i = 0;
> > //TODO: has to be better way to copy all dimension but the
> > first one
> > foreach_list (node, copy_dims) {
> >if(i>0)
> >   array_specifier->array_dimensions.push_tail(node);
> >i++;
> > }
> > 
> > But when doing this the last element from the list I was coping FROM was
> > somehow being lost.
> > 
> > Replacing foreach_list with foreach_list_safe seems to have fixed the
> > problem. However I don't really understand why is someone able to
> > explain to me what's happening here?
> > 
> 


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


[Mesa-dev] [PATCH] nv50, nvc0: initialize ctx->sample_mask to ~0

2014-01-12 Thread Ilia Mirkin
Commit 95bf222603b (cso_context: Fix cso_context::sample_mask initial
value.) fixed the cso sample mask to be initialized to ~0. The cso code
is also careful not to needlessly call set_sample_mask, so we ended up
with the ctx->sample_mask never being set. This broke a number of
EXT_framebuffer_multisample piglit tests.

Signed-off-by: Ilia Mirkin 
---
 src/gallium/drivers/nouveau/nv50/nv50_state.c | 2 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c 
b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index b6a180e..87dd07f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -1123,4 +1123,6 @@ nv50_init_state_functions(struct nv50_context *nv50)
pipe->create_stream_output_target = nv50_so_target_create;
pipe->stream_output_target_destroy = nv50_so_target_destroy;
pipe->set_stream_output_targets = nv50_set_stream_output_targets;
+
+   nv50->sample_mask = ~0;
 }
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index 4b8632a..0213a8e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -1229,4 +1229,6 @@ nvc0_init_state_functions(struct nvc0_context *nvc0)
pipe->set_global_binding = nvc0_set_global_bindings;
pipe->set_compute_resources = nvc0_set_compute_resources;
pipe->set_shader_resources = nvc0_set_shader_resources;
+
+   nvc0->sample_mask = ~0;
 }
-- 
1.8.3.2

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


[Mesa-dev] [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))

2014-01-12 Thread Keith Packard
the drmServerInfo member, debug_print, takes a printf format string
and varargs list. Tell the compiler about it.

Signed-off-by: Keith Packard 
---
 xf86drm.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xf86drm.h b/xf86drm.h
index 1e763a3..5e170f8 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -92,8 +92,14 @@ extern "C" {
 typedef unsigned int  drmSize, *drmSizePtr;/**< For mapped 
regions */
 typedef void  *drmAddress, **drmAddressPtr; /**< For mapped regions */
 
+#if (__GNUC__ >= 3)
+#define DRM_PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
+#else
+#define DRM_PRINTFLIKE(f, a)
+#endif
+
 typedef struct _drmServerInfo {
-  int (*debug_print)(const char *format, va_list ap);
+  int (*debug_print)(const char *format, va_list ap) DRM_PRINTFLIKE(1,0);
   int (*load_module)(const char *name);
   void (*get_perms)(gid_t *, mode_t *);
 } drmServerInfo, *drmServerInfoPtr;
-- 
1.8.5.2

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


Re: [Mesa-dev] exec_list question

2014-01-12 Thread Ian Romanick
I think you should use move_nodes_to to move all the nodes from one to
the other, pop_head to remove the head, then push_head to put it back on
the original list.  There's probably a more clever way, but it may not
be worth the effort to figure it out.

On 01/12/2014 12:08 AM, Timothy Arceri wrote:
> Hi Guys,
> 
> I've been chasing my tail most of the afternoon using exec_list
> basically I was just trying to copy all but the first element from one
> list to another using the code bellow. 
> 
> exec_list *copy_dims =
> &type->array_specifier->array_dimensions;
> int i = 0;
> //TODO: has to be better way to copy all dimension but the
> first one
> foreach_list (node, copy_dims) {
>if(i>0)
>   array_specifier->array_dimensions.push_tail(node);
>i++;
> }
> 
> But when doing this the last element from the list I was coping FROM was
> somehow being lost.
> 
> Replacing foreach_list with foreach_list_safe seems to have fixed the
> problem. However I don't really understand why is someone able to
> explain to me what's happening here?
> 
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 

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


[Mesa-dev] [PATCH] mesa: use signed temporary variable to store _ColorDrawBufferIndexes

2014-01-12 Thread Emil Velikov
_ColorDrawBufferIndexes is defined as GLint* and using a GLuint*
will result in the first part of the conditional to be evaluated to
true always.

Unintentionally introduced by the following commit, this will result
in a driver segfault if one is using an old version of the piglit test

bin/clearbuffer-mixed-format -auto -fbo

commit 03d848ea1003abefd8fe51a5b4a780527cd852af
Author: Marek Olšák 
Date:   Wed Dec 4 00:27:20 2013 +0100

mesa: fix interpretation of glClearBuffer(drawbuffer)

This corresponding piglit tests supported this incorrect behavior instead of
pointing at it.

Cc: Marek Olšák 
Cc: 10.0 9.2 9.1 
Signed-off-by: Emil Velikov 
---
 src/mesa/main/clear.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index f0b525f..d568ed8 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -274,7 +274,7 @@ make_color_buffer_mask(struct gl_context *ctx, GLint 
drawbuffer)
   break;
default:
   {
- GLuint buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[drawbuffer];
+ GLint buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[drawbuffer];
 
  if (buf >= 0 && att[buf].Renderbuffer) {
 mask |= 1 << buf;
-- 
1.8.5.2

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


Re: [Mesa-dev] [PATCH] mesa: use signed temporary variable to store _ColorDrawBufferIndexes

2014-01-12 Thread Emil Velikov
On 12/01/14 22:52, Emil Velikov wrote:
> _ColorDrawBufferIndexes is defined as GLint* and using a GLuint*
> will result in the first part of the conditional to be evaluated to
> true always.
> 
> Unintentionally introduced by the following commit, this will result
> in a driver segfault if one is using an old version of the piglit test
> 
> bin/clearbuffer-mixed-format -auto -fbo
> 
And by old, my piglit was at e696687133c02b1e16ae198101ac04cd5fd6eb41
when I ran into this problem.

Emil

> commit 03d848ea1003abefd8fe51a5b4a780527cd852af
> Author: Marek Olšák 
> Date:   Wed Dec 4 00:27:20 2013 +0100
> 
> mesa: fix interpretation of glClearBuffer(drawbuffer)
> 
> This corresponding piglit tests supported this incorrect behavior instead 
> of
> pointing at it.
> 
> Cc: Marek Olšák 
> Cc: 10.0 9.2 9.1 
> Signed-off-by: Emil Velikov 
> ---
>  src/mesa/main/clear.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
> index f0b525f..d568ed8 100644
> --- a/src/mesa/main/clear.c
> +++ b/src/mesa/main/clear.c
> @@ -274,7 +274,7 @@ make_color_buffer_mask(struct gl_context *ctx, GLint 
> drawbuffer)
>break;
> default:
>{
> - GLuint buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[drawbuffer];
> + GLint buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[drawbuffer];
>  
>   if (buf >= 0 && att[buf].Renderbuffer) {
>  mask |= 1 << buf;
> 

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


[Mesa-dev] [PATCH 01/10] loader: introduce the loader util lib

2014-01-12 Thread Emil Velikov
All the various window system integration layers duplicate roughly the
same code for figuring out device and driver name, pci-id's, etc.  Which
is sad.  So extract it out into a loader util lib.

Signed-off-by: Rob Clark 

v2 (Emil)
* Separate the introduction of libloader from the code de-duplication.
* Strip out non-pci devices support.
* Add scons + Android build system support.
* Add VISIBILITY_CFLAGS to avoid exporting the loader funcs.

v3 (Emil)
* PIPE_OS_ANDROID is undefined at this scope, use ANDROID
* Make sure we define _EGL_NO_DRM when building only swrast

Signed-off-by: Emil Velikov 
---
 Android.mk|   1 +
 configure.ac  |   1 +
 include/pci_ids/pci_id_driver_map.h   |  24 ++-
 src/Makefile.am   |   2 +-
 src/SConscript|   1 +
 src/egl/drivers/dri2/Android.mk   |   1 +
 src/egl/drivers/dri2/Makefile.am  |   1 +
 src/gallium/auxiliary/pipe-loader/Makefile.am |   1 +
 src/gallium/state_trackers/egl/Makefile.am|   1 +
 src/gallium/state_trackers/egl/SConscript |   1 +
 src/gallium/targets/egl-static/Android.mk |   1 +
 src/gallium/targets/egl-static/Makefile.am|   1 +
 src/gallium/targets/egl-static/SConscript |   1 +
 src/gbm/Makefile.am   |   6 +-
 src/glx/Makefile.am   |   1 +
 src/glx/SConscript|   1 +
 src/loader/Android.mk |  48 +
 src/loader/Makefile.am|  37 
 src/loader/Makefile.sources   |   2 +
 src/loader/SConscript |  28 +++
 src/loader/loader.c   | 264 ++
 src/loader/loader.h   |  57 ++
 22 files changed, 466 insertions(+), 15 deletions(-)
 create mode 100644 src/loader/Android.mk
 create mode 100644 src/loader/Makefile.am
 create mode 100644 src/loader/Makefile.sources
 create mode 100644 src/loader/SConscript
 create mode 100644 src/loader/loader.c
 create mode 100644 src/loader/loader.h

diff --git a/Android.mk b/Android.mk
index c3c1f08..05ed62f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -78,6 +78,7 @@ endif
 ifneq ($(strip $(MESA_GPU_DRIVERS)),)
 
 SUBDIRS := \
+   src/loader \
src/mapi \
src/glsl \
src/mesa \
diff --git a/configure.ac b/configure.ac
index 4b55140..ce677d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2059,6 +2059,7 @@ AC_CONFIG_FILES([Makefile
src/glx/Makefile
src/glx/tests/Makefile
src/gtest/Makefile
+   src/loader/Makefile
src/mapi/Makefile
src/mapi/es1api/Makefile
src/mapi/es1api/glesv1_cm.pc
diff --git a/include/pci_ids/pci_id_driver_map.h 
b/include/pci_ids/pci_id_driver_map.h
index 8a97c6f..2e88451 100644
--- a/include/pci_ids/pci_id_driver_map.h
+++ b/include/pci_ids/pci_id_driver_map.h
@@ -2,6 +2,7 @@
 #define _PCI_ID_DRIVER_MAP_H_
 
 #include 
+#include "loader.h"
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
@@ -19,7 +20,6 @@ static const int i965_chip_ids[] = {
 #undef CHIPSET
 };
 
-#ifndef DRIVER_MAP_GALLIUM_ONLY
 static const int r100_chip_ids[] = {
 #define CHIPSET(chip, name, family) chip,
 #include "pci_ids/radeon_pci_ids.h"
@@ -31,7 +31,6 @@ static const int r200_chip_ids[] = {
 #include "pci_ids/r200_pci_ids.h"
 #undef CHIPSET
 };
-#endif
 
 static const int r300_chip_ids[] = {
 #define CHIPSET(chip, name, family) chip,
@@ -62,18 +61,17 @@ static const struct {
const char *driver;
const int *chip_ids;
int num_chips_ids;
+   unsigned driver_types;
 } driver_map[] = {
-   { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
-   { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
-#ifndef DRIVER_MAP_GALLIUM_ONLY
-   { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
-   { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
-#endif
-   { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) },
-   { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) },
-   { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) },
-   { 0x10de, "nouveau", NULL, -1 },
-   { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) },
+   { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids), _LOADER_DRI | 
_LOADER_GALLIUM },
+   { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids), _LOADER_DRI | 
_LOADER_GALLIUM },
+   { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids), _LOADER_DRI },
+   { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids), _LOADER_DRI },
+   { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids), _LOADER_GALLIUM 
},
+   { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids), _LOADER_GALLIUM 
},
+   { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_S

[Mesa-dev] [PATCH 04/10] egl-static: use loader util lib

2014-01-12 Thread Emil Velikov
v2
* Drop the no longer used _EGL_NO_DRM from Android.mk.

Signed-off-by: Emil Velikov 
---
 src/egl/main/Android.mk|   1 +
 src/gallium/targets/egl-static/Android.mk  |   6 +-
 src/gallium/targets/egl-static/Makefile.am |   1 +
 src/gallium/targets/egl-static/SConscript  |   1 +
 src/gallium/targets/egl-static/egl.c   | 185 ++---
 5 files changed, 14 insertions(+), 180 deletions(-)

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 30e5ea7..61465da 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -154,6 +154,7 @@ LOCAL_STATIC_LIBRARIES := \
libmesa_glsl \
libmesa_glsl_utils \
libmesa_gallium \
+   libloader \
$(LOCAL_STATIC_LIBRARIES)
 
 endif # MESA_BUILD_GALLIUM
diff --git a/src/gallium/targets/egl-static/Android.mk 
b/src/gallium/targets/egl-static/Android.mk
index 88df6d1..37244b5 100644
--- a/src/gallium/targets/egl-static/Android.mk
+++ b/src/gallium/targets/egl-static/Android.mk
@@ -45,10 +45,8 @@ LOCAL_C_INCLUDES := \
 # swrast
 LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
 
-# swrast only
-ifeq ($(MESA_GPU_DRIVERS),swrast)
-LOCAL_CFLAGS += -D_EGL_NO_DRM
-else
+# !swrast only
+ifneq ($(MESA_GPU_DRIVERS),swrast)
 LOCAL_C_INCLUDES += \
$(DRM_TOP)/include/drm \
$(DRM_TOP)
diff --git a/src/gallium/targets/egl-static/Makefile.am 
b/src/gallium/targets/egl-static/Makefile.am
index ebffd0e..73bb795 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -61,6 +61,7 @@ egl_gallium_la_LIBADD = \
$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
$(top_builddir)/src/gallium/state_trackers/egl/libegl.la \
$(top_builddir)/src/egl/main/libEGL.la \
+   $(top_builddir)/src/loader/libloader.la \
$(CLOCK_LIB) \
$(LIBUDEV_LIBS) \
$(DLOPEN_LIBS) \
diff --git a/src/gallium/targets/egl-static/SConscript 
b/src/gallium/targets/egl-static/SConscript
index 56e12e8..83937fe 100644
--- a/src/gallium/targets/egl-static/SConscript
+++ b/src/gallium/targets/egl-static/SConscript
@@ -31,6 +31,7 @@ env.Prepend(LIBS = [
 rbug,
 trace,
 galahad,
+libloader,
 gallium,
 egl,
 st_egl,
diff --git a/src/gallium/targets/egl-static/egl.c 
b/src/gallium/targets/egl-static/egl.c
index 0b59bdb..f19f024 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -28,14 +28,7 @@
 #include "common/egl_g3d_loader.h"
 #include "egldriver.h"
 #include "egllog.h"
-
-#ifdef HAVE_LIBUDEV
-#include  /* for sscanf */
-#include 
-#endif
-
-#define DRIVER_MAP_GALLIUM_ONLY
-#include "pci_ids/pci_id_driver_map.h"
+#include "loader.h"
 
 #include "egl_pipe.h"
 #include "egl_st.h"
@@ -60,180 +53,15 @@ get_st_api(enum st_api_type api)
return stmod->stapi;
 }
 
-#ifdef HAVE_LIBUDEV
-
-static boolean
-drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
-{
-   struct udev *udev = NULL;
-   struct udev_device *device = NULL, *parent;
-   struct stat buf;
-   const char *pci_id;
-
-   *chip_id = -1;
-
-   udev = udev_new();
-   if (fstat(fd, &buf) < 0) {
-  _eglLog(_EGL_WARNING, "failed to stat fd %d", fd);
-  goto out;
-   }
-
-   device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
-   if (device == NULL) {
-  _eglLog(_EGL_WARNING,
-  "could not create udev device for fd %d", fd);
-  goto out;
-   }
-
-   parent = udev_device_get_parent(device);
-   if (parent == NULL) {
-  _eglLog(_EGL_WARNING, "could not get parent device");
-  goto out;
-   }
-
-   pci_id = udev_device_get_property_value(parent, "PCI_ID");
-   if (pci_id == NULL ||
-   sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) {
-  _eglLog(_EGL_WARNING, "malformed or no PCI ID");
-  *chip_id = -1;
-  goto out;
-   }
-
-out:
-   if (device)
-  udev_device_unref(device);
-   if (udev)
-  udev_unref(udev);
-
-   return (*chip_id >= 0);
-}
-
-#elif defined(PIPE_OS_ANDROID) && !defined(_EGL_NO_DRM)
-
-#include 
-/* for i915 */
-#include 
-/* for radeon */
-#include 
-/* for util_strcmp */
-#include "util/u_string.h"
-
-static boolean
-drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
-{
-   drmVersionPtr version;
-
-   *chip_id = -1;
-
-   version = drmGetVersion(fd);
-   if (!version) {
-  _eglLog(_EGL_WARNING, "invalid drm fd");
-  return FALSE;
-   }
-   if (!version->name) {
-  _eglLog(_EGL_WARNING, "unable to determine the driver name");
-  drmFreeVersion(version);
-  return FALSE;
-   }
-
-   if (util_strcmp(version->name, "i915") == 0) {
-  struct drm_i915_getparam gp;
-  int ret;
-
-  *vendor_id = 0x8086;
-
-  memset(&gp, 0, sizeof(gp));
-  gp.param = I915_PARAM_CHIPSET_ID;
-  gp.value = chip_id;
-  ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
-  if (ret) {
- _eglLog(_EGL_WARNING, "failed to get param for i915");
-*chip_id = -1;
- 

Re: [Mesa-dev] code de-duplication and non-pci support v2

2014-01-12 Thread Emil Velikov
On 11/01/14 16:54, Emil Velikov wrote:
> This is an updated series of Rob's patches
> 
> * The introduction of the util library is separated from the
> de-duplication.
> * Each commit targets individual part of mesa and it should
> build/work regardless of build system/options.
> * Handles a couple more cases of de-duplication.
> * Hides the loader funcs so that they are not exported.
> * Building platform_android, will correctly set the logger to
> _eglLog(), which on itself is rapped around Androids (A)LOG.
> * Non-pci devices support has been ripped out and is left at
> the end of the series.
> * automake and scons build tested, Android should after
> correcting the following
> defined(PIPE_OS_ANDROID) && !defined(_EGL_NO_DRM)
> 

Fixed a couple of patches wrt the Android build:

Patch 1: s/PIPE_OS_ANDROID/ANDROID
Patch 4: drop no longer used _EGL_NO_DRM

The updated series can be found over in the loader-v3 branch at
https://github.com/evelikov/Mesa

It would be great if we can get a compile + runtime test from a
scons/Android user.

Adrian, Juha feel free to give this batch a spin.

Cheers,
Emil

> Brief list of which patches affect which build system
> (android A, automake M, scons S)
> patch 1 - A, M, S
> patch 2 - M, S
> patch 3 - M
> patch 4 - A, M, S
> patch 5 - M, S
> patch 6 - M
> patch 7 - A, M
> patch 8 - S
> 
> Notes:
> * Eric's comment about moving the driver_name allocation to
> egl_dri2.c does not seem easily achiveable due to platform_x11.
> 
> * Keith's patch can be relatively easily rebased on top of this.
> 
> * Andoid logging should work via (A)LOG.
> 
> Cheers,
> Emil
> 
> Emil Velikov (9):
>   loader: introduce the loader util lib
>   glx: use the loader util lib
>   gbm: use the loader util lib
>   egl-static: use loader util lib
>   st/egl: use loader util lib
>   pipe-loader: use loader util lib
>   egl_dri2: use loader util lib
>   pci_ids: no not include loader.h
>   pipe-loader: add support for non-pci (platform) devices
> 
> Rob Clark (1):
>   loader: fallback to drmGetVersion() for non-pci devices
> 
>  Android.mk |   1 +
>  configure.ac   |   1 +
>  include/pci_ids/pci_id_driver_map.h|  27 +-
>  src/Makefile.am|   2 +-
>  src/SConscript |   1 +
>  src/egl/drivers/dri2/Android.mk|   5 +-
>  src/egl/drivers/dri2/Makefile.am   |   5 +-
>  src/egl/drivers/dri2/common.c  | 144 ---
>  src/egl/drivers/dri2/egl_dri2.h|   5 -
>  src/egl/drivers/dri2/platform_android.c| 107 +---
>  src/egl/drivers/dri2/platform_drm.c|   5 +-
>  src/egl/drivers/dri2/platform_wayland.c|   5 +-
>  src/egl/main/Android.mk|   1 +
>  src/gallium/auxiliary/pipe-loader/Makefile.am  |   8 +-
>  src/gallium/auxiliary/pipe-loader/pipe_loader.h|   1 +
>  .../auxiliary/pipe-loader/pipe_loader_drm.c|  92 +--
>  src/gallium/state_trackers/clover/core/device.cpp  |   2 +
>  src/gallium/state_trackers/egl/Makefile.am |   2 +
>  src/gallium/state_trackers/egl/SConscript  |   4 +
>  src/gallium/state_trackers/egl/drm/native_drm.c|  44 +---
>  .../state_trackers/gbm/gbm_gallium_drmint.h|   1 -
>  src/gallium/targets/egl-static/Android.mk  |   1 +
>  src/gallium/targets/egl-static/Makefile.am |   2 +
>  src/gallium/targets/egl-static/SConscript  |   2 +
>  src/gallium/targets/egl-static/egl.c   | 185 +-
>  src/gbm/Makefile.am|  13 +-
>  src/gbm/backends/dri/driver_name.c |  89 ---
>  src/gbm/backends/dri/gbm_dri.c |   3 +-
>  src/gbm/backends/dri/gbm_driint.h  |   4 -
>  src/gbm/main/common.c  |  88 ---
>  src/gbm/main/common.h  |  42 
>  src/gbm/main/gbm.c |   1 -
>  src/glx/Makefile.am|   6 +-
>  src/glx/SConscript |   3 +-
>  src/glx/dri3_common.c  | 146 ---
>  src/glx/dri3_glx.c |   3 +-
>  src/glx/dri3_priv.h|   3 -
>  src/loader/Android.mk  |  43 
>  src/loader/Makefile.am |  37 +++
>  src/loader/Makefile.sources|   2 +
>  src/loader/SConscript  |  27 ++
>  src/loader/loader.c| 276 
> +
>  src/loader/loader.h|  57 +
>  43 files changed, 539 insertions(+), 957 deletions(-)
> 
> 

___
mes

[Mesa-dev] [PATCH] automake: include the git sha in the opengl version string for oot builds

2014-01-12 Thread Emil Velikov
Because it's a great feature and we should not penalise people
for doing out-of-tree builds.

Signed-off-by: Emil Velikov 
---
 src/mesa/Makefile.am | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 8843836..cb038a5 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -36,18 +36,18 @@ endif
 gldir = $(includedir)/GL
 gl_HEADERS = $(top_srcdir)/include/GL/*.h
 
-.PHONY: main/git_sha1.h.tmp
-main/git_sha1.h.tmp:
+.PHONY: $(BUILDDIR)main/git_sha1.h.tmp
+$(BUILDDIR)main/git_sha1.h.tmp:
@touch main/git_sha1.h.tmp
-   @if test -d ../../.git; then \
+   @if test -d $(top_srcdir)/.git; then \
if which git > /dev/null; then \
-   git log -n 1 --oneline | \
+   git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
> main/git_sha1.h.tmp ; \
fi \
fi
 
-main/git_sha1.h: main/git_sha1.h.tmp
+$(BUILDDIR)main/git_sha1.h: $(BUILDDIR)main/git_sha1.h.tmp
@echo "updating main/git_sha1.h"
@if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
mv main/git_sha1.h.tmp main/git_sha1.h ;\
@@ -63,8 +63,8 @@ BUILDDIR = $(builddir)/
 include Makefile.sources
 
 BUILT_SOURCES = \
-   main/git_sha1.h \
main/get_hash.h \
+   $(BUILDDIR)main/git_sha1.h \
$(BUILDDIR)program/program_parse.tab.c \
$(BUILDDIR)program/lex.yy.c
 CLEANFILES = \
-- 
1.8.5.2

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


Re: [Mesa-dev] [PATCH] automake: include the git sha in the opengl version string for oot builds

2014-01-12 Thread Matt Turner
On Sun, Jan 12, 2014 at 6:02 PM, Emil Velikov  wrote:
> Because it's a great feature and we should not penalise people
> for doing out-of-tree builds.

I don't think the commit message adds anything. With that removed,

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