Book Suggestions.

Declan Moriarty junk_mail at iol.ie
Mon Jan 30 14:04:48 PST 2006


I have a set of instructions for X floating about as an email.
That threw up the following:

The kernel (If you are trying for X and DRI:)

1. The only acceptable mention of DRM in the kernel is
# CONFIG_DRM is not set
Anything else breaks the DRM code. Don't ask me - I just found
out. Mebbe a line in the book on that page?

2. You need to keep the compiled Xorg source, and the compiled
kernel source if you are to have a hope of getting the DRM
functional. Mebbe a line into the book on that as well?

3. You also may need 'forced unloading of kernel modules' if you
have framebuffer support compiled in, and want DRI when in X.

4. A comment to include CONFIG_PAX_NOELFRELOCS might be based on
the rather vitriolic set-to that was 
http://bugs.freedesktop.org/show_bug.cgi?id=4197
I gather most have it, but it seems like a must-have.

If the X instructions work for others, the book might usefully
base something on them. Even if you don't, libGL.so.1.2 might be
checked for textrels (readelf -d |grep TEXTREL) on your current
build.

Here's the mesa-6.4-pic-notextrel.patch
-- 

	With best Regards,


	Declan Moriarty.
-------------- next part --------------
diff -urp -x depend Mesa-6.4-old/configs/linux-dri-x86 Mesa-6.4/configs/linux-dri-x86
--- Mesa-6.4-old/configs/linux-dri-x86	2005-11-30 11:07:47.000000000 +0100
+++ Mesa-6.4/configs/linux-dri-x86	2005-11-30 12:06:46.000000000 +0100
@@ -5,9 +5,6 @@ include $(TOP)/configs/linux-dri
 
 CONFIG_NAME = linux-dri-x86
 
-# Unnecessary on x86, generally.
-PIC_FLAGS = 
-
 # Add -m32 to CFLAGS:
 ARCH_FLAGS = -m32
 
diff -urp -x depend Mesa-6.4-old/src/mesa/x86/glapi_x86.S Mesa-6.4/src/mesa/x86/glapi_x86.S
--- Mesa-6.4-old/src/mesa/x86/glapi_x86.S	2005-10-21 00:52:17.000000000 +0200
+++ Mesa-6.4/src/mesa/x86/glapi_x86.S	2005-11-30 13:14:11.000000000 +0100
@@ -82,7 +82,7 @@ GL_PREFIX(fn, fn_alt):					\
 ALIGNTEXT16;						\
 GLOBL_FN(GL_PREFIX(fn, fn_alt));			\
 GL_PREFIX(fn, fn_alt):					\
-	MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;	\
+	CALL(GL_PREFIX(get_dispatchbase, get_dispatchbase)) ;\
 	TEST_L(EAX, EAX) ;				\
 	JE(1f) ;					\
 	JMP(GL_OFFSET(off)) ;				\
@@ -93,7 +93,7 @@ GL_PREFIX(fn, fn_alt):					\
 ALIGNTEXT16;						\
 GLOBL_FN(GL_PREFIX(fn, fn_alt));			\
 GL_PREFIX(fn, fn_alt):					\
-	MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;	\
+	CALL(GL_PREFIX(get_dispatchbase, get_dispatchbase)) ;\
 	TEST_L(EAX, EAX) ;				\
 	JE(1f) ;					\
 	JMP(GL_OFFSET(off)) ;				\
@@ -104,7 +104,7 @@ GL_PREFIX(fn, fn_alt):					\
 ALIGNTEXT16;						\
 GLOBL_FN(GL_PREFIX(fn, fn_alt));			\
 GL_PREFIX(fn, fn_alt):					\
-	MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;	\
+	CALL(GL_PREFIX(get_dispatchbase, get_dispatchbase)) ;\
 	JMP(GL_OFFSET(off))
 #endif
 
@@ -119,6 +119,14 @@ GL_PREFIX(fn, fn_alt):					\
 
 SEG_TEXT
 
+GL_PREFIX(get_dispatchbase, get_dispatchbase):
+	/* store eip then the dispatch table base in eax */
+	MOV_L(CONST(_GLOBAL_OFFSET_TABLE_), EDX)
+	MOV_L(REGIND(ESP), EAX)
+	ADD_L(REGOFF(-4, EAX), EAX)
+	MOV_L(REGBID(EAX, EDX, GLNAME(_glapi_Dispatch)@GOTOFF), EAX)
+	RET
+
 #ifdef GLX_USE_TLS
 
 	GLOBL	GLNAME(_x86_get_dispatch)
@@ -135,9 +143,13 @@ EXTERN GLNAME(pthread_getspecific)
 
 ALIGNTEXT16
 GLNAME(_x86_get_dispatch):
+	MOV_L(CONST(_GLOBAL_OFFSET_TABLE_), EDX)
+	MOV_L(REGIND(ESP), EAX)
+	ADD_L(REGOFF(-4, EAX), EAX)
 	SUB_L(CONST(24), ESP)
-	PUSH_L(GLNAME(_gl_DispatchTSD))
-	CALL(GLNAME(pthread_getspecific))
+	MOV_L(REGBID(EAX, EDX, GLNAME(_gl_DispatchTSD)@GOT), EAX)
+	PUSH_L(REGIND(EAX))
+	CALL(GLNAME(pthread_getspecific at PLT))
 	ADD_L(CONST(28), ESP)
 	RET
 #elif defined(THREADS)
diff -urp -x depend Mesa-6.4-old/src/mesa/x86/mmx_blend.S Mesa-6.4/src/mesa/x86/mmx_blend.S
--- Mesa-6.4-old/src/mesa/x86/mmx_blend.S	2004-04-26 12:10:25.000000000 +0200
+++ Mesa-6.4/src/mesa/x86/mmx_blend.S	2005-11-30 11:17:29.000000000 +0100
@@ -303,7 +303,7 @@ TWO(MOVQ       ( MM1, REGIND(rgba) ))
 #define LLTAG(x) LLBL2(x,_min)
 
 #define INIT \
-    MOVQ       ( CONTENT(const_80), MM7 )	/* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+    MOVQ       ( CONTENT(REGOFF(const_80 at GOTOFF, EDX)), MM7 )	/* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
 
 #define MAIN( rgba, dest ) \
     GMB_LOAD( rgba, dest, MM1, MM2 )									;\
@@ -327,7 +327,7 @@ TWO(MOVQ       ( MM1, REGIND(rgba) ))
 #define LLTAG(x) LLBL2(x,_max)
 
 #define INIT \
-    MOVQ       ( CONTENT(const_80), MM7 )	/* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+    MOVQ       ( CONTENT(REGOFF(const_80 at GOTOFF, EDX)), MM7 )	/* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
 
 #define MAIN( rgba, dest ) \
     GMB_LOAD( rgba, dest, MM1, MM2 )									;\
@@ -352,7 +352,7 @@ TWO(MOVQ       ( MM1, REGIND(rgba) ))
 
 #define INIT \
     PXOR       ( MM0, MM0 )			/*   0x0000  |   0x0000  |   0x0000  |   0x0000  */	;\
-    MOVQ       ( CONTENT(const_0080), MM7 )	/*   0x0080  |   0x0080  |   0x0080  |   0x0080  */
+    MOVQ       ( CONTENT(REGOFF(const_0080 at GOTOFF, EDX)), MM7 )	/*   0x0080  |   0x0080  |   0x0080  |   0x0080  */
 
 #define MAIN( rgba, dest ) \
     GMB_LOAD( rgba, dest, MM1, MM2 )									;\
diff -urp -x depend Mesa-6.4-old/src/mesa/x86/mmx_blendtmp.h Mesa-6.4/src/mesa/x86/mmx_blendtmp.h
--- Mesa-6.4-old/src/mesa/x86/mmx_blendtmp.h	2005-01-04 15:33:47.000000000 +0100
+++ Mesa-6.4/src/mesa/x86/mmx_blendtmp.h	2005-11-30 11:13:27.000000000 +0100
@@ -12,6 +12,12 @@
  * 
  */
 ALIGNTEXT16
+
+LLBL( TAG(mesa_mmx_blend_get_eip) ):
+    /* store eip in edx */
+    MOV_L      ( REGIND(ESP), EDX )
+    RET
+
 GLOBL GLNAME( TAG(_mesa_mmx_blend) )
 HIDDEN( TAG(_mesa_mmx_blend) )
 GLNAME( TAG(_mesa_mmx_blend) ):
@@ -30,6 +36,9 @@ GLNAME( TAG(_mesa_mmx_blend) ):
     MOV_L      ( REGOFF(20, EBP), EDI )         /* rgba */
     MOV_L      ( REGOFF(24, EBP), ESI )         /* dest */
 
+    CALL       ( LLBL( TAG(mesa_mmx_blend_get_eip) ) )
+    ADD_L      ( CONST(_GLOBAL_OFFSET_TABLE_), EDX )
+
     INIT
     
     TEST_L     ( CONST(4), EDI )		/* align rgba on an 8-byte boundary */
diff -urp -x depend Mesa-6.4-old/src/mesa/x86/read_rgba_span_x86.S Mesa-6.4/src/mesa/x86/read_rgba_span_x86.S
--- Mesa-6.4-old/src/mesa/x86/read_rgba_span_x86.S	2005-06-30 13:42:56.000000000 +0200
+++ Mesa-6.4/src/mesa/x86/read_rgba_span_x86.S	2005-11-30 12:01:02.000000000 +0100
@@ -75,6 +75,7 @@ mask:
  * at the correct places.
  */
 
+.text
 .globl _generic_read_RGBA_span_BGRA8888_REV_MMX
 .hidden _generic_read_RGBA_span_BGRA8888_REV_MMX
 	.type	_generic_read_RGBA_span_BGRA8888_REV_MMX, @function
@@ -84,8 +85,17 @@ _generic_read_RGBA_span_BGRA8888_REV_MMX
 #ifdef USE_INNER_EMMS
 	emms
 #endif
+
+#ifdef __PIC__
+# undef __i686 /* gcc define gets in our way */
+	call __i686.get_pc_thunk.bx
+	addl $_GLOBAL_OFFSET_TABLE_, %ebx
+	movq	mask at GOTOFF, %mm1
+	movq	16+mask at GOTOFF, %mm2
+#else
 	movq	mask, %mm1
 	movq	mask+16, %mm2
+#endif
 
 	movl	8(%esp), %ebx	/* source pointer */
 	movl	16(%esp), %edx	/* number of pixels to copy */
@@ -182,8 +192,16 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE
 #ifdef USE_INNER_EMMS
 	emms
 #endif
+
+#ifdef __PIC__
+	call __i686.get_pc_thunk.bx
+	addl $_GLOBAL_OFFSET_TABLE_, %ebx
+	movq	mask at GOTOFF, %mm1
+	movq	16+mask at GOTOFF, %mm2
+#else
 	movq	mask, %mm1
 	movq	mask+16, %mm2
+#endif
 
 	movl	16(%esp), %ebx	/* source pointer */
 	movl	24(%esp), %edx	/* number of pixels to copy */
@@ -341,8 +359,15 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE
 	pushl	%esi
 	pushl	%ebx
 
+#ifdef __PIC__
+	call __i686.get_pc_thunk.bx
+	addl $_GLOBAL_OFFSET_TABLE_, %ebx
+	movdqa	mask at GOTOFF, %xmm1
+	movdqa	16+mask at GOTOFF, %xmm2
+#else
 	movdqa	mask, %xmm1
 	movdqa	mask+16, %xmm2
+#endif
 
 	movl	12(%esp), %ebx	/* source pointer */
 	movl	20(%esp), %edx	/* number of pixels to copy */
@@ -521,18 +546,30 @@ alpha:	.long	0x00000000
 	.type	_generic_read_RGBA_span_RGB565_MMX, @function
 
 _generic_read_RGBA_span_RGB565_MMX:
+	pushl	%ebx
 
 #ifdef USE_INNER_EMMS
 	emms
 #endif
 
-	movl	4(%esp), %eax	/* source pointer */
-	movl	8(%esp), %edx	/* destination pointer */
-	movl	12(%esp), %ecx	/* number of pixels to copy */
+#ifdef __PIC__
+	call __i686.get_pc_thunk.bx
+	addl $_GLOBAL_OFFSET_TABLE_, %ebx
+#endif
 
+	movl	8(%esp), %eax	/* source pointer */
+	movl	12(%esp), %edx	/* destination pointer */
+	movl	16(%esp), %ecx	/* number of pixels to copy */
+
+#ifdef __PIC__
+	movq	mask_565 at GOTOFF, %mm5
+	movq	prescale at GOTOFF, %mm6
+	movq	scale at GOTOFF, %mm7
+#else
 	movq	mask_565, %mm5
 	movq	prescale, %mm6
 	movq	scale, %mm7
+#endif
 
 	sarl	$2, %ecx
 	jle	.L01		/* Bail early if the count is negative. */
@@ -581,9 +618,13 @@ _generic_read_RGBA_span_RGB565_MMX:
 	/* Always set the alpha value to 0xff.
 	 */
 
+#ifdef __PIC__
+	por	alpha at GOTOFF, %mm0
+	por	alpha at GOTOFF, %mm2
+#else
 	por	alpha, %mm0
 	por	alpha, %mm2
-
+#endif
 
 	/* Pack the 16-bit values to 8-bit values and store the converted
 	 * pixel data.
@@ -609,8 +650,13 @@ _generic_read_RGBA_span_RGB565_MMX:
 	pmulhuw	%mm7, %mm0
 	pmulhuw	%mm7, %mm2
 
+#ifdef __PIC__
+	por	alpha at GOTOFF, %mm0
+	por	alpha at GOTOFF, %mm2
+#else
 	por	alpha, %mm0
 	por	alpha, %mm2
+#endif
 
 	packuswb	%mm2, %mm0
 
@@ -626,7 +672,7 @@ _generic_read_RGBA_span_RGB565_MMX:
 	 * there is either 2 or 3 left, process 2.
          */
 
-	movl	12(%esp), %ecx
+	movl	16(%esp), %ecx
 	testl	$0x02, %ecx
 	je	.L04
 
@@ -647,8 +693,13 @@ _generic_read_RGBA_span_RGB565_MMX:
 	pmulhuw	%mm7, %mm0
 	pmulhuw	%mm7, %mm2
 
+#ifdef __PIC__
+	por	alpha at GOTOFF, %mm0
+	por	alpha at GOTOFF, %mm2
+#else
 	por	alpha, %mm0
 	por	alpha, %mm2
+#endif
 
 	packuswb	%mm2, %mm0
 
@@ -675,7 +726,11 @@ _generic_read_RGBA_span_RGB565_MMX:
 #endif
 	pmulhuw	%mm7, %mm0
 
+#ifdef __PIC__
+	por	alpha at GOTOFF, %mm0
+#else
 	por	alpha, %mm0
+#endif
 
 	packuswb	%mm0, %mm0
 
@@ -685,5 +740,17 @@ _generic_read_RGBA_span_RGB565_MMX:
 #ifdef USE_INNER_EMMS
 	emms
 #endif
+	popl	%ebx
+	ret
+
+#ifdef __PIC__
+	.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax", at progbits
+.globl __i686.get_pc_thunk.bx
+	.hidden  __i686.get_pc_thunk.bx
+	.type    __i686.get_pc_thunk.bx, at function
+__i686.get_pc_thunk.bx:
+	movl (%esp), %ebx
 	ret
+#endif
+
 #endif /* !defined(__DJGPP__) && !defined(__MINGW32__) */


More information about the hlfs-dev mailing list