Questions about KHR_platform_gbm behaviour with multiple gbm_devices

2022-03-02 Thread Christopher James Halse Rogers

Hey all.

I've got some questions about the behaviour of KHR_platform_gbm in the 
presence of multiple devices. Particularly: the spec as-written doesn't 
mandate that the gbm_surface passed in to 
eglCreatePlatformWindowSurface must have been created from the 
gbm_device used to create the EGLDisplay (and if you can pass 
EGL_DEFAULT_DISPLAY to eglGetPlatformDisplay you *cannot* create a 
surface from the underlying gbm_device).


What would people expect to work now, and what would be the right 
behaviour be?


There would seem to be the following combinations:
If gbm_device(A) means a gbm_device constructed from an FD to DRM node 
A, and so on:
1) EGLDisplay(gbm_device(fd1(A))) + gbm_surface(gbm_device(A)) - 
obvious case, works.
2) EGLDisplay(gbm_device(A)) + gbm_surface(gbm_device'(A)) - same 
underlying DRM node, different gbm_device*s
3) EGLDisplay(gbm_device(A)) + gbm_surface(gbm_device(B)) - EGLDisplay 
and surface are on different DRM devices

[Extra bonus round]
4) EGLDisplay(gbm_device(A)) + gbm_surface(gbm_device(B)) - EGLDisplay 
on kmsro node, surface from associated rendering DRM device


Empirically, on AMD & Intel it seems that:
(1) & (2) work - as long as EGLDisplay and the surface have the same 
underlying DRM device, it works
(3) - EGLDisplay on Intel node, gbm_surface from AMD node fails, but 
everything *seems* to be OK until you actually SwapBuffers (at which 
point you get EGL_BAD_SURFACE).


For *my* convenience it would be nice if (1) & (2) were specified to 
work, and (3) & (4) were specified to fail at 
eglCreatePlatformWindowSurface, but any clarity would be good (although 
“different gbm_device is Undefined Behaviour” would be 
disappointing ;))





Re: [Mesa-dev] [PATCH 3/9] gallium/dri2: Set winsys_handle type to KMS for stride query.

2013-11-24 Thread Christopher James Halse Rogers
On Thu, 2013-11-21 at 14:12 +0100, Thomas Hellstrom wrote:
 On 11/21/2013 05:11 AM, christopher.halse.rog...@canonical.com wrote:
  From: Christopher James Halse Rogers r...@ubuntu.com
 
  Otherwise the default is TYPE_SHARED, which will flink the bo. This seems
  rather unnecessary for a simple stride query.
 
 Is there no way we can cache this stuff in a __DRIimage? Changing the 
 calling conventions to adapt to poor implementations seems like
 the wrong way to go. What if other drivers use a slow approach to get 
 the KMS handle?
 

Do you want me to add some extra gallium API to get this sort of image
metadata without using what's essentially a side-effect of
resource_get_handle? If this isn't a theoretical concern I can certainly
do so.

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


Re: [Mesa-dev] [PATCH] gallium/dri: Support DRI Image extension version 7 (v3)

2013-11-24 Thread Christopher James Halse Rogers
On Mon, 2013-11-25 at 14:38 +1000, Ben Skeggs wrote:
 On Mon, Nov 25, 2013 at 1:57 PM,
 christopher.halse.rog...@canonical.com wrote:
  From: Christopher James Halse Rogers 
  christopher.halse.rog...@canonical.com
 http://cgit.freedesktop.org/~keithp/mesa/log/?h=dri3
 

Sure, why not? I don't really mind which series goes in - although I
think my patch series is more close to correct, as it won't break in
interesting ways on non-nvidia hardware.

You're welcome to roll the different patches into that branch if you
like.

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


Re: [Mesa-dev] [PATCH 3/9] gallium/dri2: Set winsys_handle type to KMS for stride query.

2013-11-21 Thread Christopher James Halse Rogers
On Thu, 2013-11-21 at 14:12 +0100, Thomas Hellstrom wrote:
 On 11/21/2013 05:11 AM, christopher.halse.rog...@canonical.com wrote:
  From: Christopher James Halse Rogers r...@ubuntu.com
 
  Otherwise the default is TYPE_SHARED, which will flink the bo. This seems
  rather unnecessary for a simple stride query.
 
 Is there no way we can cache this stuff in a __DRIimage? Changing the 
 calling conventions to adapt to poor implementations seems like
 the wrong way to go. What if other drivers use a slow approach to get 
 the KMS handle?
 

It's not really an issue of poor driver implementation - the semantics
of requesting a DRM_API_HANDLE_TYPE_SHARED require that the target be
flinked.

Only the driver actually knows the stride, and AFAIK resource_get_handle
is the only API to get that out of the driver at the moment. So we could
cache it in __DRIimage, but we'd still need to call resource_get_handle
at least once, so the problem remains.

I'm not sure if this is on any critical paths, either, so I'm unsure
whether this being slow matters. Unless asking for a KMS handle causes
the driver to reallocate or something similarly awkward.


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


Re: [Mesa-dev] [PATCH 6/7] radeon: Rename bo_handles hashtable to match its actual contents.

2013-10-09 Thread Christopher James Halse Rogers

On Wed, Oct 9, 2013 at 8:40 PM, Marek Olšák mar...@gmail.com wrote:

bo_handles_mutex should also be renamed.



The next patch uses this mutex to protect both the bo_names map and a 
new bo_handles map.


I could rename the mutex in this patch, and then unrename in the 
subsequent patch if you'd prefer, but this seems like a bit of 
busywork. 

Alternatively, if you can suggest a better name for ‘the mutex that 
protects the GEM name→bo and GEM handle→bo maps’, I'd be happy to 
use that instead.




Marek

On Tue, Oct 8, 2013 at 12:48 AM,
christopher.halse.rog...@canonical.com wrote:

 From: Christopher James Halse Rogers r...@ubuntu.com

 It's a map of GEM name-bo, so identify it as such
 ---
  src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 16 
  1 file changed, 8 insertions(+), 8 deletions(-)

 diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c

 index 44fb503..5ddbc00 100644
 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
 +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
 @@ -114,8 +114,8 @@ struct radeon_bomgr {
  /* Winsys. */
  struct radeon_drm_winsys *rws;

 -/* List of buffer handles and its mutex. */
 -struct util_hash_table *bo_handles;
 +/* List of buffer GEM names. Protected by bo_handles_mutex. */
 +struct util_hash_table *bo_names;
  pipe_mutex bo_handles_mutex;
  pipe_mutex bo_va_mutex;

 @@ -372,7 +372,7 @@ static void radeon_bo_destroy(struct pb_buffer 
*_buf)


  if (bo-name) {
  pipe_mutex_lock(bo-mgr-bo_handles_mutex);
 -util_hash_table_remove(bo-mgr-bo_handles,
 +util_hash_table_remove(bo-mgr-bo_names,
 (void*)(uintptr_t)bo-name);
  pipe_mutex_unlock(bo-mgr-bo_handles_mutex);
  }
 @@ -660,7 +660,7 @@ static boolean 
radeon_bomgr_is_buffer_busy(struct pb_manager *_mgr,

  static void radeon_bomgr_destroy(struct pb_manager *_mgr)
  {
  struct radeon_bomgr *mgr = radeon_bomgr(_mgr);
 -util_hash_table_destroy(mgr-bo_handles);
 +util_hash_table_destroy(mgr-bo_names);
  pipe_mutex_destroy(mgr-bo_handles_mutex);
  pipe_mutex_destroy(mgr-bo_va_mutex);
  FREE(mgr);
 @@ -692,7 +692,7 @@ struct pb_manager *radeon_bomgr_create(struct 
radeon_drm_winsys *rws)

  mgr-base.is_buffer_busy = radeon_bomgr_is_buffer_busy;

  mgr-rws = rws;
 -mgr-bo_handles = util_hash_table_create(handle_hash, 
handle_compare);
 +mgr-bo_names = util_hash_table_create(handle_hash, 
handle_compare);

  pipe_mutex_init(mgr-bo_handles_mutex);
  pipe_mutex_init(mgr-bo_va_mutex);

 @@ -889,7 +889,7 @@ static struct pb_buffer 
*radeon_winsys_bo_from_handle(struct radeon_winsys *rws,

  pipe_mutex_lock(mgr-bo_handles_mutex);

  /* First check if there already is an existing bo for the 
handle. */
 -bo = util_hash_table_get(mgr-bo_handles, 
(void*)(uintptr_t)whandle-handle);
 +bo = util_hash_table_get(mgr-bo_names, 
(void*)(uintptr_t)whandle-handle);

  if (bo) {
  /* Increase the refcount. */
  struct pb_buffer *b = NULL;
 @@ -923,7 +923,7 @@ static struct pb_buffer 
*radeon_winsys_bo_from_handle(struct radeon_winsys *rws,

  bo-va = 0;
  pipe_mutex_init(bo-map_mutex);

 -util_hash_table_set(mgr-bo_handles, 
(void*)(uintptr_t)whandle-handle, bo);
 +util_hash_table_set(mgr-bo_names, 
(void*)(uintptr_t)whandle-handle, bo);


  done:
  pipe_mutex_unlock(mgr-bo_handles_mutex);
 @@ -989,7 +989,7 @@ static boolean 
radeon_winsys_bo_get_handle(struct pb_buffer *buffer,

  bo-flink = flink.name;

  pipe_mutex_lock(bo-mgr-bo_handles_mutex);
 -util_hash_table_set(bo-mgr-bo_handles, 
(void*)(uintptr_t)bo-flink, bo);
 +util_hash_table_set(bo-mgr-bo_names, 
(void*)(uintptr_t)bo-flink, bo);

  pipe_mutex_unlock(bo-mgr-bo_handles_mutex);
  }
  whandle-handle = bo-flink;
 --
 1.8.3.2

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



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


[Mesa-dev] [PATCH 01/15] gallium/winsys/drm: Prepare for passing prime fds in winsys_handle

2013-07-20 Thread Christopher James Halse Rogers
---
 src/gallium/drivers/freedreno/freedreno_screen.c  | 5 +
 src/gallium/drivers/nouveau/nouveau_screen.c  | 6 ++
 src/gallium/include/state_tracker/drm_driver.h| 9 ++---
 src/gallium/state_trackers/dri/drm/dri2.c | 2 ++
 src/gallium/state_trackers/egl/common/native_helper.c | 1 +
 src/gallium/state_trackers/egl/x11/native_dri2.c  | 1 +
 src/gallium/winsys/i915/drm/i915_drm_buffer.c | 6 +-
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 6 ++
 src/gallium/winsys/svga/drm/vmw_screen_dri.c  | 6 ++
 9 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index ff45b3e..b654700 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -345,6 +345,11 @@ fd_screen_bo_from_handle(struct pipe_screen *pscreen,
struct fd_screen *screen = fd_screen(pscreen);
struct fd_bo *bo;
 
+   if (whandle-type != DRM_API_HANDLE_TYPE_SHARED) {
+   DBG(Attempt to import unsupported handle type %d, 
whandle-type);
+   return NULL;
+   }
+
bo = fd_bo_from_name(screen-dev, whandle-handle);
if (!bo) {
DBG(ref name 0x%08x failed, whandle-handle);
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index d129a55..3f64dc7 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -86,6 +86,12 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
struct nouveau_bo *bo = 0;
int ret;
  
+   if (whandle-type != DRM_API_HANDLE_TYPE_SHARED) {
+   debug_printf(%s: attempt to import unsupported handle type 
%d\n,
+__FUNCTION__, whandle-type);
+   return NULL;
+   }
+
ret = nouveau_bo_name_ref(dev, whandle-handle, bo);
if (ret) {
debug_printf(%s: ref name 0x%08x failed with %d\n,
diff --git a/src/gallium/include/state_tracker/drm_driver.h 
b/src/gallium/include/state_tracker/drm_driver.h
index f9bd222..5b76d87 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -10,6 +10,8 @@ struct pipe_resource;
 
 #define DRM_API_HANDLE_TYPE_SHARED 0
 #define DRM_API_HANDLE_TYPE_KMS1
+#define DRM_API_HANDLE_TYPE_FD 2
+
 
 /**
  * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
@@ -17,9 +19,10 @@ struct pipe_resource;
 struct winsys_handle
 {
/**
-* Unused for texture_from_handle, always
-* DRM_API_HANDLE_TYPE_SHARED.  Input to texture_get_handle,
-* use TEXTURE_USAGE to select handle for kms or ipc.
+* Input for texture_from_handle, valid values are
+* DRM_API_HANDLE_TYPE_SHARED or DRM_API_HANDLE_TYPE_FD.
+* Input to texture_get_handle,
+* to select handle for kms, flink, or prime.
 */
unsigned type;
/**
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 1dcc1f7..7b518a8 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -263,6 +263,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable,
 
   templ.format = format;
   templ.bind = bind;
+  whandle.type = DRM_API_HANDLE_TYPE_SHARED;
   whandle.handle = buf-name;
   whandle.stride = buf-pitch;
 
@@ -582,6 +583,7 @@ dri2_create_image_from_name(__DRIscreen *_screen,
 
memset(whandle, 0, sizeof(whandle));
whandle.handle = name;
+   whandle.type = DRM_API_HANDLE_TYPE_SHARED;
whandle.stride = pitch * util_format_get_blocksize(pf);
 
img-texture = 
screen-base.screen-resource_from_handle(screen-base.screen,
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c 
b/src/gallium/state_trackers/egl/common/native_helper.c
index b578a8a..d1e1acd 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -427,6 +427,7 @@ drm_display_import_native_buffer(struct native_display 
*ndpy,
 
  memset(wsh, 0, sizeof(wsh));
  wsh.handle = nbuf-u.drm.name;
+ wsh.type = DRM_API_HANDLE_TYPE_SHARED;
  wsh.stride = nbuf-u.drm.stride;
 
  res = screen-resource_from_handle(screen, nbuf-u.drm.templ, wsh);
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 053044a..e1ec459 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -176,6 +176,7 @@ dri2_surface_process_drawable_buffers(struct native_surface 
*nsurf,
   }
 
   memset(whandle, 0, sizeof(whandle));
+  whandle.type = DRM_API_HANDLE_TYPE_SHARED;
   whandle.stride = 

[Mesa-dev] [PATCH 02/15] gallium/dri2: Set winsys_handle type to KMS for stride query.

2013-07-20 Thread Christopher James Halse Rogers
Otherwise the default is TYPE_SHARED, which will flink the bo. This seems
rather unnecessary for a simple stride query.
---
 src/gallium/state_trackers/dri/drm/dri2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 7b518a8..74e14af 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -693,6 +693,7 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
 
switch (attrib) {
case __DRI_IMAGE_ATTRIB_STRIDE:
+  whandle.type = DRM_API_HANDLE_TYPE_KMS;
   image-texture-screen-resource_get_handle(image-texture-screen,
 image-texture, whandle);
   *value = whandle.stride;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 03/15] gallium/dri: Support* DRI Image extension version 7

2013-07-20 Thread Christopher James Halse Rogers
*ish
---
 src/gallium/state_trackers/dri/drm/dri2.c | 118 +++---
 1 file changed, 108 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 74e14af..edbf801 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -534,14 +534,14 @@ dri2_lookup_egl_image(struct dri_screen *screen, void 
*handle)
 }
 
 static __DRIimage *
-dri2_create_image_from_name(__DRIscreen *_screen,
-int width, int height, int format,
-int name, int pitch, void *loaderPrivate)
+dri2_create_image_from_winsys(__DRIscreen *_screen,
+  int width, int height, int format,
+  struct winsys_handle *whandle, int pitch,
+  void *loaderPrivate)
 {
struct dri_screen *screen = dri_screen(_screen);
__DRIimage *img;
struct pipe_resource templ;
-   struct winsys_handle whandle;
unsigned tex_usage;
enum pipe_format pf;
 
@@ -581,13 +581,10 @@ dri2_create_image_from_name(__DRIscreen *_screen,
templ.depth0 = 1;
templ.array_size = 1;
 
-   memset(whandle, 0, sizeof(whandle));
-   whandle.handle = name;
-   whandle.type = DRM_API_HANDLE_TYPE_SHARED;
-   whandle.stride = pitch * util_format_get_blocksize(pf);
+   whandle-stride = pitch * util_format_get_blocksize(pf);
 
img-texture = 
screen-base.screen-resource_from_handle(screen-base.screen,
- templ, whandle);
+ templ, whandle);
if (!img-texture) {
   FREE(img);
   return NULL;
@@ -602,6 +599,39 @@ dri2_create_image_from_name(__DRIscreen *_screen,
 }
 
 static __DRIimage *
+dri2_create_image_from_name(__DRIscreen *_screen,
+int width, int height, int format,
+int name, int pitch, void *loaderPrivate)
+{
+   struct winsys_handle whandle;
+
+   memset(whandle, 0, sizeof(whandle));
+   whandle.type = DRM_API_HANDLE_TYPE_SHARED;
+   whandle.handle = name;
+
+   return dri2_create_image_from_winsys(_screen, width, height, format,
+whandle, pitch, loaderPrivate);
+}
+
+static __DRIimage *
+dri2_create_image_from_fd(__DRIscreen *_screen,
+  int width, int height, int format,
+  int fd, int pitch, void *loaderPrivate)
+{
+   struct winsys_handle whandle;
+
+   if (fd  0)
+  return NULL;
+
+   memset(whandle, 0, sizeof(whandle));
+   whandle.type = DRM_API_HANDLE_TYPE_FD;
+   whandle.handle = (unsigned)fd;
+
+   return dri2_create_image_from_winsys(_screen, width, height, format,
+whandle, pitch, loaderPrivate);
+}
+
+static __DRIimage *
 dri2_create_image_from_renderbuffer(__DRIcontext *context,
int renderbuffer, void *loaderPrivate)
 {
@@ -710,6 +740,11 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
  image-texture, whandle);
   *value = whandle.handle;
   return GL_TRUE;
+   case __DRI_IMAGE_ATTRIB_FD:
+  whandle.type= DRM_API_HANDLE_TYPE_FD;
+  image-texture-screen-resource_get_handle(image-texture-screen,
+ image-texture, whandle);
+  *value = whandle.handle;
case __DRI_IMAGE_ATTRIB_FORMAT:
   *value = image-dri_format;
   return GL_TRUE;
@@ -833,6 +868,67 @@ dri2_from_planar(__DRIimage *image, int plane, void 
*loaderPrivate)
return img;
 }
 
+static __DRIimage *
+dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
+ int depth, int level, unsigned *error,
+ void *loaderPrivate)
+{
+   /* Bad parameter seems like the least-incorrect error */
+   *error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
+   return NULL;
+}
+
+static __DRIimage *
+dri2_from_fds(__DRIscreen *screen, int width, int height, int fourcc,
+  int *fds, int num_fds, int *strides, int *offsets,
+  void *loaderPrivate)
+{
+   __DRIimage *img;
+   int format, stride, dri_components;
+
+   if (num_fds != 1)
+  return NULL;
+   if (offsets[0] != 0)
+  return NULL;
+
+   switch(fourcc) {
+   case __DRI_IMAGE_FOURCC_RGB565:
+  format = __DRI_IMAGE_FORMAT_RGB565;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGB;
+  break;
+   case __DRI_IMAGE_FOURCC_ARGB:
+  format = __DRI_IMAGE_FORMAT_ARGB;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
+  break;
+   case __DRI_IMAGE_FOURCC_XRGB:
+  format = __DRI_IMAGE_FORMAT_XRGB;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGB;
+  break;
+   case __DRI_IMAGE_FOURCC_ABGR:
+  format = __DRI_IMAGE_FORMAT_ABGR;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
+  break;
+   case __DRI_IMAGE_FOURCC_XBGR:
+  format = __DRI_IMAGE_FORMAT_XBGR;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGB;
+  

[Mesa-dev] [PATCH 04/15] nouveau: Support DRI Image 7 extension

2013-07-20 Thread Christopher James Halse Rogers
From: Maarten Lankhorst maarten.lankho...@canonical.com

---
 src/gallium/drivers/nouveau/nouveau_screen.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 3f64dc7..f05cb5b 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -86,13 +86,18 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
struct nouveau_bo *bo = 0;
int ret;
  
-   if (whandle-type != DRM_API_HANDLE_TYPE_SHARED) {
+   if (whandle-type != DRM_API_HANDLE_TYPE_SHARED 
+   whandle-type != DRM_API_HANDLE_TYPE_FD) {
debug_printf(%s: attempt to import unsupported handle type 
%d\n,
 __FUNCTION__, whandle-type);
return NULL;
}
 
-   ret = nouveau_bo_name_ref(dev, whandle-handle, bo);
+   if (whandle-type == DRM_API_HANDLE_TYPE_SHARED)
+   ret = nouveau_bo_name_ref(dev, whandle-handle, bo);
+   else
+   ret = nouveau_bo_prime_handle_ref(dev, whandle-handle, bo);
+
if (ret) {
debug_printf(%s: ref name 0x%08x failed with %d\n,
 __FUNCTION__, whandle-handle, ret);
@@ -117,6 +122,8 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
} else if (whandle-type == DRM_API_HANDLE_TYPE_KMS) {
whandle-handle = bo-handle;
return TRUE;
+   } else if (whandle-type == DRM_API_HANDLE_TYPE_FD) {
+   return nouveau_bo_set_prime(bo, whandle-handle) == 0;
} else {
return FALSE;
}
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 05/15] ilo: Support DRI Image 7

2013-07-20 Thread Christopher James Halse Rogers
---
 src/gallium/winsys/intel/drm/intel_drm_winsys.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c 
b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
index 521762d..d9aa6a9 100644
--- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c
+++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
@@ -257,7 +257,6 @@ intel_winsys_import_handle(struct intel_winsys *winsys,
name, gem_name);
   }
   break;
-#if 0
case DRM_API_HANDLE_TYPE_FD:
   {
  const int fd = (int) handle-handle;
@@ -265,7 +264,6 @@ intel_winsys_import_handle(struct intel_winsys *winsys,
fd, height * handle-stride);
   }
   break;
-#endif
default:
   bo = NULL;
   break;
@@ -308,7 +306,6 @@ intel_winsys_export_handle(struct intel_winsys *winsys,
case DRM_API_HANDLE_TYPE_KMS:
   handle-handle = ((drm_intel_bo *) bo)-handle;
   break;
-#if 0
case DRM_API_HANDLE_TYPE_FD:
   {
  int fd;
@@ -318,7 +315,6 @@ intel_winsys_export_handle(struct intel_winsys *winsys,
 handle-handle = fd;
   }
   break;
-#endif
default:
   err = -EINVAL;
   break;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 06/15] gbm: Support GBM_FORMAT_XBGR8888

2013-07-20 Thread Christopher James Halse Rogers
---
 src/gbm/backends/dri/gbm_dri.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index a3a0530..07d7145 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -348,6 +348,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+   case __DRI_IMAGE_FORMAT_XBGR:
+  ret = GBM_FORMAT_XBGR;
+  break;
default:
   ret = 0;
   break;
@@ -547,6 +550,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
case GBM_FORMAT_ABGR:
   dri_format = __DRI_IMAGE_FORMAT_ABGR;
   break;
+   case GBM_FORMAT_XBGR:
+  dri_format = __DRI_IMAGE_FORMAT_XBGR;
+  break;
default:
   return NULL;
}
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 08/15] gbm: Allow creating non-cursor dumb buffers.

2013-07-20 Thread Christopher James Halse Rogers
This allows display-server/compositors to use gbm buffers for both accelerated 
and
software-rendered clients, rather than having a separate out-of-band SHM 
interface.
---
 src/gbm/backends/dri/gbm_dri.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 8797069..c19d378 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -463,9 +463,8 @@ create_dumb(struct gbm_device *gbm,
struct drm_mode_destroy_dumb destroy_arg;
int ret;
 
-   if (!(usage  GBM_BO_USE_CURSOR_64X64))
-  return NULL;
-   if (format != GBM_FORMAT_ARGB)
+   if ((format != GBM_FORMAT_ARGB) 
+   (format != GBM_FORMAT_XRGB))
   return NULL;
 
bo = calloc(1, sizeof *bo);
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 07/15] Actually fill in the format of dumb buffers

2013-07-20 Thread Christopher James Halse Rogers
---
 src/gbm/backends/dri/gbm_dri.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 07d7145..8797069 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -480,6 +480,7 @@ create_dumb(struct gbm_device *gbm,
if (ret)
   goto free_bo;
 
+   bo-base.base.format = format;
bo-base.base.gbm = gbm;
bo-base.base.width = width;
bo-base.base.height = height;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 09/15] gbm: Factor out gbm_to_dri_format function

2013-07-20 Thread Christopher James Halse Rogers
---
 src/gbm/backends/dri/gbm_dri.c | 53 +-
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index c19d378..8b71cca 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -359,6 +359,37 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
return ret;
 }
 
+static uint32_t
+gbm_to_dri_format(uint32_t gbm_format)
+{
+   uint32_t dri_format = 0;
+
+   switch (gbm_format) {
+   case GBM_FORMAT_RGB565:
+  dri_format =__DRI_IMAGE_FORMAT_RGB565;
+  break;
+   case GBM_FORMAT_XRGB:
+   case GBM_BO_FORMAT_XRGB:
+  dri_format = __DRI_IMAGE_FORMAT_XRGB;
+  break;
+   case GBM_FORMAT_ARGB:
+   case GBM_BO_FORMAT_ARGB:
+  dri_format = __DRI_IMAGE_FORMAT_ARGB;
+  break;
+   case GBM_FORMAT_ABGR:
+  dri_format = __DRI_IMAGE_FORMAT_ABGR;
+  break;
+   case GBM_FORMAT_XBGR:
+  dri_format = __DRI_IMAGE_FORMAT_XBGR;
+  break;
+   default:
+  dri_format = __DRI_IMAGE_FORMAT_NONE;
+  break;
+   }
+
+   return dri_format;
+}
+
 static struct gbm_bo *
 gbm_dri_bo_import(struct gbm_device *gbm,
   uint32_t type, void *buffer, uint32_t usage)
@@ -535,27 +566,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
bo-base.base.height = height;
bo-base.base.format = format;
 
-   switch (format) {
-   case GBM_FORMAT_RGB565:
-  dri_format =__DRI_IMAGE_FORMAT_RGB565;
-  break;
-   case GBM_FORMAT_XRGB:
-   case GBM_BO_FORMAT_XRGB:
-  dri_format = __DRI_IMAGE_FORMAT_XRGB;
-  break;
-   case GBM_FORMAT_ARGB:
-   case GBM_BO_FORMAT_ARGB:
-  dri_format = __DRI_IMAGE_FORMAT_ARGB;
-  break;
-   case GBM_FORMAT_ABGR:
-  dri_format = __DRI_IMAGE_FORMAT_ABGR;
-  break;
-   case GBM_FORMAT_XBGR:
-  dri_format = __DRI_IMAGE_FORMAT_XBGR;
-  break;
-   default:
-  return NULL;
-   }
+   dri_format = gbm_to_dri_format(format);
 
if (usage  GBM_BO_USE_SCANOUT)
   dri_use |= __DRI_IMAGE_USE_SCANOUT;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 11/15] Add fd parameter to __DRIbuffer.

2013-07-20 Thread Christopher James Halse Rogers
This allows platforms which want to do PRIME fd passing rather than
flink, such as Wayland and Mir, to do so without having to uselessly
allocate a world-visible name for internal mesa use

Signed-off-by: Christopher James Halse Rogers r...@ubuntu.com
---
 include/GL/internal/dri_interface.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 5c99d55..18767c7 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -768,10 +768,12 @@ struct __DRIbufferRec {
 unsigned int pitch;
 unsigned int cpp;
 unsigned int flags;
+unsigned int fd;/** Only available with DRI2_LOADER_VERSION = 4, */
+/** Only valid if name == 0 */
 };
 
 #define __DRI_DRI2_LOADER DRI_DRI2Loader
-#define __DRI_DRI2_LOADER_VERSION 3
+#define __DRI_DRI2_LOADER_VERSION 4
 struct __DRIdri2LoaderExtensionRec {
 __DRIextension base;
 
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 10/15] gbm: Create a DRI image for dumb buffers, too.

2013-07-20 Thread Christopher James Halse Rogers
We want this so we can hand out CPU-mappable buffers to clients, but still
use EGL in the server to composite said buffers.
---
 src/gbm/backends/dri/gbm_dri.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 8b71cca..8ca7b54 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -318,9 +318,9 @@ gbm_dri_bo_destroy(struct gbm_bo *_bo)
struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
struct drm_mode_destroy_dumb arg;
 
-   if (bo-image != NULL) {
+   if (bo-image)
   dri-image-destroyImage(bo-image);
-   } else {
+   if (bo-map) {
   munmap(bo-map, bo-size);
   memset(arg, 0, sizeof(arg));
   arg.handle = bo-handle;
@@ -532,6 +532,25 @@ create_dumb(struct gbm_device *gbm,
if (bo-map == MAP_FAILED)
   goto destroy_dumb;
 
+   if (usage  GBM_BO_USE_RENDERING)
+   {
+  struct drm_gem_flink flink_arg;
+  memset(flink_arg, 0, sizeof(flink_arg));
+  flink_arg.handle = bo-handle;
+  ret = drmIoctl(dri-base.base.fd, DRM_IOCTL_GEM_FLINK, flink_arg);
+  if (ret)
+ goto destroy_dumb;
+
+  bo-image = dri-image-createImageFromName(dri-screen,
+  width, height,
+  gbm_to_dri_format(format),
+  flink_arg.name,
+  bo-base.base.stride / 4,
+  bo);
+
+  if (!bo-image)
+ goto destroy_dumb;
+   }
return bo-base.base;
 
 destroy_dumb:
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 12/15] intel: Use fd parameter in DRIbuffer when name is unset

2013-07-20 Thread Christopher James Halse Rogers
---
 src/mesa/drivers/dri/i915/intel_context.c | 31 +++-
 src/mesa/drivers/dri/i965/intel_context.c | 34 +--
 2 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_context.c 
b/src/mesa/drivers/dri/i915/intel_context.c
index f27e3d0..25a2832 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -804,24 +804,35 @@ intel_process_dri2_buffer(struct intel_context *intel,
 */
if (rb-mt 
rb-mt-region 
-   rb-mt-region-name == buffer-name)
+   rb-mt-region-name == buffer-name 
+   rb-mt-region-name != 0)
   return;
 
if (unlikely(INTEL_DEBUG  DEBUG_DRI)) {
   fprintf(stderr,
- attaching buffer %d, at %d, cpp %d, pitch %d\n,
+ attaching buffer %d, at %d, cpp %d, pitch %d, fd %d\n,
  buffer-name, buffer-attachment,
- buffer-cpp, buffer-pitch);
+ buffer-cpp, buffer-pitch, buffer-fd);
}
 
intel_miptree_release(rb-mt);
-   region = intel_region_alloc_for_handle(intel-intelScreen,
-  buffer-cpp,
-  drawable-w,
-  drawable-h,
-  buffer-pitch,
-  buffer-name,
-  buffer_name);
+   if (buffer-name != 0) {
+  region = intel_region_alloc_for_handle(intel-intelScreen,
+ buffer-cpp,
+ drawable-w,
+ drawable-h,
+ buffer-pitch,
+ buffer-name,
+ buffer_name);
+   } else {
+  region = intel_region_alloc_for_fd(intel-intelScreen,
+ buffer-cpp,
+ drawable-w,
+ drawable-h,
+ buffer-pitch,
+ buffer-fd,
+ buffer_name);
+   }
if (!region)
   return;
 
diff --git a/src/mesa/drivers/dri/i965/intel_context.c 
b/src/mesa/drivers/dri/i965/intel_context.c
index 742bcc3..e82cb7e 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -857,31 +857,43 @@ intel_process_dri2_buffer(struct brw_context *brw,
if (num_samples == 0) {
if (rb-mt 
rb-mt-region 
-   rb-mt-region-name == buffer-name)
+   rb-mt-region-name == buffer-name 
+   rb-mt-region-name != 0)
   return;
} else {
if (rb-mt 
rb-mt-singlesample_mt 
rb-mt-singlesample_mt-region 
-   rb-mt-singlesample_mt-region-name == buffer-name)
+   rb-mt-singlesample_mt-region-name == buffer-name 
+   rb-mt-singlesample_mt-region-name != 0)
   return;
}
 
if (unlikely(INTEL_DEBUG  DEBUG_DRI)) {
   fprintf(stderr,
- attaching buffer %d, at %d, cpp %d, pitch %d\n,
+ attaching buffer %d, at %d, cpp %d, pitch %d, fd %d\n,
  buffer-name, buffer-attachment,
- buffer-cpp, buffer-pitch);
+ buffer-cpp, buffer-pitch, buffer-fd);
}
 
intel_miptree_release(rb-mt);
-   region = intel_region_alloc_for_handle(brw-intelScreen,
-  buffer-cpp,
-  drawable-w,
-  drawable-h,
-  buffer-pitch,
-  buffer-name,
-  buffer_name);
+   if (buffer-name != 0) {
+  region = intel_region_alloc_for_handle(brw-intelScreen,
+ buffer-cpp,
+ drawable-w,
+ drawable-h,
+ buffer-pitch,
+ buffer-name,
+ buffer_name);
+   } else {
+  region = intel_region_alloc_for_fd(brw-intelScreen,
+ buffer-cpp,
+ drawable-w,
+ drawable-h,
+ buffer-pitch,
+ buffer-fd,
+ buffer_name);
+   }
if (!region)
   return;
 
-- 
1.8.3.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

[Mesa-dev] [PATCH 13/15] gallium/dri: Handle prime fds in __DRIBuffers

2013-07-20 Thread Christopher James Halse Rogers
---
 src/gallium/state_trackers/dri/drm/dri2.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index edbf801..f5e8bec 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -263,8 +263,13 @@ dri2_drawable_process_buffers(struct dri_drawable 
*drawable,
 
   templ.format = format;
   templ.bind = bind;
-  whandle.type = DRM_API_HANDLE_TYPE_SHARED;
-  whandle.handle = buf-name;
+  if (buf-name != 0) {
+ whandle.type = DRM_API_HANDLE_TYPE_SHARED;
+ whandle.handle = buf-name;
+  } else {
+ whandle.type = DRM_API_HANDLE_TYPE_FD;
+ whandle.handle = buf-fd;
+  }
   whandle.stride = buf-pitch;
 
   drawable-textures[statt] =
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 15/15] Add Mir EGL platform

2013-07-20 Thread Christopher James Halse Rogers
/null
+++ b/src/egl/drivers/dri2/platform_mir.c
@@ -0,0 +1,349 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *Christopher James Halse Rogers christopher.halse.rog...@canonical.com
+ */
+
+#include mir_toolkit/mesa/native_display.h
+
+#include egl_dri2.h
+
+#include stdlib.h
+#include string.h
+
+static __DRIbuffer *
+dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
+int *width, int *height,
+unsigned int *attachments, int count,
+int *out_count, void *loaderPrivate)
+{
+   struct dri2_egl_surface *dri2_surf = loaderPrivate;
+   struct dri2_egl_display *dri2_dpy =
+  dri2_egl_display(dri2_surf-base.Resource.Display);
+   int i;
+
+   dri2_surf-buffer_count = 0;
+   for (i = 0; i  2*count; i+=2) {
+  assert(attachments[i]  __DRI_BUFFER_COUNT);
+  assert(dri2_surf-buffer_count  5);
+
+  if (dri2_surf-dri_buffers[attachments[i]] == NULL) {
+ /* Our frame callback must keep these buffers valid */
+ assert(attachments[i] != __DRI_BUFFER_FRONT_LEFT);
+ assert(attachments[i] != __DRI_BUFFER_BACK_LEFT);
+
+ dri2_surf-dri_buffers[attachments[i]] =
+dri2_dpy-dri2-allocateBuffer(dri2_dpy-dri_screen,
+  attachments[i], attachments[i+1],
+  dri2_surf-base.Width, dri2_surf-base.Height);
+
+ if (!dri2_surf-dri_buffers[attachments[i]])
+continue;
+  }
+
+  memcpy(dri2_surf-buffers[dri2_surf-buffer_count],
+ dri2_surf-dri_buffers[attachments[i]],
+ sizeof(__DRIbuffer));
+
+  dri2_surf-buffer_count++;
+   }
+
+   assert(dri2_surf-base.Type == EGL_PIXMAP_BIT ||
+  dri2_surf-dri_buffers[__DRI_BUFFER_BACK_LEFT]);
+
+   *out_count = dri2_surf-buffer_count;
+   if (dri2_surf-buffer_count == 0)
+  return NULL;
+
+   *width = dri2_surf-base.Width;
+   *height = dri2_surf-base.Height;
+
+   return dri2_surf-buffers;
+}
+
+static __DRIbuffer *
+dri2_get_buffers(__DRIdrawable * driDrawable,
+int *width, int *height,
+unsigned int *attachments, int count,
+int *out_count, void *loaderPrivate)
+{
+   unsigned int *attachments_with_format;
+   __DRIbuffer *buffer;
+   const unsigned int format = 32;
+   int i;
+
+   attachments_with_format = calloc(count * 2, sizeof(unsigned int));
+   if (!attachments_with_format) {
+  *out_count = 0;
+  return NULL;
+   }
+
+   for (i = 0; i  count; ++i) {
+  attachments_with_format[2*i] = attachments[i];
+  attachments_with_format[2*i + 1] = format;
+   }
+
+   buffer =
+  dri2_get_buffers_with_format(driDrawable,
+  width, height,
+  attachments_with_format, count,
+  out_count, loaderPrivate);
+
+   free(attachments_with_format);
+
+   return buffer;
+}
+
+
+static void
+dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+{
+   (void) driDrawable;
+
+   /* FIXME: Does EGL support front buffer rendering at all? */
+
+#if 0
+   struct dri2_egl_surface *dri2_surf = loaderPrivate;
+
+   dri2WaitGL(dri2_surf);
+#else
+   (void) loaderPrivate;
+#endif
+}
+
+static EGLBoolean
+mir_advance_colour_buffer(struct dri2_egl_surface *surf)
+{
+   MirBufferPackage buffer_package;
+   if(!surf-mir_surf-surface_advance_buffer(surf-mir_surf, buffer_package))
+  return EGL_FALSE;
+
+   /* We expect no data items, and (for the moment) one PRIME fd */
+   assert(buffer_package.data_items == 0);
+   assert(buffer_package.fd_items == 1);
+
+   surf-dri_buffers[__DRI_BUFFER_BACK_LEFT]-name = 0;
+   surf-dri_buffers[__DRI_BUFFER_BACK_LEFT]-fd = buffer_package.fd[0];
+   surf-dri_buffers[__DRI_BUFFER_BACK_LEFT]-pitch = buffer_package.stride;
+   return EGL_TRUE

[Mesa-dev] [PATCH 14/15] Support loading multiple EGL platforms in a single process

2013-07-20 Thread Christopher James Halse Rogers
Change EGLModule to have an EGLDriver per supported platform and cache
based on EGLModule-platform pair rather than just EGLModule.
---
 src/egl/main/egldisplay.c |  3 +--
 src/egl/main/egldriver.c  | 55 +++
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 985e781..482a956 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -60,7 +60,6 @@
 #include sys/stat.h
 #endif
 
-
 /**
  * Map --with-egl-platforms names to platform types.
  */
@@ -188,7 +187,7 @@ _eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType 
nativeDisplay)
 _EGLPlatformType
 _eglGetNativePlatform(EGLNativeDisplayType nativeDisplay)
 {
-   static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
+   _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
char *detection_method = NULL;
 
if (native_platform == _EGL_INVALID_PLATFORM) {
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index ffdd146..e4c9859 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -57,7 +57,7 @@ typedef struct _egl_module {
char *Path;
_EGLMain_t BuiltIn;
void *Handle;
-   _EGLDriver *Driver;
+   _EGLDriver *Driver[_EGL_NUM_PLATFORMS];
 } _EGLModule;
 
 static _EGL_DECLARE_MUTEX(_eglModuleMutex);
@@ -134,7 +134,6 @@ library_suffix(void)
 
 #endif
 
-
 /**
  * Open the named driver and find its bootstrap function: _eglMain().
  */
@@ -147,8 +146,12 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
 
assert(driverPath);
 
-   _eglLog(_EGL_DEBUG, dlopen(%s), driverPath);
-   lib = open_library(driverPath);
+   if (*handle) {
+  lib = *handle;
+   } else {
+  _eglLog(_EGL_DEBUG, dlopen(%s), driverPath);
+  lib = open_library(driverPath);
+   }
 
 #if defined(_EGL_OS_WINDOWS)
/* XXX untested */
@@ -194,13 +197,13 @@ _eglOpenLibrary(const char *driverPath, lib_handle 
*handle)
  * Load a module and create the driver object.
  */
 static EGLBoolean
-_eglLoadModule(_EGLModule *mod)
+_eglLoadModule(_EGLModule *mod, _EGLPlatformType plat)
 {
_EGLMain_t mainFunc;
-   lib_handle lib;
+   lib_handle lib = (lib_handle) mod-Handle;
_EGLDriver *drv;
 
-   if (mod-Driver)
+   if (mod-Driver[plat])
   return EGL_TRUE;
 
if (mod-BuiltIn) {
@@ -226,7 +229,7 @@ _eglLoadModule(_EGLModule *mod)
}
 
mod-Handle = (void *) lib;
-   mod-Driver = drv;
+   mod-Driver[plat] = drv;
 
return EGL_TRUE;
 }
@@ -240,8 +243,10 @@ _eglUnloadModule(_EGLModule *mod)
 {
 #if defined(_EGL_OS_UNIX)
/* destroy the driver */
-   if (mod-Driver  mod-Driver-Unload)
-  mod-Driver-Unload(mod-Driver);
+   for (int plat = 0; plat  _EGL_NUM_PLATFORMS; ++plat) {
+  if (mod-Driver[plat]  mod-Driver[plat]-Unload)
+ mod-Driver[plat]-Unload(mod-Driver[plat]);
+   }
 
/*
 * XXX At this point (atexit), the module might be the last reference to
@@ -255,7 +260,9 @@ _eglUnloadModule(_EGLModule *mod)
/* XXX Windows unloads DLLs before atexit */
 #endif
 
-   mod-Driver = NULL;
+   for (int plat = 0; plat  _EGL_NUM_PLATFORMS; ++plat) {
+  mod-Driver[plat] = NULL;
+   }
mod-Handle = NULL;
 }
 
@@ -599,17 +606,17 @@ _eglMatchAndInitialize(_EGLDisplay *dpy)
while (i  _eglModules-Size) {
   _EGLModule *mod = (_EGLModule *) _eglModules-Elements[i];
 
-  if (!_eglLoadModule(mod)) {
+  if (!_eglLoadModule(mod, dpy-Platform)) {
  /* remove invalid modules */
  _eglEraseArray(_eglModules, i, _eglFreeModule);
  continue;
   }
 
-  if (mod-Driver-API.Initialize(mod-Driver, dpy)) {
- drv = mod-Driver;
+  drv = mod-Driver[dpy-Platform];
+  if (drv-API.Initialize(drv, dpy))
  break;
-  }
   else {
+ drv = NULL;
  i++;
   }
}
@@ -661,7 +668,6 @@ __eglMustCastToProperFunctionPointerType
 _eglGetDriverProc(const char *procname)
 {
EGLint i;
-   _EGLProc proc = NULL;
 
if (!_eglModules) {
   /* load the driver for the default display */
@@ -673,15 +679,18 @@ _eglGetDriverProc(const char *procname)
 
for (i = 0; i  _eglModules-Size; i++) {
   _EGLModule *mod = (_EGLModule *) _eglModules-Elements[i];
-
-  if (!mod-Driver)
- break;
-  proc = mod-Driver-API.GetProcAddress(mod-Driver, procname);
-  if (proc)
- break;
+  _EGLProc proc;
+
+  for (_EGLPlatformType plat = 0; plat  _EGL_NUM_PLATFORMS; ++plat) {
+ if (!mod-Driver[plat])
+continue;
+ proc = mod-Driver[plat]-API.GetProcAddress(mod-Driver[plat], 
procname);
+ if (proc)
+return proc;
+  }
}
 
-   return proc;
+   return NULL;
 }
 
 
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 1/4] gallium/dri: Allow drivers to support DRI Image v7

2013-04-22 Thread Christopher James Halse Rogers
On Mon, 2013-04-22 at 21:38 +1000, Dave Airlie wrote:
 On Mon, Apr 22, 2013 at 9:09 PM, Jose Fonseca jfons...@vmware.com wrote:
  - Original Message -
  From: Christopher James Halse Rogers r...@ubuntu.com
 
  This is only exposed by drivers wich support the new PIPE_CAP_PRIME
  parameter,
  for PRIME import/export.
 
  What does exactly PIPE_CAP_PRIME entail? Please document it.
 
 Also why is it needed at all?
 
 pipe drivers should be able to render to/from any buffer the winsys
 can hand it I don't think we need special treatment here, maybe just
 have the generic code ask the generic kernel cap for prime support.

It's perhaps not in the right place, but I couldn't find a better one. A
generic solution in the dri state tracker querying DRM_CAP_PRIME would
be possible, but I think suboptimal - you really want to know if the
winsys can handle dma-buf fds, and that's hidden.

It's easy enough to keep PIPE_CAP_PRIME and make the pipe drivers not
pull in drm.h, if that's accepable.

If its not acceptable, and it's ok to lie about driver support for image
v7 then I can gate it in the dri state tracker.

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


Re: [Mesa-dev] [PATCH 1/4] gallium/dri: Allow drivers to support DRI Image v7

2013-04-22 Thread Christopher James Halse Rogers



On Mon, 22 Apr, 2013 at 4:38 PM, christopher.halse.rog...@canonical.com 
wrote:

From: Christopher James Halse Rogers r...@ubuntu.com

This is only exposed by drivers wich support the new PIPE_CAP_PRIME 
parameter,

for PRIME import/export.
---

This stubs out texture_from_renderbuffer, which I don't care about, 
but
that looks like it wouldn't be terribly painful to implement if it's 
a blocker

for the PRIME support, which I do care about.

 src/gallium/drivers/freedreno/freedreno_screen.c   |   1 +
 src/gallium/drivers/i915/i915_screen.c |   1 +
 src/gallium/drivers/llvmpipe/lp_screen.c   |   2 +
 src/gallium/drivers/nv30/nv30_screen.c |   1 +
 src/gallium/drivers/nv50/nv50_screen.c |   2 +
 src/gallium/drivers/nvc0/nvc0_screen.c |   2 +
 src/gallium/drivers/r300/r300_screen.c |   1 +
 src/gallium/drivers/r600/r600_pipe.c   |   1 +
 src/gallium/drivers/radeonsi/radeonsi_pipe.c   |   1 +
 src/gallium/drivers/softpipe/sp_screen.c   |   2 +
 src/gallium/drivers/svga/svga_screen.c |   1 +
 src/gallium/include/pipe/p_defines.h   |   3 +-
 src/gallium/include/state_tracker/drm_driver.h |   9 +-
 src/gallium/state_trackers/dri/drm/dri2.c  | 120 
+++--

 .../state_trackers/egl/common/native_helper.c  |   1 +
 src/gallium/state_trackers/egl/x11/native_dri2.c   |   1 +
 16 files changed, 137 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c

index 4a9a54e..db122d3 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -201,6 +201,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, 
enum pipe_cap param)

case PIPE_CAP_USER_INDEX_BUFFERS:
case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+	case PIPE_CAP_PRIME:   
 		return 0;
 
 	/* Stream output. */
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c

index dfb76b3..6623dca 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -214,6 +214,7 @@ i915_get_param(struct pipe_screen *screen, enum 
pipe_cap cap)

case PIPE_CAP_TEXTURE_MULTISAMPLE:
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+   case PIPE_CAP_PRIME:
   return 0;
 
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c

index 667ade1..5ff30f1 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -228,6 +228,8 @@ llvmpipe_get_param(struct pipe_screen *screen, 
enum pipe_cap param)

   return 1;
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
   return 0;
+   case PIPE_CAP_PRIME:
+  return 0;
}
/* should only get here on unhandled cases */
debug_printf(Unexpected PIPE_CAP %d query\n, param);
diff --git a/src/gallium/drivers/nv30/nv30_screen.c 
b/src/gallium/drivers/nv30/nv30_screen.c

index 5b3b470..97471a7 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -124,6 +124,7 @@ nv30_screen_get_param(struct pipe_screen 
*pscreen, enum pipe_cap param)

case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+   case PIPE_CAP_PRIME:
   return 0;
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c

index 5aa8ef3..1177c1b 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -188,6 +188,8 @@ nv50_screen_get_param(struct pipe_screen 
*pscreen, enum pipe_cap param)

   return 0;
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
   return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
+   case PIPE_CAP_PRIME:
+  return 0;
default:
   NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
   return 0;
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c

index 8dfd4d1..e3eff40 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -178,6 +178,8 @@ nvc0_screen_get_param(struct pipe_screen 
*pscreen, enum pipe_cap param)

   return 1;
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
   return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
+   case PIPE_CAP_PRIME:
+  return 0;
default:
   NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
   return 0;
diff --git a/src/gallium/drivers/r300/r300_screen.c 
b/src/gallium/drivers/r300/r300_screen.c

index a932be9..000c71d 100644
--- a/src/gallium/drivers/r300

Re: [Mesa-dev] [PATCH 5/6] build/glsl: fix location of generated files.

2012-07-18 Thread Christopher James Halse Rogers
On Wed, 2012-07-18 at 10:38 -0700, Ian Romanick wrote:
 On 07/17/2012 10:08 PM, Christopher James Halse Rogers wrote:
  Like in src/mesa, use GLSL_BUILDDIR/GLSL_SRCDIR to unambiguously
  distinguish between in-tree and generated files.
 
 There's a bunch of stuff later in this patch that have nothing to do 
 with src/glsl.  git commit -a gone amok?

Urgh, quite true. New patch series coming up.


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/7] build: fix location of generated files in src/mesa (v3)

2012-07-18 Thread Christopher James Halse Rogers
Also fix include paths for the generated headers.

v2: Switch to using self-explanatory BUILDDIR/SRCDIR defined from
top_builddir/top_srcdir rather than the ambiguous TOP.
v3: Add both top_builddir and top_srcdir to include flags for mesa asm.
These rely on both in-tree and build-time-generated includes.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glx/apple/Makefile  |4 
 src/mesa/Makefile.am|   13 ++---
 src/mesa/Makefile.old   |5 -
 src/mesa/libdricore/Makefile.am |3 ---
 src/mesa/sources.mak|   34 --
 5 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
index 35edb09..ef12eb0 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -1,4 +1,8 @@
 TOP = ../../..
+top_builddir = $(TOP)
+# This can be a filthy lie. But it doesn't currently build out-of-tree
+# anyway, so it's no worse than what we've got now.
+top_srcdir = $(TOP)
 
 include $(TOP)/configs/current
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 2b023d7..aded0ce 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -42,8 +42,7 @@ main/git_sha1.h: main/git_sha1.h.tmp
fi
 
 # include glapi_gen.mk for generating glapi headers for GLES
-TOP = $(top_srcdir)
-GLAPI = $(TOP)/src/mapi/glapi/gen
+GLAPI = $(top_srcdir)/src/mapi/glapi/gen
 include $(GLAPI)/glapi_gen.mk
 
 BUILT_SOURCES = \
@@ -95,7 +94,6 @@ program/lex.yy.c: program/program_lexer.l
 
 noinst_LTLIBRARIES = libmesa.la libmesagallium.la
 
-SRCDIR = $(top_srcdir)/src/mesa
 include sources.mak
 
 AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
@@ -107,12 +105,21 @@ MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+AM_CPPFLAGS += \
+-I$(top_builddir)/src/mesa/x86 \
+-I$(top_srcdir)/src/mesa/x86
 endif
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
+AM_CPPFLAGS += \
+-I$(top_builddir)/src/mesa/x86-64 \
+-I$(top_srcdir)/src/mesa/x86-64
 endif
 if HAVE_SPARC_ASM
 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
+AM_CPPFLAGS += \
+-I$(top_builddir)/src/mesa/sparc \
+-I$(top_srcdir)/src/mesa/sparc
 endif
 
 libmesa_la_SOURCES = \
diff --git a/src/mesa/Makefile.old b/src/mesa/Makefile.old
index 3266a5d..5b5c745 100644
--- a/src/mesa/Makefile.old
+++ b/src/mesa/Makefile.old
@@ -1,9 +1,12 @@
 # src/mesa/Makefile
 
 TOP = ../..
+top_builddir = $(TOP)
+# This is a filthy lie in the case of out-of-tree builds. But it doesn't
+# currently build out-of-tree anyway, so it's no worse than what we've got now.
+top_srcdir = $(TOP)
 include $(TOP)/configs/current
 
-SRCDIR = .
 include sources.mak
 
 default:
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 26d8a88..7e1c22a 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -19,10 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-TOP=$(top_srcdir)
-SRCDIR = $(srcdir)/..
 include ../sources.mak
-GLSL_SRCDIR = $(srcdir)/../../glsl
 include ../../glsl/Makefile.sources
 
 noinst_PROGRAMS =
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index d22f059..9f83069 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -1,11 +1,12 @@
 ### Lists of source files, included by Makefiles
 
-SRCDIR ?= .
+SRCDIR=$(top_srcdir)/src/mesa
+BUILDDIR=$(top_builddir)/src/mesa
 
 # this is part of MAIN_FILES
 MAIN_ES_FILES = \
-   $(SRCDIR)/main/api_exec_es1.c \
-   $(SRCDIR)/main/api_exec_es2.c
+   $(BUILDDIR)/main/api_exec_es1.c \
+   $(BUILDDIR)/main/api_exec_es2.c
 
 MAIN_FILES = \
$(SRCDIR)/main/api_arrayelt.c \
@@ -34,7 +35,6 @@ MAIN_FILES = \
$(SRCDIR)/main/drawpix.c \
$(SRCDIR)/main/drawtex.c \
$(SRCDIR)/main/enable.c \
-   $(SRCDIR)/main/enums.c \
$(SRCDIR)/main/errors.c \
$(SRCDIR)/main/eval.c \
$(SRCDIR)/main/execmem.c \
@@ -105,6 +105,7 @@ MAIN_FILES = \
$(SRCDIR)/main/version.c \
$(SRCDIR)/main/viewport.c \
$(SRCDIR)/main/vtxfmt.c \
+   $(BUILDDIR)/main/enums.c \
$(MAIN_ES_FILES)
 
 MAIN_CXX_FILES = \
@@ -249,11 +250,9 @@ STATETRACKER_FILES = \
 PROGRAM_FILES = \
$(SRCDIR)/program/arbprogparse.c \
$(SRCDIR)/program/hash_table.c \
-   $(SRCDIR)/program/lex.yy.c \
$(SRCDIR)/program/nvfragparse.c \
$(SRCDIR)/program/nvvertparse.c \
$(SRCDIR)/program/program.c \
-   $(SRCDIR)/program/program_parse.tab.c \
$(SRCDIR)/program/program_parse_extra.c \
$(SRCDIR)/program/prog_cache.c \
$(SRCDIR)/program/prog_execute.c \
@@ -267,7 +266,9 @@ PROGRAM_FILES = \
$(SRCDIR)/program/prog_statevars.c \
$(SRCDIR)/program/programopt.c \
$(SRCDIR)/program/register_allocate.c

[Mesa-dev] [PATCH 2/7] build/glx: fix include paths for out-of-tree builds

2012-07-18 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glx/Makefile.am |2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index bb23998..23d5753 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -37,6 +37,8 @@ AM_CFLAGS = \
-I$(top_srcdir)/include/GL/internal \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mapi/glapi \
+   -I$(top_builddir)/src/mapi \
+   -I$(top_builddir)/src/mapi/glapi \
$(SHARED_GLAPI_CFLAGS) \
$(EXTRA_DEFINES_XF86VIDMODE) \
-D_REENTRANT \
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 3/7] build: fix out of tree generation of glapi_mapi_tmp.h

2012-07-18 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/glapi/gen/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index 52aeb3a..499ec09 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -176,7 +176,7 @@ $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
 
 $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES)
$(PYTHON_GEN) $ \
-   --printer glapi --mode lib gl_and_es_API.xml  $@
+   --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml  $@
 
 $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
$(PYTHON_GEN) $ -f $(srcdir)/gl_API.xml  $@
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 4/7] build/glapi: fix includes for generated files

2012-07-18 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/glapi/Makefile.am |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mapi/glapi/Makefile.am b/src/mapi/glapi/Makefile.am
index 668d7fa..181a28a 100644
--- a/src/mapi/glapi/Makefile.am
+++ b/src/mapi/glapi/Makefile.am
@@ -27,6 +27,7 @@ AM_CPPFLAGS = \
 $(DEFINES) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
+-I$(top_builddir)/src/mapi \
-I$(top_srcdir)/src/mesa
 
 if HAVE_X86_ASM
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 5/7] build/glsl: fix location of generated files.

2012-07-18 Thread Christopher James Halse Rogers
Like in src/mesa, use GLSL_BUILDDIR/GLSL_SRCDIR to unambiguously
distinguish between in-tree and generated files.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glsl/Makefile.am   |4 
 src/glsl/Makefile.sources  |   15 ---
 src/glsl/glcpp/Makefile.am |4 
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index d86153c..0ab6672 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -23,9 +23,6 @@
 # builtin_compiler is built before libglsl to generate builtin_function.cpp 
for libglsl.
 # For this to work, a dummy version of builtin_function.cpp, 
builtin_stubs.cpp, is used.
 
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
 AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
@@ -39,7 +36,6 @@ AM_CXXFLAGS = $(AM_CFLAGS)
 
 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
 
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
 include Makefile.sources
 
 noinst_LTLIBRARIES = libglslcommon.la libglsl.la
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index f2743f7..15c717a 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -1,6 +1,7 @@
 # shared source lists for Makefile, SConscript, and Android.mk
 
-GLSL_SRCDIR ?= .
+GLSL_SRCDIR = $(top_srcdir)/src/glsl
+GLSL_BUILDDIR = $(top_builddir)/src/glsl
 
 # libglcpp
 
@@ -8,8 +9,8 @@ LIBGLCPP_FILES = \
$(GLSL_SRCDIR)/glcpp/pp.c
 
 LIBGLCPP_GENERATED_FILES = \
-   $(GLSL_SRCDIR)/glcpp/glcpp-lex.c \
-   $(GLSL_SRCDIR)/glcpp/glcpp-parse.c
+   $(GLSL_BUILDDIR)/glcpp/glcpp-lex.c \
+   $(GLSL_BUILDDIR)/glcpp/glcpp-parse.c
 
 # libglsl
 
@@ -101,10 +102,10 @@ BUILTIN_COMPILER_CXX_FILES = \
$(GLSL_SRCDIR)/builtin_stubs.cpp
 
 BUILTIN_COMPILER_GENERATED_CXX_FILES = \
-   $(GLSL_SRCDIR)/glsl_lexer.cc \
-   $(GLSL_SRCDIR)/glsl_parser.cc
+   $(GLSL_BUILDDIR)/glsl_lexer.cc \
+   $(GLSL_BUILDDIR)/glsl_parser.cc
 
 # libglsl generated sources
 LIBGLSL_GENERATED_CXX_FILES = \
-   $(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-   $(GLSL_SRCDIR)/builtin_function.cpp
+   $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+   $(GLSL_BUILDDIR)/builtin_function.cpp
diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index e7d5d2c..7a95b68 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -20,10 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
 include ../Makefile.sources
 
 AM_CFLAGS = \
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 6/7] build/mapi: More killing of TOP in favour of top_srcdir

2012-07-18 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/es1api/Makefile|4 
 src/mapi/glapi/gen/glapi_gen.mk |   14 +++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
index a9c9123..6f4c35a 100644
--- a/src/mapi/es1api/Makefile
+++ b/src/mapi/es1api/Makefile
@@ -40,6 +40,10 @@ esapi_CPPFLAGS := \
-I$(TOP)/src/mapi \
-DMAPI_ABI_HEADER=\$(ESAPI)/glapi_mapi_tmp.h\
 
+
+# This is a lie when doing out-of-tree builds, but it's no worse than the
+# current situation, and can be dropped should this get automakified
+top_srcdir = $(TOP)
 include $(MAPI)/sources.mak
 esapi_SOURCES := $(MAPI_BRIDGE_FILES)
 esapi_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
diff --git a/src/mapi/glapi/gen/glapi_gen.mk b/src/mapi/glapi/gen/glapi_gen.mk
index 1b05a40..eab8eb4 100644
--- a/src/mapi/glapi/gen/glapi_gen.mk
+++ b/src/mapi/glapi/gen/glapi_gen.mk
@@ -1,14 +1,14 @@
 # Helpers for glapi header generation
 
-ifndef TOP
-$(error TOP must be defined.)
+ifndef top_srcdir
+$(error top_srcdir must be defined.)
 endif
 
 glapi_gen_common_deps := \
-   $(wildcard $(TOP)/src/mapi/glapi/gen/*.xml) \
-   $(wildcard $(TOP)/src/mapi/glapi/gen/*.py)
+   $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \
+   $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py)
 
-glapi_gen_mapi_script := $(TOP)/src/mapi/mapi/mapi_abi.py
+glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi/mapi_abi.py
 glapi_gen_mapi_deps := \
$(glapi_gen_mapi_script) \
$(glapi_gen_common_deps)
@@ -21,7 +21,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) 
$(glapi_gen_mapi_script) \
--mode lib --printer $(2) $(1)  $@
 endef
 
-glapi_gen_dispatch_script := $(TOP)/src/mapi/glapi/gen/gl_table.py
+glapi_gen_dispatch_script := $(top_srcdir)/src/mapi/glapi/gen/gl_table.py
 glapi_gen_dispatch_deps := $(glapi_gen_common_deps)
 
 # $(1): path to an XML file
@@ -32,7 +32,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) 
$(glapi_gen_dispatch_script) \
-f $(1) -m remap_table $(if $(2),-c $(2),)  $@
 endef
 
-glapi_gen_remap_script := $(TOP)/src/mapi/glapi/gen/remap_helper.py
+glapi_gen_remap_script := $(top_srcdir)/src/mapi/glapi/gen/remap_helper.py
 glapi_gen_remap_deps := $(glapi_gen_common_deps)
 
 # $(1): path to an XML file
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 7/7] build: Fix libdricore out-of-tree builds (v2)

2012-07-18 Thread Christopher James Halse Rogers
v2: Add both top_srcdir and top_builddir to mesa asm include dirs.
These require both in-tree and build-time-generated files.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mesa/libdricore/Makefile.am |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 7e1c22a..60dfb7a 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -41,7 +41,7 @@ libdricore@VERSION@_la_SOURCES = \
$(LIBGLSL_FILES) \
$(LIBGLSL_CXX_FILES) \
$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-   $(top_srcdir)/src/glsl/builtin_function.cpp
+   $(top_builddir)/src/glsl/builtin_function.cpp
 libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
 libdricore@VERSION@_la_LIBADD = libdricore-asm.la
 
@@ -55,14 +55,23 @@ libdricore_asm_la_CCASFLAGS = $(AM_CCASFLAGS) 
-DWORKAROUND_AUTOMAKE_OBJ_FILE_CON
 
 if HAVE_X86_ASM
 libdricore_asm_la_SOURCES += $(X86_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/x86 \
+-I$(top_srcdir)/src/mesa/x86
 endif
 
 if HAVE_X86_64_ASM
 libdricore_asm_la_SOURCES += $(X86_64_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/x86-64 \
+-I$(top_srcdir)/src/mesa/x86-64
 endif
 
 if HAVE_SPARC_ASM
 libdricore_asm_la_SOURCES += $(SPARC_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/sparc \
+-I$(top_srcdir)/src/mesa/sparc
 endif
 
 if HAVE_DRICORE
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 1/6] build: fix location of generated files in src/mesa (v2)

2012-07-17 Thread Christopher James Halse Rogers
Also fix include paths for the generated headers.

v2: Switch to using self-explanatory BUILDDIR/SRCDIR defined from
top_builddir/top_srcdir rather than the ambiguous TOP.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glx/apple/Makefile  |4 
 src/mesa/Makefile.am|7 ---
 src/mesa/Makefile.old   |5 -
 src/mesa/libdricore/Makefile.am |3 ---
 src/mesa/sources.mak|   34 --
 5 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
index 35edb09..ef12eb0 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -1,4 +1,8 @@
 TOP = ../../..
+top_builddir = $(TOP)
+# This can be a filthy lie. But it doesn't currently build out-of-tree
+# anyway, so it's no worse than what we've got now.
+top_srcdir = $(TOP)
 
 include $(TOP)/configs/current
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 2b023d7..f70a5c1 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -42,8 +42,7 @@ main/git_sha1.h: main/git_sha1.h.tmp
fi
 
 # include glapi_gen.mk for generating glapi headers for GLES
-TOP = $(top_srcdir)
-GLAPI = $(TOP)/src/mapi/glapi/gen
+GLAPI = $(top_srcdir)/src/mapi/glapi/gen
 include $(GLAPI)/glapi_gen.mk
 
 BUILT_SOURCES = \
@@ -95,7 +94,6 @@ program/lex.yy.c: program/program_lexer.l
 
 noinst_LTLIBRARIES = libmesa.la libmesagallium.la
 
-SRCDIR = $(top_srcdir)/src/mesa
 include sources.mak
 
 AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
@@ -107,12 +105,15 @@ MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+AM_CPPFLAGS += -I$(top_builddir)/src/mesa/x86
 endif
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
+AM_CPPFLAGS += -I$(top_builddir)/src/mesa/x86-64
 endif
 if HAVE_SPARC_ASM
 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
+AM_CPPFLAGS += -I$(top_builddir)/src/mesa/sparc
 endif
 
 libmesa_la_SOURCES = \
diff --git a/src/mesa/Makefile.old b/src/mesa/Makefile.old
index 3266a5d..5b5c745 100644
--- a/src/mesa/Makefile.old
+++ b/src/mesa/Makefile.old
@@ -1,9 +1,12 @@
 # src/mesa/Makefile
 
 TOP = ../..
+top_builddir = $(TOP)
+# This is a filthy lie in the case of out-of-tree builds. But it doesn't
+# currently build out-of-tree anyway, so it's no worse than what we've got now.
+top_srcdir = $(TOP)
 include $(TOP)/configs/current
 
-SRCDIR = .
 include sources.mak
 
 default:
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 26d8a88..7e1c22a 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -19,10 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-TOP=$(top_srcdir)
-SRCDIR = $(srcdir)/..
 include ../sources.mak
-GLSL_SRCDIR = $(srcdir)/../../glsl
 include ../../glsl/Makefile.sources
 
 noinst_PROGRAMS =
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index d22f059..9f83069 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -1,11 +1,12 @@
 ### Lists of source files, included by Makefiles
 
-SRCDIR ?= .
+SRCDIR=$(top_srcdir)/src/mesa
+BUILDDIR=$(top_builddir)/src/mesa
 
 # this is part of MAIN_FILES
 MAIN_ES_FILES = \
-   $(SRCDIR)/main/api_exec_es1.c \
-   $(SRCDIR)/main/api_exec_es2.c
+   $(BUILDDIR)/main/api_exec_es1.c \
+   $(BUILDDIR)/main/api_exec_es2.c
 
 MAIN_FILES = \
$(SRCDIR)/main/api_arrayelt.c \
@@ -34,7 +35,6 @@ MAIN_FILES = \
$(SRCDIR)/main/drawpix.c \
$(SRCDIR)/main/drawtex.c \
$(SRCDIR)/main/enable.c \
-   $(SRCDIR)/main/enums.c \
$(SRCDIR)/main/errors.c \
$(SRCDIR)/main/eval.c \
$(SRCDIR)/main/execmem.c \
@@ -105,6 +105,7 @@ MAIN_FILES = \
$(SRCDIR)/main/version.c \
$(SRCDIR)/main/viewport.c \
$(SRCDIR)/main/vtxfmt.c \
+   $(BUILDDIR)/main/enums.c \
$(MAIN_ES_FILES)
 
 MAIN_CXX_FILES = \
@@ -249,11 +250,9 @@ STATETRACKER_FILES = \
 PROGRAM_FILES = \
$(SRCDIR)/program/arbprogparse.c \
$(SRCDIR)/program/hash_table.c \
-   $(SRCDIR)/program/lex.yy.c \
$(SRCDIR)/program/nvfragparse.c \
$(SRCDIR)/program/nvvertparse.c \
$(SRCDIR)/program/program.c \
-   $(SRCDIR)/program/program_parse.tab.c \
$(SRCDIR)/program/program_parse_extra.c \
$(SRCDIR)/program/prog_cache.c \
$(SRCDIR)/program/prog_execute.c \
@@ -267,7 +266,9 @@ PROGRAM_FILES = \
$(SRCDIR)/program/prog_statevars.c \
$(SRCDIR)/program/programopt.c \
$(SRCDIR)/program/register_allocate.c \
-   $(SRCDIR)/program/symbol_table.c
+   $(SRCDIR)/program/symbol_table.c \
+   $(BUILDDIR)/program/lex.yy.c \
+   $(BUILDDIR)/program/program_parse.tab.c
 
 
 SHADER_CXX_FILES = \
@@ -373,15 +374,20 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_FILES:.c=.o)
 ### Other archives/libraries

[Mesa-dev] [PATCH 2/6] bulid/glx: fix include paths for out-of-tree builds

2012-07-17 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glx/Makefile.am |2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index bb23998..23d5753 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -37,6 +37,8 @@ AM_CFLAGS = \
-I$(top_srcdir)/include/GL/internal \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mapi/glapi \
+   -I$(top_builddir)/src/mapi \
+   -I$(top_builddir)/src/mapi/glapi \
$(SHARED_GLAPI_CFLAGS) \
$(EXTRA_DEFINES_XF86VIDMODE) \
-D_REENTRANT \
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 3/6] build: fix out of tree generation of glapi_mapi_tmp.h

2012-07-17 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/glapi/gen/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index 52aeb3a..499ec09 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -176,7 +176,7 @@ $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
 
 $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES)
$(PYTHON_GEN) $ \
-   --printer glapi --mode lib gl_and_es_API.xml  $@
+   --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml  $@
 
 $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
$(PYTHON_GEN) $ -f $(srcdir)/gl_API.xml  $@
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 4/6] build/glapi: fix includes for generated files

2012-07-17 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/glapi/Makefile.am |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mapi/glapi/Makefile.am b/src/mapi/glapi/Makefile.am
index 668d7fa..181a28a 100644
--- a/src/mapi/glapi/Makefile.am
+++ b/src/mapi/glapi/Makefile.am
@@ -27,6 +27,7 @@ AM_CPPFLAGS = \
 $(DEFINES) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
+-I$(top_builddir)/src/mapi \
-I$(top_srcdir)/src/mesa
 
 if HAVE_X86_ASM
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 5/6] build/glsl: fix location of generated files.

2012-07-17 Thread Christopher James Halse Rogers
Like in src/mesa, use GLSL_BUILDDIR/GLSL_SRCDIR to unambiguously
distinguish between in-tree and generated files.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glsl/Makefile.am|4 
 src/glsl/Makefile.sources   |   15 ---
 src/glsl/glcpp/Makefile.am  |4 
 src/mapi/es1api/Makefile|4 
 src/mapi/glapi/gen/glapi_gen.mk |   14 +++---
 5 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index d86153c..0ab6672 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -23,9 +23,6 @@
 # builtin_compiler is built before libglsl to generate builtin_function.cpp 
for libglsl.
 # For this to work, a dummy version of builtin_function.cpp, 
builtin_stubs.cpp, is used.
 
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
 AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
@@ -39,7 +36,6 @@ AM_CXXFLAGS = $(AM_CFLAGS)
 
 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
 
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
 include Makefile.sources
 
 noinst_LTLIBRARIES = libglslcommon.la libglsl.la
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index f2743f7..15c717a 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -1,6 +1,7 @@
 # shared source lists for Makefile, SConscript, and Android.mk
 
-GLSL_SRCDIR ?= .
+GLSL_SRCDIR = $(top_srcdir)/src/glsl
+GLSL_BUILDDIR = $(top_builddir)/src/glsl
 
 # libglcpp
 
@@ -8,8 +9,8 @@ LIBGLCPP_FILES = \
$(GLSL_SRCDIR)/glcpp/pp.c
 
 LIBGLCPP_GENERATED_FILES = \
-   $(GLSL_SRCDIR)/glcpp/glcpp-lex.c \
-   $(GLSL_SRCDIR)/glcpp/glcpp-parse.c
+   $(GLSL_BUILDDIR)/glcpp/glcpp-lex.c \
+   $(GLSL_BUILDDIR)/glcpp/glcpp-parse.c
 
 # libglsl
 
@@ -101,10 +102,10 @@ BUILTIN_COMPILER_CXX_FILES = \
$(GLSL_SRCDIR)/builtin_stubs.cpp
 
 BUILTIN_COMPILER_GENERATED_CXX_FILES = \
-   $(GLSL_SRCDIR)/glsl_lexer.cc \
-   $(GLSL_SRCDIR)/glsl_parser.cc
+   $(GLSL_BUILDDIR)/glsl_lexer.cc \
+   $(GLSL_BUILDDIR)/glsl_parser.cc
 
 # libglsl generated sources
 LIBGLSL_GENERATED_CXX_FILES = \
-   $(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-   $(GLSL_SRCDIR)/builtin_function.cpp
+   $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+   $(GLSL_BUILDDIR)/builtin_function.cpp
diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index e7d5d2c..7a95b68 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -20,10 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
 include ../Makefile.sources
 
 AM_CFLAGS = \
diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
index a9c9123..6f4c35a 100644
--- a/src/mapi/es1api/Makefile
+++ b/src/mapi/es1api/Makefile
@@ -40,6 +40,10 @@ esapi_CPPFLAGS := \
-I$(TOP)/src/mapi \
-DMAPI_ABI_HEADER=\$(ESAPI)/glapi_mapi_tmp.h\
 
+
+# This is a lie when doing out-of-tree builds, but it's no worse than the
+# current situation, and can be dropped should this get automakified
+top_srcdir = $(TOP)
 include $(MAPI)/sources.mak
 esapi_SOURCES := $(MAPI_BRIDGE_FILES)
 esapi_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
diff --git a/src/mapi/glapi/gen/glapi_gen.mk b/src/mapi/glapi/gen/glapi_gen.mk
index 1b05a40..eab8eb4 100644
--- a/src/mapi/glapi/gen/glapi_gen.mk
+++ b/src/mapi/glapi/gen/glapi_gen.mk
@@ -1,14 +1,14 @@
 # Helpers for glapi header generation
 
-ifndef TOP
-$(error TOP must be defined.)
+ifndef top_srcdir
+$(error top_srcdir must be defined.)
 endif
 
 glapi_gen_common_deps := \
-   $(wildcard $(TOP)/src/mapi/glapi/gen/*.xml) \
-   $(wildcard $(TOP)/src/mapi/glapi/gen/*.py)
+   $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \
+   $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py)
 
-glapi_gen_mapi_script := $(TOP)/src/mapi/mapi/mapi_abi.py
+glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi/mapi_abi.py
 glapi_gen_mapi_deps := \
$(glapi_gen_mapi_script) \
$(glapi_gen_common_deps)
@@ -21,7 +21,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) 
$(glapi_gen_mapi_script) \
--mode lib --printer $(2) $(1)  $@
 endef
 
-glapi_gen_dispatch_script := $(TOP)/src/mapi/glapi/gen/gl_table.py
+glapi_gen_dispatch_script := $(top_srcdir)/src/mapi/glapi/gen/gl_table.py
 glapi_gen_dispatch_deps := $(glapi_gen_common_deps)
 
 # $(1): path to an XML file
@@ -32,7 +32,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) 
$(glapi_gen_dispatch_script) \
-f $(1) -m remap_table $(if $(2),-c $(2),)  $@
 endef
 
-glapi_gen_remap_script := $(TOP)/src/mapi/glapi/gen/remap_helper.py
+glapi_gen_remap_script := $(top_srcdir)/src/mapi/glapi/gen/remap_helper.py
 glapi_gen_remap_deps := $(glapi_gen_common_deps)
 
 # $(1

[Mesa-dev] [PATCH 6/6] build: Fix libdricore out-of-tree builds

2012-07-17 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mesa/libdricore/Makefile.am |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 7e1c22a..e46d5bd 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -41,7 +41,7 @@ libdricore@VERSION@_la_SOURCES = \
$(LIBGLSL_FILES) \
$(LIBGLSL_CXX_FILES) \
$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-   $(top_srcdir)/src/glsl/builtin_function.cpp
+   $(top_builddir)/src/glsl/builtin_function.cpp
 libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
 libdricore@VERSION@_la_LIBADD = libdricore-asm.la
 
@@ -55,14 +55,20 @@ libdricore_asm_la_CCASFLAGS = $(AM_CCASFLAGS) 
-DWORKAROUND_AUTOMAKE_OBJ_FILE_CON
 
 if HAVE_X86_ASM
 libdricore_asm_la_SOURCES += $(X86_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/x86
 endif
 
 if HAVE_X86_64_ASM
 libdricore_asm_la_SOURCES += $(X86_64_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/x86-64
 endif
 
 if HAVE_SPARC_ASM
 libdricore_asm_la_SOURCES += $(SPARC_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/sparc
 endif
 
 if HAVE_DRICORE
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 3/5] build: fix location of generated files in src/mesa

2012-07-08 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mesa/sources.mak |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index 16b1c39..87191fd 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -4,8 +4,8 @@ SRCDIR ?= .
 
 # this is part of MAIN_FILES
 MAIN_ES_FILES = \
-   $(SRCDIR)/main/api_exec_es1.c \
-   $(SRCDIR)/main/api_exec_es2.c
+   $(TOP)/src/mesa/main/api_exec_es1.c \
+   $(TOP)/src/mesa/main/api_exec_es2.c
 
 MAIN_FILES = \
$(SRCDIR)/main/api_arrayelt.c \
@@ -249,11 +249,11 @@ STATETRACKER_FILES = \
 PROGRAM_FILES = \
$(SRCDIR)/program/arbprogparse.c \
$(SRCDIR)/program/hash_table.c \
-   $(SRCDIR)/program/lex.yy.c \
+   $(TOP)/src/mesa/program/lex.yy.c \
$(SRCDIR)/program/nvfragparse.c \
$(SRCDIR)/program/nvvertparse.c \
$(SRCDIR)/program/program.c \
-   $(SRCDIR)/program/program_parse.tab.c \
+   $(TOP)/src/mesa/program/program_parse.tab.c \
$(SRCDIR)/program/program_parse_extra.c \
$(SRCDIR)/program/prog_cache.c \
$(SRCDIR)/program/prog_execute.c \
@@ -382,6 +382,7 @@ INCLUDE_DIRS = \
-I$(TOP)/include \
-I$(TOP)/src/glsl \
-I$(TOP)/src/mesa \
+   -I$(TOP)/src/mesa/main \
-I$(TOP)/src/mapi \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 1/5] build: fix top_srcdir/top_builddir confusion.

2012-07-08 Thread Christopher James Halse Rogers
In some of the automake files TOP is set to top_srcdir, in some
top_builddir. Since the build looks for generated files under TOP,
top_builddir correct.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/shared-glapi/Makefile.am |2 +-
 src/mesa/Makefile.am  |4 ++--
 src/mesa/libdricore/Makefile.am   |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mapi/shared-glapi/Makefile.am 
b/src/mapi/shared-glapi/Makefile.am
index 9485683..85a3677 100644
--- a/src/mapi/shared-glapi/Makefile.am
+++ b/src/mapi/shared-glapi/Makefile.am
@@ -1,6 +1,6 @@
 # Used by OpenGL ES or when --enable-shared-glapi is specified
 
-TOP = $(top_srcdir)
+TOP = $(top_builddir)
 GLAPI = $(top_srcdir)/src/mapi/glapi
 include $(top_srcdir)/src/mapi/mapi/sources.mak
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index bada760..ecfb165 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -42,8 +42,8 @@ main/git_sha1.h: main/git_sha1.h.tmp
fi
 
 # include glapi_gen.mk for generating glapi headers for GLES
-TOP = $(top_srcdir)
-GLAPI = $(TOP)/src/mapi/glapi/gen
+TOP = $(top_builddir)
+GLAPI = $(top_srcdir)/src/mapi/glapi/gen
 include $(GLAPI)/glapi_gen.mk
 
 BUILT_SOURCES = \
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 26d8a88..4637bf2 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -19,7 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-TOP=$(top_srcdir)
+TOP=$(top_builddir)
 SRCDIR = $(srcdir)/..
 include ../sources.mak
 GLSL_SRCDIR = $(srcdir)/../../glsl
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 4/5] build: Fix glsl out-of-tree builds

2012-07-08 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/glsl/Makefile |9 ++---
 src/glsl/Makefile.sources |   12 ++--
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index 3cf9fc9..872677e 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -11,19 +11,22 @@ GLSL_SRCDIR=.
 include Makefile.sources
 
 GLCPP_SOURCES = \
-   $(LIBGLCPP_GENERATED_FILES) \
+   glcpp/glcpp-lex.c \
+   glcpp/glcpp-parse.c \
$(LIBGLCPP_FILES) \
ralloc.c \
glcpp/glcpp.c
 
 C_SOURCES = \
-   $(LIBGLCPP_GENERATED_FILES) \
+   glcpp/glcpp-lex.c \
+   glcpp/glcpp-parse.c \
$(LIBGLCPP_FILES) \
$(LIBGLSL_FILES)
 
 # common sources for builtin_compiler and libglsl
 CXX_SOURCES = \
-   $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+   glsl_lexer.cpp \
+   glsl_parser.cpp \
$(LIBGLSL_CXX_FILES)
 
 LIBS = \
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 0425fa3..70edc04 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -8,8 +8,8 @@ LIBGLCPP_FILES = \
$(GLSL_SRCDIR)/glcpp/pp.c
 
 LIBGLCPP_GENERATED_FILES = \
-   $(GLSL_SRCDIR)/glcpp/glcpp-lex.c \
-   $(GLSL_SRCDIR)/glcpp/glcpp-parse.c
+   $(TOP)/src/glsl/glcpp/glcpp-lex.c \
+   $(TOP)/src/glsl/glcpp/glcpp-parse.c
 
 # libglsl
 
@@ -101,10 +101,10 @@ BUILTIN_COMPILER_CXX_FILES = \
$(GLSL_SRCDIR)/builtin_stubs.cpp
 
 BUILTIN_COMPILER_GENERATED_CXX_FILES = \
-   $(GLSL_SRCDIR)/glsl_lexer.cpp \
-   $(GLSL_SRCDIR)/glsl_parser.cpp
+   $(TOP)/src/glsl/glsl_lexer.cpp \
+   $(TOP)/src/glsl/glsl_parser.cpp
 
 # libglsl generated sources
 LIBGLSL_GENERATED_CXX_FILES = \
-   $(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-   $(GLSL_SRCDIR)/builtin_function.cpp
+   $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+   $(TOP)/src/glsl/builtin_function.cpp
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 2/5] build: fix out of tree generation of glapi_mapi_tmp.h

2012-07-08 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mapi/glapi/gen/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index df3e82d..62ea1aa 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -156,7 +156,7 @@ $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
 
 $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES)
$(PYTHON_GEN) $ \
-   --printer glapi --mode lib gl_and_es_API.xml  $@
+   --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml  $@
 
 $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
$(PYTHON_GEN) $ -f $(srcdir)/gl_API.xml  $@
-- 
1.7.10.4

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


[Mesa-dev] [PATCH] Fix the build, Debian style

2012-07-08 Thread Christopher James Halse Rogers
This series fixes out-of-tree builds as perpetrated by the Debian mesa
packaging. Almost. The linker gets confused on llvmpipe's test programs,
only in out-of-tree builds, but this gets all the important bits building.

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


[Mesa-dev] [PATCH 5/5] build: Fix libdricore out-of-tree builds

2012-07-08 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mesa/libdricore/Makefile.am |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 4637bf2..f3ea4a3 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -28,6 +28,7 @@ include ../../glsl/Makefile.sources
 noinst_PROGRAMS =
 
 AM_CPPFLAGS = \
+-I$(top_builddir)/src/mesa/main \
$(INCLUDE_DIRS) \
$(API_DEFINES) \
$(DEFINES)
@@ -44,7 +45,7 @@ libdricore@VERSION@_la_SOURCES = \
$(LIBGLSL_FILES) \
$(LIBGLSL_CXX_FILES) \
$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-   $(top_srcdir)/src/glsl/builtin_function.cpp
+   $(top_builddir)/src/glsl/builtin_function.cpp
 libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
 libdricore@VERSION@_la_LIBADD = libdricore-asm.la
 
@@ -58,14 +59,20 @@ libdricore_asm_la_CCASFLAGS = $(AM_CCASFLAGS) 
-DWORKAROUND_AUTOMAKE_OBJ_FILE_CON
 
 if HAVE_X86_ASM
 libdricore_asm_la_SOURCES += $(X86_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/x86
 endif
 
 if HAVE_X86_64_ASM
 libdricore_asm_la_SOURCES += $(X86_64_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/x86-64
 endif
 
 if HAVE_SPARC_ASM
 libdricore_asm_la_SOURCES += $(SPARC_FILES)
+libdricore_asm_la_CPPFLAGS = $(AM_CPPFLAGS) \
+-I$(top_builddir)/src/mesa/sparc
 endif
 
 if HAVE_DRICORE
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH 3/5] build: fix location of generated files in src/mesa

2012-07-08 Thread Christopher James Halse Rogers
On Sun, 2012-07-08 at 19:39 -0700, Kenneth Graunke wrote:
 On 07/08/2012 04:14 PM, Christopher James Halse Rogers wrote:
  Signed-off-by: Christopher James Halse Rogers 
  christopher.halse.rog...@canonical.com
  ---
   src/mesa/sources.mak |9 +
   1 file changed, 5 insertions(+), 4 deletions(-)
  
  diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
  index 16b1c39..87191fd 100644
  --- a/src/mesa/sources.mak
  +++ b/src/mesa/sources.mak
  @@ -4,8 +4,8 @@ SRCDIR ?= .
   
   # this is part of MAIN_FILES
   MAIN_ES_FILES = \
  -   $(SRCDIR)/main/api_exec_es1.c \
  -   $(SRCDIR)/main/api_exec_es2.c
  +   $(TOP)/src/mesa/main/api_exec_es1.c \
  +   $(TOP)/src/mesa/main/api_exec_es2.c
 
 Could we use $(top_builddir) instead of $(TOP)?  As your first patch
 demonstrates, there are really two top-level directories, so $(TOP) is
 ambiguous/confusing.  I'd rather see us stop using it, for clarity.

It's included in a number of non-automake Makefiles, where IIUC
$(top_builddir) is not normally defined.

On the other hand, making these Makefiles define $(top_builddir) instead
of $(TOP) would be easy, and probably makes sense given the transition
to autotools. I'll do that.



signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965/vs: Fix incorrect subscript when resetting copy propagation records.

2011-12-23 Thread Christopher James Halse Rogers
On Fri, 2011-12-23 at 20:57 -0800, Kenneth Graunke wrote:
 In this code, 'i' loops over the number of virtual GRFs, while 'j' loops
 over the number of vector components (0 = j = 3).
 
 It can't possibly be correct to see if bit 'i' is set in the destination
 writemask, as it will have values much larger than 3.  Clearly this is
 supposed to be 'j'.
 
 Found by inspection.
 
 Cc: Eric Anholt e...@anholt.net
 Cc: Matt Turner matts...@gmail.com
 Cc: Christopher James Halse Rogers chalserog...@gmail.com
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  .../drivers/dri/i965/brw_vec4_copy_propagation.cpp |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 Matt and Christopher,
 
 Could you test Counter Strike and Civ V with this patch series?
 I think it should solve your regressions with the new VS backend.

Works a treat.

For the series:
Tested-by: Christopher James Halse Rogers
christopher.halse.rog...@canonical.com


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] libgallium.so and miscelaneous buildsystem patches

2011-10-05 Thread Christopher James Halse Rogers
On Wed, 2011-10-05 at 09:24 +0200, Joakim Sindholt wrote:
 On Tue, 2011-10-04 at 17:58 +0200, Fabio wrote:
  Can the patches at
  http://lists.freedesktop.org/archives/mesa-dev/2011-August/011099.html
  be considered for merging?
  
  Sharing libgallium should save some MB of installed space.
 
 And be an ABI nightmare for distributions

No; it's a private library.  Distributions will happily ship a
libgallium built from exactly the same source that the DRI drivers are
built from.  Indeed, that's what currently happens for those
distributions with ship with --enable-shared-dricore, and what happens
in Ubuntu, where we've got this patch series applied in our never-ending
quest to cram a fully-featured linux system on a 700MB CD.

Saving 20-odd megabytes is really useful there :)



signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] libgallium.so and miscelaneous buildsystem patches

2011-10-05 Thread Christopher James Halse Rogers
On Wed, 2011-10-05 at 10:39 +0100, Keith Whitwell wrote:
 On Wed, 2011-10-05 at 20:14 +1100, Christopher James Halse Rogers wrote:
  On Wed, 2011-10-05 at 09:24 +0200, Joakim Sindholt wrote:
   On Tue, 2011-10-04 at 17:58 +0200, Fabio wrote:
Can the patches at
http://lists.freedesktop.org/archives/mesa-dev/2011-August/011099.html
be considered for merging?

Sharing libgallium should save some MB of installed space.
   
   And be an ABI nightmare for distributions
  
  No; it's a private library.  Distributions will happily ship a
  libgallium built from exactly the same source that the DRI drivers are
  built from.  Indeed, that's what currently happens for those
  distributions with ship with --enable-shared-dricore, and what happens
  in Ubuntu, where we've got this patch series applied in our never-ending
  quest to cram a fully-featured linux system on a 700MB CD.
  
  Saving 20-odd megabytes is really useful there :)
 
 An alternative would be to build all the drivers into a single library
 for maximal sharing.

Yeah, that would be another option.  It's more invasive though, which is
one of the reasons why I didn't do it first.

As far as I can tell it requires a new API between the libGL and the
loaded DRI driver - or just having a monolithic libGL - with concomitant
changes to the X server.  That's not impossible, but is more difficult.



signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/4] Miscelaneous buildsystem patches

2011-08-28 Thread Christopher James Halse Rogers
On Sat, 2011-08-27 at 14:02 +0800, Chia-I Wu wrote:
 On Fri, Aug 26, 2011 at 4:03 PM, Christopher James Halse Rogers
 christopher.halse.rog...@canonical.com wrote:
  Eric was wondering why the --enable-shared-dricore option also built 
  libglsl.so.
  This provided the activation energy to fix it, and also extend dricore to 
  the
  gallium drivers.
 I wonder if libdricore.so can also be shared by gallium drivers.  Does
 adding sources specific to libmesagallium.a to libdricore.so work?

Yes.  In these patches the gallium DRI drivers already link to
libdricore, and it would be entirely possible to fold libgallium.so into
libdricore.so.  It was simpler to build a new libgallium, though, and I
felt that it was different enough to make a separate library.


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] mklib: Add support for -whole-archive/-no-whole-archive.

2011-08-26 Thread Christopher James Halse Rogers
This is useful for building convenience libraries before combining them into
shared libraries, like dricore

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 bin/mklib |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 2c7ed38..b4b5dd5 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -124,6 +124,11 @@ usage() {
 echo   -noprefix don't prefix library name with 'lib' nor add any 
suffix
 echo '  -exports FILE only export the symbols listed in FILE'
 echo '  -id NAME  Sets the id of the dylib (Darwin)'
+echo '  -whole-archive OBJS1 OBJS2 ... -no-whole-archive'
+echo 'Include every object file in archives OBJS1 OBJS2 
...'
+echo 'rather than searching them for required symbols.'
+echo 'Useful for including convinience libraries in shared'
+echo 'objects.'
 echo '  -h, --helpdisplay this information and exit'
 }
 
@@ -194,6 +199,18 @@ do
-Wl*)
 DEPS=$DEPS $1
 ;;
+   '-whole-archive')
+   shift
+   while [ x$1 != x-no-whole-archive ] ; do
+   if [ x$1 = x ] ; then
+   echo mklib: End of arguments reached when scanning for 
-no-whole-archive
+   echoArguments to -whole-archive must be terminated 
by -no-whole-archive
+   exit 1
+   fi
+   WHOLE_ARCHIVE=$WHOLE_ARCHIVE $1
+   shift
+   done
+   ;;
-pthread)
# this is a special case (see bugzilla 10876)
DEPS=$DEPS $1
@@ -271,6 +288,11 @@ if [ $STATIC = 1 ]; then
 OBJECTS=$NEWOBJECTS
 fi
 
+if [ x$WHOLE_ARCHIVE != x ] ; then
+ARCHIVE_TEMP=$(mktemp -d)
+NEW_OBJECTS=`expand_archives ${ARCHIVE_TEMP} ${WHOLE_ARCHIVE}`
+OBJECTS=${OBJECTS} ${NEW_OBJECTS}
+fi
 
 #
 # Error checking
@@ -1010,3 +1032,13 @@ if [ ${INSTALLDIR} != . ] ; then
 mv ${FINAL_BINS} ${INSTALLDIR}/
 fi
 fi
+
+#
+# Clean up temporary directory
+#
+if [ ${ARCHIVE_TEMP} ] ; then
+if [ -d ${ARCHIVE_TEMP} ] ; then
+   echo Removing directory ${ARCHIVE_TEMP}
+   rm -r ${ARCHIVE_TEMP}
+fi
+fi
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 0/4] Miscelaneous buildsystem patches

2011-08-26 Thread Christopher James Halse Rogers
Eric was wondering why the --enable-shared-dricore option also built libglsl.so.
This provided the activation energy to fix it, and also extend dricore to the
gallium drivers.

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


[Mesa-dev] [PATCH 4/4] build: Fix harmless warning when building libdricore.so

2011-08-26 Thread Christopher James Halse Rogers
Fixes warning:
mv: `../../lib/libdricore.so' and `../../lib/libdricore.so' are the same file

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mesa/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 3cfc285..f83ff15 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -112,7 +112,7 @@ libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
 
 # Shared dricore library for classic DRI drivers
 $(TOP)/$(LIB_DIR)/libdricore.so: $(DRICORE_OBJECTS) $(DRICORE_GLSL_LIBS)
-   @$(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+   @$(MKLIB) -o $(notdir $@) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
-cplusplus -noprefix \
-install $(TOP)/$(LIB_DIR) -id 
$(DRI_DRIVER_INSTALL_DIR)/$@.dylib \
-whole-archive $(DRICORE_GLSL_LIBS) -no-whole-archive \
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 2/4] build: Use new -whole-archive support to fold libglsl.so into libdricore.so

2011-08-26 Thread Christopher James Halse Rogers
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 configs/autoconf.in  |2 +-
 configure.ac |   10 --
 src/glsl/Makefile|9 +++--
 src/mesa/Makefile|3 ++-
 src/mesa/sources.mak |2 ++
 5 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 37b7ea5..406e339 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -118,7 +118,7 @@ GALLIUM_DRIVERS = $(foreach 
DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drive
 
 # Driver specific build vars
 DRI_DIRS = @DRI_DIRS@
-DRICORE_GLSL_LIBS = @DRICORE_GLSL_LIBS@
+BUILD_DRICORE_GLSL_LIBS = @BUILD_DRICORE_GLSL_LIBS@
 DRICORE_LIBS = @DRICORE_LIBS@
 DRICORE_LIB_DEPS = @DRICORE_LIB_DEPS@
 EGL_PLATFORMS = @EGL_PLATFORMS@
diff --git a/configure.ac b/configure.ac
index ea58dae..8033f47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1050,19 +1050,17 @@ if test x$enable_dri = xyes ; then
 AC_MSG_WARN([Shared dricore requires GCC-compatible rpath handling.  
Disabling shared dricore])
 enable_dricore=no
   else
-DRICORE_GLSL_LIBS='$(TOP)/$(LIB_DIR)/libglsl.so'
+BUILD_DRICORE_GLSL_LIBS='libglslcore.a'
 DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
-DRICORE_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) 
-lglsl'
-DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) 
-ldricore -lglsl'
+DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) 
-ldricore'
 DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
 DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
-MESA_MODULES='$(DRICORE_LIBS) $(DRICORE_GLSL_LIBS)'
+MESA_MODULES='$(DRICORE_LIBS)'
   fi
fi
 fi
+AC_SUBST([BUILD_DRICORE_GLSL_LIBS])
 AC_SUBST([DRICORE_LIBS])
-AC_SUBST([DRICORE_GLSL_LIBS])
-AC_SUBST([DRICORE_LIB_DEPS])
 AC_SUBST([DRI_CXXFLAGS])
 AC_SUBST([DRI_CFLAGS])
 AC_SUBST([MESA_MODULES])
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index c20a6c9..1fa6dc4 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -149,13 +149,10 @@ ALL_SOURCES = \
 
 # TARGETS #
 
-default: depend lib$(LIBNAME).a $(APPS) $(DRICORE_GLSL_LIBS)
+default: depend lib$(LIBNAME).a $(APPS) $(BUILD_DRICORE_GLSL_LIBS)
 
-$(TOP)/$(LIB_DIR)/libglsl.so: $(OBJECTS_DRICORE) builtin_function.o Makefile 
$(TOP)/src/glsl/Makefile.template
-   $(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
-   -cplusplus -noprefix \
-   -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/$@.dylib \
-   $(OBJECTS_DRICORE) builtin_function.o
+libglslcore.a: $(OBJECTS_DRICORE) builtin_function.o Makefile 
$(TOP)/src/glsl/Makefile.template
+   $(MKLIB) -cplusplus -o glslcore -static $(OBJECTS_DRICORE) 
builtin_function.o
 
 lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile 
$(TOP)/src/glsl/Makefile.template
$(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 0e15d61..95f3506 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -111,7 +111,8 @@ $(TOP)/$(LIB_DIR)/libdricore.so: $(DRICORE_OBJECTS) 
$(DRICORE_GLSL_LIBS)
@$(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
-cplusplus -noprefix \
-install $(TOP)/$(LIB_DIR) -id 
$(DRI_DRIVER_INSTALL_DIR)/$@.dylib \
-   $(DRICORE_LIB_DEPS) $(DRICORE_OBJECTS)
+   -whole-archive $(DRICORE_GLSL_LIBS) -no-whole-archive \
+   $(DRICORE_OBJECTS)
 
 # Make archive of subset of core mesa object files for gallium
 libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index 5e77e0f..b6252be 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -369,6 +369,8 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o)
 GLSL_LIBS = \
$(TOP)/src/glsl/libglsl.a
 
+DRICORE_GLSL_LIBS = \
+   $(TOP)/src/glsl/libglslcore.a
 
 ### Include directories
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 3/4] build: Factor out common gallium code into libgallium.so mirroring libdricore.

2011-08-26 Thread Christopher James Halse Rogers
This is enabled iff libdricore is enabled.

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---

This could also be folded into libdricore, if that's considered more 
appropriate.

 configs/autoconf.in  |3 +++
 configure.ac |8 +++-
 src/gallium/Makefile.template|   10 +-
 src/gallium/auxiliary/Makefile   |9 +
 src/gallium/targets/Makefile.dri |9 +
 src/mesa/Makefile|   10 +-
 6 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 406e339..271d4a0 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -121,6 +121,9 @@ DRI_DIRS = @DRI_DIRS@
 BUILD_DRICORE_GLSL_LIBS = @BUILD_DRICORE_GLSL_LIBS@
 DRICORE_LIBS = @DRICORE_LIBS@
 DRICORE_LIB_DEPS = @DRICORE_LIB_DEPS@
+BUILD_GALLIUMCORE_LIBS = @BUILD_GALLIUMCORE_LIBS@
+GALLIUM_LIBS = @GALLIUM_LIBS@
+GALLIUM_LIB_DEPS = @GALLIUM_LIB_DEPS@
 EGL_PLATFORMS = @EGL_PLATFORMS@
 EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
 
diff --git a/configure.ac b/configure.ac
index 8033f47..812bc8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1032,12 +1032,12 @@ AC_SUBST([GLESv2_PC_LIB_PRIV])
 GLAPI_LIB_DEPS=-lpthread
 AC_SUBST([GLAPI_LIB_DEPS])
 
-
 dnl Setup default DRI CFLAGS
 DRI_CFLAGS='$(CFLAGS)'
 DRI_CXXFLAGS='$(CXXFLAGS)'
 DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
 MESA_MODULES='$(TOP)/src/mesa/libmesa.a'
+GALLIUM_LIB_DEPS='$(TOP)/src/mesa/libmesagallium.a 
$(TOP)/src/gallium/auxiliary/libgallium.a'
 
 AC_ARG_ENABLE([shared-dricore],
 [AS_HELP_STRING([--enable-shared-dricore],
@@ -1053,6 +1053,9 @@ if test x$enable_dri = xyes ; then
 BUILD_DRICORE_GLSL_LIBS='libglslcore.a'
 DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
 DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) 
-ldricore'
+BUILD_GALLIUMCORE_LIBS='$(TOP)/src/mesa/libgalliumcore.a'
+GALLIUM_LIBS='$(TOP)/$(LIB_DIR)/libgallium.so'
+GALLIUM_LIB_DEPS='-lgallium'
 DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
 DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
 MESA_MODULES='$(DRICORE_LIBS)'
@@ -1061,6 +1064,9 @@ if test x$enable_dri = xyes ; then
 fi
 AC_SUBST([BUILD_DRICORE_GLSL_LIBS])
 AC_SUBST([DRICORE_LIBS])
+AC_SUBST([BUILD_GALLIUMCORE_LIBS])
+AC_SUBST([GALLIUM_LIBS])
+AC_SUBST([GALLIUM_LIB_DEPS])
 AC_SUBST([DRI_CXXFLAGS])
 AC_SUBST([DRI_CFLAGS])
 AC_SUBST([MESA_MODULES])
diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template
index 036c119..3f01d08 100644
--- a/src/gallium/Makefile.template
+++ b/src/gallium/Makefile.template
@@ -30,7 +30,7 @@ endif
 
 # TARGETS #
 
-default: depend lib$(LIBNAME).a $(PROGS)
+default:: depend lib$(LIBNAME).a $(PROGS)
 
 lib$(LIBNAME).a: $(OBJECTS) $(EXTRA_OBJECTS) Makefile 
$(TOP)/src/gallium/Makefile.template
$(MKLIB) -o $(LIBNAME) -static $(OBJECTS) $(EXTRA_OBJECTS)
@@ -58,16 +58,16 @@ install:
 # RULES #
 
 %.s: %.c
-   $(CC) -S $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $ -o $@
+   $(CC) -S $(INCLUDES) $(DRI_CFLAGS) $(LIBRARY_DEFINES) $ -o $@
 
 %.o: %.c
-   $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $ -o $@
+   $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(LIBRARY_DEFINES) $ -o $@
 
 %.o: %.cpp
-   $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $ -o $@
+   $(CXX) -c $(INCLUDES) $(DRI_CXXFLAGS) $(LIBRARY_DEFINES) $ -o $@
 
 %.o: %.S
-   $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES)  $ -o $@
+   $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(LIBRARY_DEFINES)  $ -o $@
 
 
 sinclude depend
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 896c058..e1ddc49 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -18,6 +18,13 @@ endif
 
 include ../Makefile.template
 
+# Shared gallium library for DRI drivers
+$(TOP)/$(LIB_DIR)/libgallium.so: $(OBJECTS) $(EXTRA_OBJECTS)
+   @$(MKLIB) -o $(notdir $@) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+   -cplusplus -noprefix \
+   -install $(TOP)/$(LIB_DIR) -id 
$(DRI_DRIVER_INSTALL_DIR)/$@.dylib \
+   -whole-archive $(BUILD_GALLIUMCORE_LIBS) -no-whole-archive \
+   $(OBJECTS) $(EXTRA_OBJECTS)
 
 indices/u_indices_gen.c: indices/u_indices_gen.py
$(PYTHON2) $  $@
@@ -34,3 +41,5 @@ util/u_format_table.c: util/u_format_table.py 
util/u_format_pack.py util/u_forma
 util/u_half.c: util/u_half.py
$(PYTHON2) util/u_half.py  $@
 # DO NOT DELETE
+
+default:: $(GALLIUM_LIBS)
diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
index 857ebfe..ce72545 100644
--- a/src/gallium/targets/Makefile.dri
+++ b/src/gallium/targets/Makefile.dri
@@ -9,7 +9,6 @@ LDFLAGS += -lstdc++
 endif
 
 MESA_MODULES = \
-   $(TOP)/src/mesa/libmesagallium.a \
$(GALLIUM_AUXILIARIES)
 
 COMMON_GALLIUM_SOURCES = \
@@ -74,12 +73,14 @@ LIBNAME_STAGING

[Mesa-dev] [PATCH resend] glx/dri2: Paper over errors in DRI2Connect when indirect

2011-08-03 Thread Christopher James Halse Rogers
DRI2 will throw BadRequest for this when the client is not local, but
DRI2 is an implementation detail and not something callers should have
to know about.  Silently swallow errors in this case, and just propagate
the failure through DRI2Connect's return code.

Note: This is a candidate for the stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28125
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---

This has been sitting on the list for a while; resending to prod it back into 
attention.

 src/glx/dri2.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 229840d..b1b5013 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -190,6 +190,15 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, 
int *ret_code)
err-minorCode == X_DRI2DestroyDrawable)
return True;
 
+/* If the server is non-local DRI2Connect will raise BadRequest.
+ * Swallow this so that DRI2Connect can signal this in its return code */
+if (err-majorCode == codes-major_opcode 
+err-minorCode == X_DRI2Connect 
+err-errorCode == BadRequest) {
+   *ret_code = False;
+   return True;
+}
+
 return False;
 }
 
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH] Add dependency generation for Mesa and GLSL dricore objects.

2011-07-27 Thread Christopher James Halse Rogers
On Fri, 2011-07-22 at 18:49 -0700, Eric Anholt wrote:
 ---
  src/glsl/Makefile |1 +
  src/mesa/Makefile |5 +++--
  2 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/src/glsl/Makefile b/src/glsl/Makefile
 index 005b51d..c20a6c9 100644
 --- a/src/glsl/Makefile
 +++ b/src/glsl/Makefile
 @@ -164,6 +164,7 @@ depend: $(ALL_SOURCES) Makefile
   rm -f depend
   touch depend
   $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2 /dev/null
 + $(MKDEP) $(MKDEP_OPTIONS) -a -p $(DRICORE_OBJ_DIR)/ $(INCLUDES) 
 $(ALL_SOURCES) 2 /dev/null
  
  # Remove .o and backup files
  clean: clean-dricore
 diff --git a/src/mesa/Makefile b/src/mesa/Makefile
 index a903a26..88f31b6 100644
 --- a/src/mesa/Makefile
 +++ b/src/mesa/Makefile
 @@ -12,11 +12,10 @@ DRICORE_OBJ_DIR := objs-dricore
  include sources.mak
  
  # adjust object dirs
 +DRICORE_OBJECTS := $(addprefix $(DRICORE_OBJ_DIR)/, $(MESA_OBJECTS))
  MESA_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_OBJECTS))
  MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, 
 $(MESA_GALLIUM_OBJECTS))
  
 -DRICORE_OBJECTS := $(addprefix $(DRICORE_OBJ_DIR)/, $(MESA_OBJECTS))
 -
  # define preprocessor flags
  MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
  
 @@ -124,6 +123,8 @@ depend: $(ALL_SOURCES)
   @ touch depend
   @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \
   $(ALL_SOURCES)  /dev/null 2/dev/null
 + @$(MKDEP) $(MKDEP_OPTIONS) -a -p$(DRICORE_OBJ_DIR)/ $(MESA_CPPFLAGS) \
 + $(ALL_SOURCES)  /dev/null 2/dev/null
  
  ##
  # Installation rules

Reviewed-By: Christopher James Halse Rogers
christopher.halse.rog...@canonical.com


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 7.11 release candidate 3

2011-07-26 Thread Christopher James Halse Rogers
I see the tarballs, but there doesn't seem to be a mesa-7.11-rc3 tag in
git and 7.11 branch doesn't seem to have had a version bump commit.

Has someone forgotten to push?


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx/dri2: Paper over errors in DRI2Connect when indirect

2011-06-09 Thread Christopher James Halse Rogers
DRI2 will throw BadRequest for this when the client is not local, but
DRI2 is an implementation detail and not something callers should have
to know about.  Silently swallow errors in this case, and just propagate
the failure through DRI2Connect's return code.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28125
Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---

This seems to have died a quiet death without actually getting applied.
Kristian, was this what you had in mind?

 src/glx/dri2.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index adfd3d1..00adff2 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -180,6 +180,15 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, 
int *ret_code)
err-minorCode == X_DRI2DestroyDrawable)
return True;
 
+/* If the server is non-local DRI2Connect will raise BadRequest.
+ * Swallow this so that DRI2Connect can signal this in its return code */
+if (err-majorCode == codes-major_opcode 
+err-minorCode == X_DRI2Connect 
+err-errorCode == BadRequest) {
+   *ret_code = False;
+   return True;
+}
+
 return False;
 }
 
-- 
1.7.5.3

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


Re: [Mesa-dev] [PATCH 1/4] dispatch: Use general-dynamic TLS model rather than initial-exec.

2011-03-30 Thread Christopher James Halse Rogers
On Wed, 2011-03-30 at 16:21 -0400, Jerome Glisse wrote:
 On Thu, Mar 24, 2011 at 2:32 AM, Christopher James Halse Rogers
 christopher.halse.rog...@canonical.com wrote:
  On Thu, 2011-03-24 at 16:07 +1100, Christopher James Halse Rogers wrote:
  On Wed, 2011-03-23 at 17:48 -0700, Eric Anholt wrote:
   On Thu, 24 Mar 2011 10:33:36 +1100, 
   christopher.halse.rog...@canonical.com wrote:
From: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
   
The initial-exec static TLS model is inappropriate for libraries
that might be dynamically loaded.  Since libGL is dynamically loaded
by any number of projects mesa must instead use the general-dynamic
TLS model.
   
This has apparently always been broken for projects dynamically loading
libGL and libstdc++, but now that libGL links to libstdc++ it's much
more visible.
   
cf: Launchpad bug: https://bugs.launchpad.net/bugs/259219
First part of fix for 
https://bugs.freedesktop.org/show_bug.cgi?id=35268
  
   Looks like someone bisecting through and hitting the first commit would
   get a broken build.  I would think squash 2/4 and 3/4 and move the
   _glapi_tls_Dispatch change to that new commit.  I didn't receive patch
   4/4.
 
  Ah, I see I've got a bounce for 4/4 due to the size; it's regenerating
  the assembly files.  I'll clean this up and send the regeneration patch
  separately.
 
  I've squashed all the commits together; the tls model of the assembly
  dispatch code and the dispatch tables have to match in order for things
  to work.
 
  Since the revised patch is ~300K, I've attached it to bugzilla:
  https://bugs.freedesktop.org/attachment.cgi?id=44777
 
 
 Sorry for replying so late but i think the root issue is somewhere
 else, i can't reproduce the bug here with the example program.

Hm.  What distro/libc/libstdc++/mesa are you using?  I presume you've
checked, but Fedora at least doesn't seem to enable tls on their mesa
builds.

It would be interesting to know what's different :).

  Also
 initial-exec is allowed in dynamic librairy but it should be used
 scarcely and likely the only one allowed to do so would be libGL see
 
 http://www.winehq.org/pipermail/wine-devel/2003-February/014738.html
 

Ah!  I didn't find that when trying to hunt this down, and I *was* a bit
confused by the difference between the TLS ABI as described in Ulrich's
pdf and the code as manifest in glibc's loader.

 That being said, given we use PIC i don't think there is any
 difference in produced code btw initial-exec and global-dynamic (at
 least toy example don't show any).

I'm surprised here - initial-exec and global-dynamic should be
generating different code.  My understanding is that global-dynamic
requires at least one function call, whereas initial-exec should
generate a statically-calculable offset from the TCB (the reason why the
x86 runtime dispatch asm patching works), the address of which should be
stored in a register even in PIC code.

Certainly the object gets different flags; libGL using the initial-exec
model (correctly) has the STATIC_TLS DT_FLAG defined.

We have been seeing these crashes in Ubuntu and Debian and relaxing the
TLS model resolves the crashes.  It's possible that this is caused
somewhere else in the stack, though.  I'll have a further poke.


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] dispatch: Use general-dynamic TLS model rather than initial-exec.

2011-03-24 Thread Christopher James Halse Rogers
On Thu, 2011-03-24 at 16:07 +1100, Christopher James Halse Rogers wrote:
 On Wed, 2011-03-23 at 17:48 -0700, Eric Anholt wrote:
  On Thu, 24 Mar 2011 10:33:36 +1100, christopher.halse.rog...@canonical.com 
  wrote:
   From: Christopher James Halse Rogers 
   christopher.halse.rog...@canonical.com
   
   The initial-exec static TLS model is inappropriate for libraries
   that might be dynamically loaded.  Since libGL is dynamically loaded
   by any number of projects mesa must instead use the general-dynamic
   TLS model.
   
   This has apparently always been broken for projects dynamically loading
   libGL and libstdc++, but now that libGL links to libstdc++ it's much
   more visible.
   
   cf: Launchpad bug: https://bugs.launchpad.net/bugs/259219
   First part of fix for https://bugs.freedesktop.org/show_bug.cgi?id=35268
  
  Looks like someone bisecting through and hitting the first commit would
  get a broken build.  I would think squash 2/4 and 3/4 and move the
  _glapi_tls_Dispatch change to that new commit.  I didn't receive patch
  4/4.
 
 Ah, I see I've got a bounce for 4/4 due to the size; it's regenerating
 the assembly files.  I'll clean this up and send the regeneration patch
 separately.

I've squashed all the commits together; the tls model of the assembly
dispatch code and the dispatch tables have to match in order for things
to work.

Since the revised patch is ~300K, I've attached it to bugzilla:
https://bugs.freedesktop.org/attachment.cgi?id=44777


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] mesa: Optionally build a dricore support library (v3)

2011-02-13 Thread Christopher James Halse Rogers
On Sat, 2011-02-12 at 15:19 +0100, Sedat Dilek wrote:
 Hi,
 
 here on radeon RV250 I can only use swrast DRI driver.
 
 [ Xorg.log ]
 ...
 [  3354.432] (EE) AIGLX error: Calling driver entry point failed
 [  3354.432] (EE) AIGLX: reverting to software rendering
 ...
 
 My autogen-line looks like this:
 
 ./autogen.sh --prefix=/usr --with-driver=dri
 --with-dri-driverdir=/usr/lib/dri --with-dri-drivers=r200
 --disable-gallium --disable-egl --disable-glu --disable-glut
 --disable-glw --enable-shared-dricore --enable-glx-tls --enable-debug
 
 I have attached my Xorg.log and mesa build-log.
 
 I have built ddx and mesa from git against same libdrm, not sure if
 there is some correlations with mesa-pkgs from experimental.
 
 Any ideas why I can't use classic-mesa DRI driver with
 --enable-shared-dricore (normal built mesa works fine, w/o the new
 confgure option)?

That build log looks fine to me.  Could you also give the output of
ldd /usr/lib/dri/r200_dri.so (and ldd /usr/lib/dri/swrast_dri.so as a
control)?

 
 Regards,
 - Sedat -
 
 P.S.:
 
 # LC_ALL=C ls -alt /usr/lib/libGL* /usr/lib/dri/
 lrwxrwxrwx 1 sd   sd10 Feb 12 14:53 /usr/lib/libGL.so - libGL.so.1
 lrwxrwxrwx 1 sd   sd12 Feb 12 14:53 /usr/lib/libGL.so.1 - 
 libGL.so.1.2
 -rwxr-xr-x 1 sd   sd   2243051 Feb 12 14:53 /usr/lib/libGL.so.1.2
 lrwxrwxrwx 1 root root  11 Feb 12 12:14 /usr/lib/libGLU.so - libGLU.so.1
 lrwxrwxrwx 1 root root  20 Feb 12 12:14 /usr/lib/libGLU.so.1 -
 libGLU.so.1.3.071000
 lrwxrwxrwx 1 root root  16 Feb 10 07:43 /usr/lib/libGLEW.so.1.5 -
 libGLEW.so.1.5.8
 -rw-r--r-- 1 root root  347376 Feb  9 08:57 /usr/lib/libGLEW.so.1.5.8
 -rw-r--r-- 1 root root  716106 Feb  8 18:31 /usr/lib/libGLU.a
 -rw-r--r-- 1 root root  454672 Feb  8 18:31 /usr/lib/libGLU.so.1.3.071000
 
 /usr/lib/dri/:
 total 59180
 drwxr-xr-x 147 root root81920 Feb 12 14:58 ..
 -rwxr-xr-x   1 root root  3006212 Feb 12 14:55 r200_dri.so
 drwxr-xr-x   2 root root 4096 Feb 12 14:55 .
 -rwxr-xr-x   1 root root 11497967 Feb 12 14:55 libdricore.so
 -rwxr-xr-x   1 root root  3151116 Feb 12 14:55 libglsl.so
 -rw-r--r--   1 root root13296 Feb  8 19:58 dummy_drv_video.so
 -rw-r--r--   1 root root  2969132 Feb  8 18:31 r128_dri.so
 -rw-r--r--   1 root root  2977516 Feb  8 18:31 i810_dri.so
 -rw-r--r--   1 root root  3131564 Feb  8 18:31 i915_dri.so
 -rw-r--r--   1 root root  3034832 Feb  8 18:31 mach64_dri.so
 -rw-r--r--   1 root root  3071852 Feb  8 18:31 mga_dri.so
 -rw-r--r--   1 root root  3239560 Feb  8 18:31 r300_dri.so
 -rw-r--r--   1 root root  228 Feb  8 18:31 i965_dri.so
 -rw-r--r--   1 root root  3143964 Feb  8 18:31 r600_dri.so
 -rw-r--r--   1 root root  3099600 Feb  8 18:31 radeon_dri.so
 -rw-r--r--   1 root root  3011696 Feb  8 18:31 savage_dri.so
 -rw-r--r--   1 root root  3037932 Feb  8 18:31 sis_dri.so
 -rw-r--r--   1 root root  3019500 Feb  8 18:31 tdfx_dri.so
 -rw-r--r--   1 root root  2963316 Feb  8 18:31 unichrome_dri.so
 -rw-r--r--   1 root root  2780016 Feb  8 18:31 swrast_dri.so

This directory listing doesn't appear to be the result of your configure
options?  You should have fewer *_dri.so if you just passed
--with-dri-drivers=r200.


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] osmesa: mklib requires arguments before objects

2011-01-23 Thread Christopher James Halse Rogers
Fixes the build when selecting driver=osmesa and building static libraries.
Otherwise, mklib tries to add the ‘-ltalloc’ object to the archive, which
obviously fails.

Clients which statically link to osmesa will need to link to libtalloc also,
as specified in the Libs.private of osmesa.pc.

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

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 src/mesa/drivers/osmesa/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile
index 50dd452..d65128c 100644
--- a/src/mesa/drivers/osmesa/Makefile
+++ b/src/mesa/drivers/osmesa/Makefile
@@ -40,7 +40,7 @@ $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) $(CORE_MESA)
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) -cplusplus $(MKLIB_OPTIONS) \
-id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \
-   $(OSMESA_LIB_DEPS) $(OBJECTS) $(CORE_MESA) $(TALLOC_LIBS)
+   $(OSMESA_LIB_DEPS) $(TALLOC_LIBS) $(OBJECTS) $(CORE_MESA)
 
 
 
-- 
1.7.2.3

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


[Mesa-dev] [PATCH] mesa: Optionally build a dricore support library (v2)

2011-01-23 Thread Christopher James Halse Rogers
This an adds --enable-shared-dricore option to configure.  When enabled,
DRI modules will link against a shared copy of the common mesa routines
rather than statically linking these.

This saves about 30MB on disc with a full complement of classic DRI
drivers.

v2: Only enable with a gcc-compatible compiler that handles rpath
Handle DRI_CFLAGS without filter-out magic
Build shared libraries with the full mklib voodoo
Fix typos

Signed-off-by: Christopher James Halse Rogers 
christopher.halse.rog...@canonical.com
---
 configs/autoconf.in|   14 ++--
 configs/default|3 ++
 configs/freebsd-dri|4 ++-
 configs/linux-dri  |4 ++-
 configs/linux-dri-xcb  |4 ++-
 configs/linux-egl  |4 ++-
 configs/linux-indirect |3 +-
 configure.ac   |   57 +++
 src/glsl/Makefile  |   34 +--
 src/mesa/Makefile  |   52 
 src/mesa/drivers/dri/Makefile.template |   12 +++
 src/mesa/x86/read_rgba_span_x86.S  |8 
 12 files changed, 165 insertions(+), 34 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 6b703cf..7859b47 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -16,10 +16,12 @@ PIC_FLAGS = @PIC_FLAGS@
 DEFINES = @DEFINES@
 API_DEFINES = @API_DEFINES@
 SHARED_GLAPI = @SHARED_GLAPI@
-CFLAGS = @CPPFLAGS@ @CFLAGS@ \
+CFLAGS_NOVISIBILITY = @CPPFLAGS@ @CFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
+CXXFLAGS_NOVISIBILITY = @CPPFLAGS@ @CXXFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
+CFLAGS = $(CFLAGS_NOVISIBILITY) @VISIBILITY_CFLAGS@
+CXXFLAGS = $(CXXFLAGS_NOVISIBILITY) @VISIBILITY_CXXFLAGS@
 LDFLAGS = @LDFLAGS@
 EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
 RADEON_CFLAGS = @RADEON_CFLAGS@
@@ -34,6 +36,8 @@ LLVM_LIBS = @LLVM_LIBS@
 GLW_CFLAGS = @GLW_CFLAGS@
 GLUT_CFLAGS = @GLUT_CFLAGS@
 GLX_TLS = @GLX_TLS@
+DRI_CFLAGS = @DRI_CFLAGS@
+DRI_CXXFLAGS = @DRI_CXXFLAGS@
 
 TALLOC_LIBS = @TALLOC_LIBS@
 TALLOC_CFLAGS = @TALLOC_CFLAGS@
@@ -107,7 +111,10 @@ GALLIUM_AUXILIARIES = 
$(TOP)/src/gallium/auxiliary/libgallium.a
 GALLIUM_DRIVERS = $(foreach 
DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 
 # Driver specific build vars
-DRI_DIRS = @DRI_DIRS@ 
+DRI_DIRS = @DRI_DIRS@
+DRICORE_GLSL_LIBS = @DRICORE_GLSL_LIBS@
+DRICORE_LIBS = @DRICORE_LIBS@
+DRICORE_LIB_DEPS = @DRICORE_LIB_DEPS@
 EGL_PLATFORMS = @EGL_PLATFORMS@
 EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
 
@@ -136,6 +143,7 @@ VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
 GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@
 
 # DRI dependencies
+MESA_MODULES = @MESA_MODULES@
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
 LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
 LIBDRM_LIB = @LIBDRM_LIBS@
diff --git a/configs/default b/configs/default
index 9030cf5..0b1bebc 100644
--- a/configs/default
+++ b/configs/default
@@ -89,6 +89,9 @@ GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)*
 TALLOC_LIBS = `pkg-config --libs talloc`
 TALLOC_CFLAGS = `pkg-config --cflags talloc`
 
+DRI_CFLAGS = $(CFLAGS)
+DRI_CXXFLAGS = $(CXXFLAGS)
+
 # Optional assembly language optimization files for libGL
 MESA_ASM_SOURCES = 
 
diff --git a/configs/freebsd-dri b/configs/freebsd-dri
index a4aa82e..23cf58a 100644
--- a/configs/freebsd-dri
+++ b/configs/freebsd-dri
@@ -30,9 +30,11 @@ ASM_SOURCES =
 MESA_ASM_SOURCES = 
 
 # Library/program dependencies
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
 LIBDRM_LIB = `pkg-config --libs libdrm`
-DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
+DRI_LIB_DEPS = $(MESA_MODULES) -L/usr/local/lib -lm -pthread -lexpat 
$(LIBDRM_LIB)
 GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -pthread $(LIBDRM_LIB)
 
diff --git a/configs/linux-dri b/configs/linux-dri
index 64fc407..caf0406 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -43,9 +43,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=-L/usr/X11R6/lib
 
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
 LIBDRM_LIB = $(shell pkg-config --libs libdrm)
-DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl -ltalloc 
$(LIBDRM_LIB)
+DRI_LIB_DEPS  = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl 
-ltalloc $(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
 
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index 8092a04..7518080 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -41,9 +41,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L

Re: [Mesa-dev] [PATCH Resend] mesa: Optionally build a dricore support library.

2010-12-23 Thread Christopher James Halse Rogers
On Tue, 2010-12-21 at 08:58 +, Keith Whitwell wrote:
 This promotes a private interface to a public one, right?  If so that
 isn't really doing us any favours as next people will complain when that
 newly public interface varies between releases.

Not really; the new libraries are private (contained within
$DRI_INSTALL_DIR, so /usr/lib/dri by default) and unversioned.  This is
not significantly different to, say, the shared objects in /usr/lib/egl
which have come and gone without complaint.

This patch does *not* expose any additional interfaces in the public
libGL, GLES, etc libraries.  Where objects need to be built with default
visibility, they're built twice; once with -fvisibility=hidden for the
code destined for the public libraries, once without for the shared,
private libraries.

 
 If you want to save disk space by sharing components, what about an
 alternate approach -- investigate methods for building all the DRI
 drivers into a single binary?  That would keep the internal interface
 private  possibly share more space than this approach.
 
It would indeed save a bit more space, and also apply more easily to the
gallium drivers.  It'd require a much larger patch though - we'd need to
change the libGL←→dri driver interface and patch X to keep up, right?

If that's the direction you'd prefer to go, I could look at doing that.
I think it'd be substantially more invasive, though, and more difficult
to make optional.

 Keith
 
 On Mon, 2010-12-20 at 20:34 -0800, Christopher James Halse Rogers wrote:
  This an adds --enable-shared-dricore option to configure.  When enabled,
  DRI modules will link against a shared copy of the common mesa routines
  rather than statically linking these.
  
  This saves about 30MB on disc with a full complement of classic DRI
  drivers.
  ---
  
  Resending as it seems to have been ignored the first time.
  We've applied this in Ubuntu as we are (as always) scrabbling for
  CD space on the LiveCDs, but Fedora had a similar patch in the dim
  distant past.
  
  This seems to be something that distros generally will be interested
  in.
  
   configs/autoconf.in|8 -
   configs/default|3 ++
   configs/freebsd-dri|4 ++-
   configs/linux-dri  |4 ++-
   configs/linux-dri-xcb  |4 ++-
   configs/linux-egl  |4 ++-
   configs/linux-indirect |3 +-
   configure.ac   |   32 +-
   src/glsl/Makefile  |   20 ++-
   src/mesa/Makefile  |   57 
  +++
   src/mesa/drivers/dri/Makefile.template |   12 +++
   src/mesa/drivers/osmesa/Makefile   |2 +-
   src/mesa/x86/read_rgba_span_x86.S  |8 
   13 files changed, 136 insertions(+), 25 deletions(-)
  
  diff --git a/configs/autoconf.in b/configs/autoconf.in
  index e2d70c6..37a137d 100644
  --- a/configs/autoconf.in
  +++ b/configs/autoconf.in
  @@ -33,6 +33,8 @@ LLVM_LDFLAGS = @LLVM_LDFLAGS@
   LLVM_LIBS = @LLVM_LIBS@
   GLW_CFLAGS = @GLW_CFLAGS@
   GLUT_CFLAGS = @GLUT_CFLAGS@
  +DRI_CFLAGS = @DRI_CFLAGS@
  +DRI_CXXFLAGS = @DRI_CXXFLAGS@
  
   TALLOC_LIBS = @TALLOC_LIBS@
   TALLOC_CFLAGS = @TALLOC_CFLAGS@
  @@ -103,7 +105,10 @@ GALLIUM_AUXILIARIES = 
  $(TOP)/src/gallium/auxiliary/libgallium.a
   GALLIUM_DRIVERS = $(foreach 
  DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
  
   # Driver specific build vars
  -DRI_DIRS = @DRI_DIRS@
  +DRI_DIRS = @DRI_DIRS@
  +DRICORE_GLSL_LIBS = @DRICORE_GLSL_LIBS@
  +DRICORE_LIBS = @DRICORE_LIBS@
  +DRICORE_LIB_DEPS = @DRICORE_LIB_DEPS@
   EGL_PLATFORMS = @EGL_PLATFORMS@
   EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
  
  @@ -131,6 +136,7 @@ GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
   VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
  
   # DRI dependencies
  +MESA_MODULES = @MESA_MODULES@
   DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
   LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
   LIBDRM_LIB = @LIBDRM_LIBS@
  diff --git a/configs/default b/configs/default
  index 0301345..1feeb97 100644
  --- a/configs/default
  +++ b/configs/default
  @@ -85,6 +85,9 @@ VG_LIB_GLOB = $(VG_LIB_NAME)*
   TALLOC_LIBS = `pkg-config --libs talloc`
   TALLOC_CFLAGS = `pkg-config --cflags talloc`
  
  +DRI_CFLAGS = $(CFLAGS)
  +DRI_CXXFLAGS = $(CXXFLAGS)
  +
   # Optional assembly language optimization files for libGL
   MESA_ASM_SOURCES =
  
  diff --git a/configs/freebsd-dri b/configs/freebsd-dri
  index a4aa82e..23cf58a 100644
  --- a/configs/freebsd-dri
  +++ b/configs/freebsd-dri
  @@ -30,9 +30,11 @@ ASM_SOURCES =
   MESA_ASM_SOURCES =
  
   # Library/program dependencies
  +MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
  +
   LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
   LIBDRM_LIB = `pkg-config --libs libdrm`
  -DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
  +DRI_LIB_DEPS

[Mesa-dev] [PATCH Resend] mesa: Optionally build a dricore support library.

2010-12-20 Thread Christopher James Halse Rogers
This an adds --enable-shared-dricore option to configure.  When enabled,
DRI modules will link against a shared copy of the common mesa routines
rather than statically linking these.

This saves about 30MB on disc with a full complement of classic DRI
drivers.
---

Resending as it seems to have been ignored the first time.
We've applied this in Ubuntu as we are (as always) scrabbling for
CD space on the LiveCDs, but Fedora had a similar patch in the dim
distant past.

This seems to be something that distros generally will be interested
in.

 configs/autoconf.in|8 -
 configs/default|3 ++
 configs/freebsd-dri|4 ++-
 configs/linux-dri  |4 ++-
 configs/linux-dri-xcb  |4 ++-
 configs/linux-egl  |4 ++-
 configs/linux-indirect |3 +-
 configure.ac   |   32 +-
 src/glsl/Makefile  |   20 ++-
 src/mesa/Makefile  |   57 +++
 src/mesa/drivers/dri/Makefile.template |   12 +++
 src/mesa/drivers/osmesa/Makefile   |2 +-
 src/mesa/x86/read_rgba_span_x86.S  |8 
 13 files changed, 136 insertions(+), 25 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index e2d70c6..37a137d 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -33,6 +33,8 @@ LLVM_LDFLAGS = @LLVM_LDFLAGS@
 LLVM_LIBS = @LLVM_LIBS@
 GLW_CFLAGS = @GLW_CFLAGS@
 GLUT_CFLAGS = @GLUT_CFLAGS@
+DRI_CFLAGS = @DRI_CFLAGS@
+DRI_CXXFLAGS = @DRI_CXXFLAGS@
 
 TALLOC_LIBS = @TALLOC_LIBS@
 TALLOC_CFLAGS = @TALLOC_CFLAGS@
@@ -103,7 +105,10 @@ GALLIUM_AUXILIARIES = 
$(TOP)/src/gallium/auxiliary/libgallium.a
 GALLIUM_DRIVERS = $(foreach 
DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 
 # Driver specific build vars
-DRI_DIRS = @DRI_DIRS@ 
+DRI_DIRS = @DRI_DIRS@
+DRICORE_GLSL_LIBS = @DRICORE_GLSL_LIBS@
+DRICORE_LIBS = @DRICORE_LIBS@
+DRICORE_LIB_DEPS = @DRICORE_LIB_DEPS@
 EGL_PLATFORMS = @EGL_PLATFORMS@
 EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
 
@@ -131,6 +136,7 @@ GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
 VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
 
 # DRI dependencies
+MESA_MODULES = @MESA_MODULES@
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
 LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
 LIBDRM_LIB = @LIBDRM_LIBS@
diff --git a/configs/default b/configs/default
index 0301345..1feeb97 100644
--- a/configs/default
+++ b/configs/default
@@ -85,6 +85,9 @@ VG_LIB_GLOB = $(VG_LIB_NAME)*
 TALLOC_LIBS = `pkg-config --libs talloc`
 TALLOC_CFLAGS = `pkg-config --cflags talloc`
 
+DRI_CFLAGS = $(CFLAGS)
+DRI_CXXFLAGS = $(CXXFLAGS)
+
 # Optional assembly language optimization files for libGL
 MESA_ASM_SOURCES = 
 
diff --git a/configs/freebsd-dri b/configs/freebsd-dri
index a4aa82e..23cf58a 100644
--- a/configs/freebsd-dri
+++ b/configs/freebsd-dri
@@ -30,9 +30,11 @@ ASM_SOURCES =
 MESA_ASM_SOURCES = 
 
 # Library/program dependencies
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
 LIBDRM_LIB = `pkg-config --libs libdrm`
-DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
+DRI_LIB_DEPS = $(MESA_MODULES) -L/usr/local/lib -lm -pthread -lexpat 
$(LIBDRM_LIB)
 GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -pthread $(LIBDRM_LIB)
 
diff --git a/configs/linux-dri b/configs/linux-dri
index 64fc407..caf0406 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -43,9 +43,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=-L/usr/X11R6/lib
 
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
 LIBDRM_LIB = $(shell pkg-config --libs libdrm)
-DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl -ltalloc 
$(LIBDRM_LIB)
+DRI_LIB_DEPS  = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl 
-ltalloc $(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
 
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index 8092a04..7518080 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -41,9 +41,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11)
 
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
 LIBDRM_LIB = $(shell pkg-config --libs libdrm)
-DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
+DRI_LIB_DEPS  = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl 
$(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
 $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell 
pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx)
 
diff --git a/configs/linux-egl 

[Mesa-dev] [PATCH] mesa: Optionally build a dricore support library.

2010-12-09 Thread Christopher James Halse Rogers
This an adds --enable-shared-dricore option to configure.  When enabled,
DRI modules will link against a shared copy of the common mesa routines
rather than statically linking these.

This saves about 30MB on disc with a full complement of classic DRI
drivers.
---
 configs/autoconf.in|8 -
 configs/default|3 ++
 configs/freebsd-dri|4 ++-
 configs/linux-dri  |4 ++-
 configs/linux-dri-xcb  |4 ++-
 configs/linux-egl  |4 ++-
 configs/linux-indirect |3 +-
 configure.ac   |   32 +-
 src/glsl/Makefile  |   20 ++-
 src/mesa/Makefile  |   57 +++
 src/mesa/drivers/dri/Makefile.template |   12 +++
 src/mesa/drivers/osmesa/Makefile   |2 +-
 src/mesa/x86/read_rgba_span_x86.S  |8 
 13 files changed, 136 insertions(+), 25 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index e2d70c6..37a137d 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -33,6 +33,8 @@ LLVM_LDFLAGS = @LLVM_LDFLAGS@
 LLVM_LIBS = @LLVM_LIBS@
 GLW_CFLAGS = @GLW_CFLAGS@
 GLUT_CFLAGS = @GLUT_CFLAGS@
+DRI_CFLAGS = @DRI_CFLAGS@
+DRI_CXXFLAGS = @DRI_CXXFLAGS@
 
 TALLOC_LIBS = @TALLOC_LIBS@
 TALLOC_CFLAGS = @TALLOC_CFLAGS@
@@ -103,7 +105,10 @@ GALLIUM_AUXILIARIES = 
$(TOP)/src/gallium/auxiliary/libgallium.a
 GALLIUM_DRIVERS = $(foreach 
DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 
 # Driver specific build vars
-DRI_DIRS = @DRI_DIRS@ 
+DRI_DIRS = @DRI_DIRS@
+DRICORE_GLSL_LIBS = @DRICORE_GLSL_LIBS@
+DRICORE_LIBS = @DRICORE_LIBS@
+DRICORE_LIB_DEPS = @DRICORE_LIB_DEPS@
 EGL_PLATFORMS = @EGL_PLATFORMS@
 EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
 
@@ -131,6 +136,7 @@ GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
 VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
 
 # DRI dependencies
+MESA_MODULES = @MESA_MODULES@
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
 LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
 LIBDRM_LIB = @LIBDRM_LIBS@
diff --git a/configs/default b/configs/default
index 0301345..1feeb97 100644
--- a/configs/default
+++ b/configs/default
@@ -85,6 +85,9 @@ VG_LIB_GLOB = $(VG_LIB_NAME)*
 TALLOC_LIBS = `pkg-config --libs talloc`
 TALLOC_CFLAGS = `pkg-config --cflags talloc`
 
+DRI_CFLAGS = $(CFLAGS)
+DRI_CXXFLAGS = $(CXXFLAGS)
+
 # Optional assembly language optimization files for libGL
 MESA_ASM_SOURCES = 
 
diff --git a/configs/freebsd-dri b/configs/freebsd-dri
index a4aa82e..23cf58a 100644
--- a/configs/freebsd-dri
+++ b/configs/freebsd-dri
@@ -30,9 +30,11 @@ ASM_SOURCES =
 MESA_ASM_SOURCES = 
 
 # Library/program dependencies
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
 LIBDRM_LIB = `pkg-config --libs libdrm`
-DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
+DRI_LIB_DEPS = $(MESA_MODULES) -L/usr/local/lib -lm -pthread -lexpat 
$(LIBDRM_LIB)
 GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -pthread $(LIBDRM_LIB)
 
diff --git a/configs/linux-dri b/configs/linux-dri
index 64fc407..caf0406 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -43,9 +43,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=-L/usr/X11R6/lib
 
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
 LIBDRM_LIB = $(shell pkg-config --libs libdrm)
-DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl -ltalloc 
$(LIBDRM_LIB)
+DRI_LIB_DEPS  = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl 
-ltalloc $(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
 
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index 8092a04..7518080 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -41,9 +41,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11)
 
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
 LIBDRM_LIB = $(shell pkg-config --libs libdrm)
-DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
+DRI_LIB_DEPS  = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl 
$(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
 $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell 
pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx)
 
diff --git a/configs/linux-egl b/configs/linux-egl
index 6393e94..216bcba 100644
--- a/configs/linux-egl
+++ b/configs/linux-egl
@@ -38,9 +38,11 @@ MESA_ASM_SOURCES =
 # Library/program dependencies
 EXTRA_LIB_PATH=-L/usr/X11R6/lib
 
+MESA_MODULES  = $(TOP)/src/mesa/libmesa.a
+
 LIBDRM_CFLAGS = $(shell pkg-config