open-src/lib/mesa/solaris-port.patch
changeset 705 24ca414edbff
parent 606 068c11b419c9
child 919 425233ae7236
--- a/open-src/lib/mesa/solaris-port.patch	Thu May 14 20:00:54 2009 -0700
+++ b/open-src/lib/mesa/solaris-port.patch	Fri May 15 09:36:46 2009 -0700
@@ -1,6 +1,38 @@
---- src/glx/x11/Makefile	2008-09-13 13:25:44.000000000 -0700
-+++ src/glx/x11/Makefile	2008-10-03 07:51:04.249576000 -0700
-@@ -66,6 +66,10 @@
+###############################################################################
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use subject to license terms.
+#
+# 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, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+# 
+# 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
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+# 
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+diff -urp -x '*~' -x '*.orig' src/glx/x11/Makefile src/glx/x11/Makefile
+--- src/glx/x11/Makefile	2009-03-12 20:28:49.000000000 -0700
++++ src/glx/x11/Makefile	2009-03-31 09:12:45.627261000 -0700
+@@ -69,6 +69,10 @@ INCLUDES = -I. \
  
  default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
  
@@ -11,9 +43,9 @@
  # Make libGL
  $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME):  $(OBJECTS) Makefile
  	$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-
---- src/mesa/drivers/dri/Makefile.template	2008-08-25 07:49:40.000000000 -0700
-+++ src/mesa/drivers/dri/Makefile.template	2008-10-03 10:53:42.854207000 -0700
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/Makefile.template src/mesa/drivers/dri/Makefile.template
+--- src/mesa/drivers/dri/Makefile.template	2009-03-12 20:28:49.000000000 -0700
++++ src/mesa/drivers/dri/Makefile.template	2009-03-31 09:12:45.628778000 -0700
 @@ -1,5 +1,10 @@
  # -*-makefile-*-
  
@@ -25,10 +57,82 @@
  MESA_MODULES = $(TOP)/src/mesa/libmesa.a
  
  COMMON_SOURCES = \
-
---- src/mesa/drivers/dri/intel/intel_context.c	Tue Sep 30 10:14:35 2008
-+++ src/mesa/drivers/dri/intel/intel_context.c	Tue Sep 30 10:29:38 2008
-@@ -69,6 +69,11 @@
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/common/dri_util.h src/mesa/drivers/dri/common/dri_util.h
+--- src/mesa/drivers/dri/common/dri_util.h	2009-03-12 20:28:49.000000000 -0700
++++ src/mesa/drivers/dri/common/dri_util.h	2009-03-31 09:12:45.637799000 -0700
+@@ -59,6 +59,10 @@
+ 
+ #define GLX_BAD_CONTEXT                    5
+ 
++#define u_int64_t uint64_t
++#define u_int32_t uint32_t
++#define u_int8_t uint8_t
++
+ typedef struct __DRIswapInfoRec        __DRIswapInfo;
+ 
+ /* Typedefs to avoid rewriting the world. */
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/common/mmio.h src/mesa/drivers/dri/common/mmio.h
+--- src/mesa/drivers/dri/common/mmio.h	2009-01-22 09:38:33.000000000 -0800
++++ src/mesa/drivers/dri/common/mmio.h	2009-03-31 09:12:45.639560000 -0700
+@@ -34,6 +34,7 @@
+ #define MMIO_H
+ 
+ #include "main/glheader.h"
++#include "dri_util.h"
+ 
+ #if defined( __powerpc__ )
+ 
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/i915/intel_tris.c src/mesa/drivers/dri/i915/intel_tris.c
+--- src/mesa/drivers/dri/i915/intel_tris.c	2009-03-17 07:48:46.000000000 -0700
++++ src/mesa/drivers/dri/i915/intel_tris.c	2009-03-31 09:12:45.639052000 -0700
+@@ -329,7 +329,7 @@ void intel_finish_vb(struct intel_contex
+  *                    Emit primitives as inline vertices               *
+  ***********************************************************************/
+ 
+-#ifdef __i386__
++#if (defined(i386) || defined(__i386__)) && !(defined(__SOLARIS__) || defined(sun))
+ #define COPY_DWORDS( j, vb, vertsize, v )			\
+ do {								\
+    int __tmp;							\
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/i965/brw_draw_upload.c src/mesa/drivers/dri/i965/brw_draw_upload.c
+--- src/mesa/drivers/dri/i965/brw_draw_upload.c	2009-03-12 20:28:49.000000000 -0700
++++ src/mesa/drivers/dri/i965/brw_draw_upload.c	2009-03-31 09:12:45.643357000 -0700
+@@ -26,6 +26,7 @@
+  **************************************************************************/
+ 
+ #include <stdlib.h>
++#include <string.h>
+ 
+ #include "main/glheader.h"
+ #include "main/context.h"
+@@ -155,6 +156,23 @@ static GLuint byte_types_scale[5] = {
+    BRW_SURFACEFORMAT_R8G8B8A8_SSCALED
+ };
+ 
++#if defined (sun)
++/* Solaris does not have ffsll in libc */
++#define        NBITS_INT       (CHAR_BIT * sizeof (int))
++static int ffsll(long long i)
++{
++	int i1;
++	int ret;
++
++	i1 = i & UINT_MAX;
++	ret = ffs(i1);
++	if (ret == 0) {
++		i1 = (i & 0xffffffff00000000) >> NBITS_INT;
++		ret = ffs(i1) + NBITS_INT;
++	}
++	return ret;
++}
++#endif
+ 
+ static GLuint get_surface_type( GLenum type, GLuint size, GLboolean normalized )
+ {
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/intel/intel_context.c src/mesa/drivers/dri/intel/intel_context.c
+--- src/mesa/drivers/dri/intel/intel_context.c	2009-03-27 17:56:14.000000000 -0700
++++ src/mesa/drivers/dri/intel/intel_context.c	2009-03-31 09:12:45.630903000 -0700
+@@ -70,6 +70,11 @@
  int INTEL_DEBUG = (0);
  #endif
  
@@ -37,19 +141,10 @@
 +extern void _sigon(void);
 +#endif
 +
- #define need_GL_NV_point_sprite
  #define need_GL_ARB_multisample
+ #define need_GL_ARB_occlusion_query
  #define need_GL_ARB_point_parameters
-@@ -867,7 +872,7 @@
-    intel->locked = 1;
- 
-    if (INTEL_DEBUG & DEBUG_LOCK)
--      _mesa_printf("%s - got contended lock\n", __progname);
-+      _mesa_printf("%s - got contended lock\n", __FUNCTION__);
- 
-    /* If the window moved, may need to set a new cliprect now.
-     *
-@@ -966,6 +971,9 @@
+@@ -993,6 +998,9 @@ void LOCK_HARDWARE( struct intel_context
  				    intel_fb->Base._ColorDrawBufferIndexes[0]);
      }
  
@@ -59,56 +154,65 @@
      if (intel_rb && dPriv->vblFlags &&
  	!(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) &&
  	(intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) {
-@@ -981,6 +989,7 @@
+@@ -1008,6 +1016,7 @@ void LOCK_HARDWARE( struct intel_context
  	drmWaitVBlank(intel->driFd, &vbl);
  	intel_fb->vbl_waited = vbl.reply.sequence;
      }
 +#endif
  
-     DRM_CAS(intel->driHwLock, intel->hHWContext,
-         (DRM_LOCK_HELD|intel->hHWContext), __ret);
-@@ -998,7 +1007,7 @@
- 
- 
-     if (INTEL_DEBUG & DEBUG_LOCK)
--      _mesa_printf("%s - locked\n", __progname);
-+      _mesa_printf("%s - locked\n", __FUNCTION__);
- }
- 
- 
-@@ -1014,7 +1023,7 @@
-    _glthread_UNLOCK_MUTEX(lockMutex);
- 
-    if (INTEL_DEBUG & DEBUG_LOCK)
--      _mesa_printf("%s - unlocked\n", __progname);
-+      _mesa_printf("%s - unlocked\n", __FUNCTION__);
- 
-    /**
-     * Nothing should be left in batch outside of LOCK/UNLOCK which references
-@@ -1021,5 +1030,9 @@
-     * cliprects.
+     if (!sPriv->dri2.enabled) {
+ 	DRM_CAS(intel->driHwLock, intel->hHWContext,
+@@ -1046,5 +1055,9 @@ void UNLOCK_HARDWARE( struct intel_conte
      */
-    assert(intel->batch->cliprect_mode != REFERENCES_CLIPRECTS);
+    if (intel->batch->cliprect_mode == REFERENCES_CLIPRECTS)
+       intel_batchbuffer_flush(intel->batch);
 +
 +#if defined(sun)
 +   _sigon();
 +#endif
  }
  
---- src/mesa/drivers/dri/intel/intel_screen.c	Tue Sep 30 10:38:08 2008
-+++ src/mesa/drivers/dri/intel/intel_screen.c	Tue Sep 30 10:41:06 2008
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/intel/intel_context.h src/mesa/drivers/dri/intel/intel_context.h
+--- src/mesa/drivers/dri/intel/intel_context.h	2009-03-27 17:56:14.000000000 -0700
++++ src/mesa/drivers/dri/intel/intel_context.h	2009-03-31 09:12:45.655815000 -0700
+@@ -309,8 +309,12 @@
+ void LOCK_HARDWARE( struct intel_context *intel );
+ void UNLOCK_HARDWARE( struct intel_context *intel );
+ 
++#if defined(__sun)
++#    include <stdlib.h>
++#    define __progname getexecname()
++#else
+ extern char *__progname;
+-
++#endif
+ 
+ #define SUBPIXEL_X 0.125
+ #define SUBPIXEL_Y 0.125
+@@ -352,7 +352,7 @@ do {						\
+  * than COPY_DWORDS would:
+  * XXX Put this in src/mesa/main/imports.h ???
+  */
+-#if defined(i386) || defined(__i386__)
++#if (defined(i386) || defined(__i386__)) && !(defined(__SOLARIS__) || defined(sun))
+ static INLINE void * __memcpy(void * to, const void * from, size_t n)
+ {
+    int d0, d1, d2;
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/intel/intel_screen.c src/mesa/drivers/dri/intel/intel_screen.c
+--- src/mesa/drivers/dri/intel/intel_screen.c	2009-03-17 07:48:46.000000000 -0700
++++ src/mesa/drivers/dri/intel/intel_screen.c	2009-03-31 09:12:45.636871000 -0700
 @@ -25,6 +25,8 @@
   * 
   **************************************************************************/
  
 +#include <unistd.h>
 +#include <signal.h>
- #include "glheader.h"
- #include "context.h"
- #include "framebuffer.h"
+ #include "main/glheader.h"
+ #include "main/context.h"
+ #include "main/framebuffer.h"
 @@ -51,6 +53,15 @@
  #include "intel_batchbuffer.h"
- #include "intel_bufmgr_ttm.h"
+ #include "intel_bufmgr.h"
  
 +static void stop_handler(int sig)
 +{
@@ -122,7 +226,7 @@
  PUBLIC const char __driConfigOptions[] =
     DRI_CONF_BEGIN
     DRI_CONF_SECTION_PERFORMANCE
-@@ -488,6 +499,12 @@
+@@ -292,6 +303,12 @@ static GLboolean intelInitDriver(__DRIsc
  
     sPriv->extensions = intelScreenExtensions;
  
@@ -135,113 +239,10 @@
     return GL_TRUE;
  }
  
---- src/mesa/drivers/dri/common/dri_util.h	Wed Sep 24 13:38:44 2008
-+++ src/mesa/drivers/dri/common/dri_util.h	Wed Sep 24 13:39:06 2008
-@@ -60,6 +60,10 @@
- 
- #define GLX_BAD_CONTEXT                    5
- 
-+#define u_int64_t uint64_t
-+#define u_int32_t uint32_t
-+#define u_int8_t uint8_t
-+
- typedef struct __DRIswapInfoRec        __DRIswapInfo;
- 
- /* Typedefs to avoid rewriting the world. */
---- src/mesa/drivers/dri/i915/intel_tris.c	Mon Aug 25 07:49:40 2008
-+++ src/mesa/drivers/dri/i915/intel_tris.c	Wed Sep 24 13:53:25 2008
-@@ -156,7 +156,7 @@
-  *                    Emit primitives as inline vertices               *
-  ***********************************************************************/
- 
--#ifdef __i386__
-+#if (defined(i386) || defined(__i386__)) && !(defined(__SOLARIS__) || defined(sun))
- #define COPY_DWORDS( j, vb, vertsize, v )			\
- do {								\
-    int __tmp;							\
-224c224
---- src/mesa/drivers/dri/common/mio.h	Wed Sep 24 14:04:29 2008
-+++ src/mesa/drivers/dri/common/mmio.h	Wed Sep 24 14:04:45 2008
-@@ -34,6 +34,7 @@
- #define MMIO_H
- 
- #include "glheader.h"
-+#include "dri_util.h"
- 
- #if defined( __powerpc__ )
- 
---- src/mesa/drivers/dri/radeon/server/radeon_dri.h	Wed Sep 24 14:05:24 2008
-+++ src/mesa/drivers/dri/radeon/server/radeon_dri.h	Wed Sep 24 14:06:48 2008
-@@ -90,6 +90,7 @@
-     /*@{*/
-     drm_handle_t     registerHandle; /**< \brief MMIO register map size */
-     drmSize       registerSize;   /**< \brief MMIO register map handle */
-+    int      	  padding0;
-     /*@}*/
- 
-     /**
-@@ -98,6 +99,7 @@
-     /*@{*/
-     drm_handle_t     statusHandle;   /**< \brief status map handle */
-     drmSize       statusSize;     /**< \brief status map size */
-+    int		  padding1;
-     /*@}*/
- 
-     /**
-@@ -106,11 +108,13 @@
-     /*@{*/
-     drm_handle_t     gartTexHandle;   /**< \brief AGP texture area map handle */
-     drmSize       gartTexMapSize;  /**< \brief AGP texture area map size */
-+    int 	  padding2;
-     int           log2GARTTexGran; /**< \brief AGP texture granularity in log base 2 */
-     int           gartTexOffset;   /**< \brief AGP texture area offset in AGP space */
-     /*@}*/
- 
-     unsigned int  sarea_priv_offset; /**< \brief offset of the private SAREA data*/
-+    int		  padding3;
- } RADEONDRIRec, *RADEONDRIPtr;
- 
- #endif
-
---- src/mesa/drivers/dri/i965/brw_draw_upload.c	Wed Sep 24 14:14:46 2008
-+++ src/mesa/drivers/dri/i965/brw_draw_upload.c	Wed Sep 24 14:16:22 2008
-@@ -26,6 +26,7 @@
-  **************************************************************************/
- 
- #include <stdlib.h>
-+#include <string.h>
- 
- #include "glheader.h"
- #include "context.h"
-@@ -156,7 +157,24 @@
-    BRW_SURFACEFORMAT_R8G8B8A8_SSCALED
- };
- 
-+#if defined (sun)
-+/* Solaris does not have ffsll in libc */
-+#define        NBITS_INT       (CHAR_BIT * sizeof (int))
-+static int ffsll(long long i)
-+{
-+      int i1;
-+       int ret;
- 
-+       i1 = i & UINT_MAX;
-+       ret = ffs(i1);
-+      if (ret == 0) {
-+               i1 = (i & 0xffffffff00000000) >> NBITS_INT;
-+               ret = ffs(i1) + NBITS_INT;
-+       }
-+       return ret;
-+}
-+#endif
-+
- static GLuint get_surface_type( GLenum type, GLuint size, GLboolean normalized )
- {
-    if (INTEL_DEBUG & DEBUG_VERTS)
-
---- src/mesa/drivers/dri/intel/server/i830_dri.h	Tue Sep 30 09:13:02 2008
-+++ src/mesa/drivers/dri/intel/server/i830_dri.h	Tue Sep 30 09:15:40 2008
-@@ -21,16 +21,20 @@
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/intel/server/i830_dri.h src/mesa/drivers/dri/intel/server/i830_dri.h
+--- src/mesa/drivers/dri/intel/server/i830_dri.h	2008-08-25 07:46:43.000000000 -0700
++++ src/mesa/drivers/dri/intel/server/i830_dri.h	2009-03-31 09:12:45.654900000 -0700
+@@ -21,16 +21,20 @@ typedef struct _I830DRIRec {
     drm_handle_t unused2; /* backbuffer */
  
     drmSize unused3; /* depthbufferSize */
@@ -262,26 +263,36 @@
  
     int deviceID;
     int width;
---- src/mesa/drivers/dri/intel/intel_buffers.c	Tue Sep 30 10:54:45 2008
-+++ src/mesa/drivers/dri/intel/intel_buffers.c	Tue Sep 30 10:55:09 2008
-@@ -224,7 +224,7 @@
- 
-    if (INTEL_DEBUG & DEBUG_LOCK)
-       if (pf_active != intel_fb->pf_active)
--	 _mesa_printf("%s - Page flipping %sactive\n", __progname,
-+	 _mesa_printf("%s - Page flipping %sactive\n", __FUNCTION__,
- 		      pf_active ? "" : "in");
+diff -urp -x '*~' -x '*.orig' src/mesa/drivers/dri/radeon/server/radeon_dri.h src/mesa/drivers/dri/radeon/server/radeon_dri.h
+--- src/mesa/drivers/dri/radeon/server/radeon_dri.h	2009-01-22 09:38:33.000000000 -0800
++++ src/mesa/drivers/dri/radeon/server/radeon_dri.h	2009-03-31 09:12:45.642139000 -0700
+@@ -89,6 +89,7 @@ typedef struct {
+     /*@{*/
+     drm_handle_t     registerHandle; /**< \brief MMIO register map size */
+     drmSize       registerSize;   /**< \brief MMIO register map handle */
++    int      	  padding0;
+     /*@}*/
  
-    if (pf_active) {
---- src/mesa/drivers/dri/intel/intel_context.h	Tue Sep 30 10:31:32 2008
-+++ src/mesa/drivers/dri/intel/intel_context.h	Tue Sep 30 12:01:59 2008
-@@ -327,7 +327,7 @@
-  * than COPY_DWORDS would:
-  * XXX Put this in src/mesa/main/imports.h ???
-  */
--#if defined(i386) || defined(__i386__)
-+#if (defined(i386) || defined(__i386__)) && !(defined(__SOLARIS__) || defined(sun))
- static INLINE void * __memcpy(void * to, const void * from, size_t n)
- {
-    int d0, d1, d2;
-
+     /**
+@@ -97,6 +98,7 @@ typedef struct {
+     /*@{*/
+     drm_handle_t     statusHandle;   /**< \brief status map handle */
+     drmSize       statusSize;     /**< \brief status map size */
++    int		  padding1;
+     /*@}*/
+ 
+     /**
+@@ -105,11 +107,13 @@ typedef struct {
+     /*@{*/
+     drm_handle_t     gartTexHandle;   /**< \brief AGP texture area map handle */
+     drmSize       gartTexMapSize;  /**< \brief AGP texture area map size */
++    int 	  padding2;
+     int           log2GARTTexGran; /**< \brief AGP texture granularity in log base 2 */
+     int           gartTexOffset;   /**< \brief AGP texture area offset in AGP space */
+     /*@}*/
+ 
+     unsigned int  sarea_priv_offset; /**< \brief offset of the private SAREA data*/
++    int		  padding3;
+ } RADEONDRIRec, *RADEONDRIPtr;
+ 
+ #endif