These patches actually should still work on 6.4, the areas in which
they are related have not changed between the versions.
the GLX_NO_TEXREL-2 is what is needed to get rid of the texrels I
when installing linux-dri-x86 only.
This does not do anything for linux-dri, or any of the others.
I would work on the others, by my assembly language skills are only
amateur.
The patch by default does not apply the change, in order to do that,
-DGLX_NO_TEXREL must be passed, so I made a patch to do this
automatically to Mesa's config. This is done applied directly to the
Mesa source, so for the monothilic build, you will probably have to
change into the subdir where mesa resides. This patch is called:
linux-dri-x86-1. As the name suggests, it applies only to the
linux-dri-x86 install.
I also updated the LIB/INCLUDE path in there to be /usr/lib
and /usr/include instead of /usr/X11R6/lib and /usr/X11R6/bin.
If you don't like that, a re-diff could be made, or it could be sed'd
away.
Submitted By: Kevin Day <kevin AT kevux DOT org>
Date: 2006-06-21
Initial Package Version: 6.4
Upstream Status: submitted
Description: This is a recreation of the patch supplied by bug #4197.
Except, this time, it encases all of the NO_TEXREL differences under the DEFINE
GLX_NO_TEXREL. In hopes that Mesa will accept this upstream given that developers
would have to explicitly pass -DGLX_NO_TEXREL. This way, both worlds can be happy.
--- Mesa-6.5/src/mesa/x86/glapi_x86.S.orig 2006-06-21 18:41:10.000000000 +0000
+++ Mesa-6.5/src/mesa/x86/glapi_x86.S 2006-06-21 18:56:06.000000000 +0000
@@ -66,34 +66,70 @@
JMP(GL_OFFSET(off))
#elif defined(PTHREADS)
+#ifdef GLX_NO_TEXREL
# define GL_STUB(fn,off,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)) ; \
1: CALL(_x86_get_dispatch) ; \
JMP(GL_OFFSET(off))
+#else
+# define GL_STUB(fn,off,fn_alt) \
+ALIGNTEXT16; \
+GLOBL_FN(GL_PREFIX(fn, fn_alt)); \
+GL_PREFIX(fn, fn_alt): \
+ MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \
+ TEST_L(EAX, EAX) ; \
+ JE(1f) ; \
+ JMP(GL_OFFSET(off)) ; \
+1: CALL(_x86_get_dispatch) ; \
+ JMP(GL_OFFSET(off))
+#endif /* GLX_NO_TEXREL */
+
#elif defined(THREADS)
+#ifdef GLX_NO_TEXREL
# define GL_STUB(fn,off,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)) ; \
1: CALL(_glapi_get_dispatch) ; \
JMP(GL_OFFSET(off))
+#else
+# define GL_STUB(fn,off,fn_alt) \
+ALIGNTEXT16; \
+GLOBL_FN(GL_PREFIX(fn, fn_alt)); \
+GL_PREFIX(fn, fn_alt): \
+ MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \
+ TEST_L(EAX, EAX) ; \
+ JE(1f) ; \
+ JMP(GL_OFFSET(off)) ; \
+1: CALL(_glapi_get_dispatch) ; \
+ JMP(GL_OFFSET(off))
+#endif /* GLX_NO_TEXREL */
#else /* Non-threaded version. */
+#ifdef GLX_NO_TEXREL
+# define GL_STUB(fn,off,fn_alt) \
+ALIGNTEXT16; \
+GLOBL_FN(GL_PREFIX(fn, fn_alt)); \
+GL_PREFIX(fn, fn_alt): \
+ CALL(GL_PREFIX(get_dispatchbase, get_dispatchbase)) ;\
+ JMP(GL_OFFSET(off))
+#else
# define GL_STUB(fn,off,fn_alt) \
ALIGNTEXT16; \
GLOBL_FN(GL_PREFIX(fn, fn_alt)); \
GL_PREFIX(fn, fn_alt): \
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \
JMP(GL_OFFSET(off))
+#endif /* GLX_NO_TEXREL */
#endif
#ifdef HAVE_ALIAS
@@ -107,6 +143,16 @@
SEG_TEXT
+#ifdef GLX_NO_TEXREL
+ 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
+#endif /* GLX_NO_TEXREL */
+
#ifdef GLX_USE_TLS
GLOBL GLNAME(_x86_get_dispatch)
@@ -123,9 +169,20 @@
ALIGNTEXT16
GLNAME(_x86_get_dispatch):
+#ifdef GLX_NO_TEXREL
+ MOV_L(CONST(_GLOBAL_OFFSET_TABLE_), EDX)
+ MOV_L(REGIND(ESP), EAX)
+ ADD_L(REGOFF(-4, EAX), EAX)
+#endif /* GLX_NO_TEXREL */
SUB_L(CONST(24), ESP)
+#ifdef GLX_NO_TEXREL
+ MOV_L(REGBID(EAX, EDX, GLNAME(_gl_DispatchTSD)@GOT), EAX)
+ PUSH_L(REGIND(EAX))
+ CALL(GLNAME([EMAIL PROTECTED]))
+#else
PUSH_L(GLNAME(_gl_DispatchTSD))
CALL(GLNAME(pthread_getspecific))
+#endif /* GLX_NO_TEXREL */
ADD_L(CONST(28), ESP)
RET
#elif defined(THREADS)
--- Mesa-6.5/src/mesa/x86/mmx_blendtmp.h.orig 2006-06-21 19:00:59.000000000 +0000
+++ Mesa-6.5/src/mesa/x86/mmx_blendtmp.h 2006-06-21 19:06:18.000000000 +0000
@@ -12,6 +12,12 @@
*
*/
ALIGNTEXT16
+#ifdef GLX_NO_TEXREL
+LLBL( TAG(mesa_mmx_blend_get_eip) ):
+ /* store eip in edx */
+ MOV_L ( REGIND(ESP), EDX )
+ RET
+#endif /* GLX_NO_TEXREL */
GLOBL GLNAME( TAG(_mesa_mmx_blend) )
HIDDEN( TAG(_mesa_mmx_blend) )
GLNAME( TAG(_mesa_mmx_blend) ):
@@ -30,6 +36,11 @@
MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */
MOV_L ( REGOFF(24, EBP), ESI ) /* dest */
+#ifdef GLX_NO_TEXREL
+ CALL ( LLBL( TAG(mesa_mmx_blend_get_eip) ) )
+ ADD_L ( CONST(_GLOBAL_OFFSET_TABLE_), EDX )
+#endif /* GLX_NO_TEXREL */
+
INIT
TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */
--- Mesa-6.5/src/mesa/x86/read_rgba_span_x86.S.orig 2006-06-21 19:01:08.000000000 +0000
+++ Mesa-6.5/src/mesa/x86/read_rgba_span_x86.S 2006-06-21 19:04:59.000000000 +0000
@@ -75,6 +75,9 @@
* at the correct places.
*/
+#ifdef GLX_NO_TEXREL
+.text
+#endif /* GLX_NO_TEXREL */
.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 +87,16 @@
#ifdef USE_INNER_EMMS
emms
#endif
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+# undef __i686 /* gcc define gets in our way */
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ movq [EMAIL PROTECTED], %mm1
+ movq [EMAIL PROTECTED], %mm2
+#else
movq mask, %mm1
movq mask+16, %mm2
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
movl 8(%esp), %ebx /* source pointer */
movl 16(%esp), %edx /* number of pixels to copy */
@@ -182,8 +193,15 @@
#ifdef USE_INNER_EMMS
emms
#endif
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ movq [EMAIL PROTECTED], %mm1
+ movq [EMAIL PROTECTED], %mm2
+#else
movq mask, %mm1
movq mask+16, %mm2
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
movl 16(%esp), %ebx /* source pointer */
movl 24(%esp), %edx /* number of pixels to copy */
@@ -341,8 +359,15 @@
pushl %esi
pushl %ebx
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ movdqa mask, %xmm1
+ movdqa mask+16, %xmm2
+#else
movdqa mask, %xmm1
movdqa mask+16, %xmm2
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
movl 12(%esp), %ebx /* source pointer */
movl 20(%esp), %edx /* number of pixels to copy */
@@ -521,18 +546,39 @@
.type _generic_read_RGBA_span_RGB565_MMX, @function
_generic_read_RGBA_span_RGB565_MMX:
+#ifdef GLX_NO_TEXREL
+ pushl %ebx
+#endif /* GLX_NO_TEXREL */
#ifdef USE_INNER_EMMS
emms
#endif
+#ifdef GLX_NO_TEXREL
+#ifdef __PIC__
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+#endif /* __PIC__ */
+
+ movl 8(%esp), %eax /* source pointer */
+ movl 12(%esp), %edx /* destination pointer */
+ movl 16(%esp), %ecx /* number of pixels to copy */
+#else
+
movl 4(%esp), %eax /* source pointer */
movl 8(%esp), %edx /* destination pointer */
movl 12(%esp), %ecx /* number of pixels to copy */
+#endif /* GLX_NO_TEXREL */
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ movq [EMAIL PROTECTED], %mm5
+ movq [EMAIL PROTECTED], %mm6
+ movq [EMAIL PROTECTED], %mm7
+#else
movq mask_565, %mm5
movq prescale, %mm6
movq scale, %mm7
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
sarl $2, %ecx
jle .L01 /* Bail early if the count is negative. */
@@ -581,8 +627,13 @@
/* Always set the alpha value to 0xff.
*/
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ por [EMAIL PROTECTED], %mm0
+ por [EMAIL PROTECTED], %mm2
+#else
por alpha, %mm0
por alpha, %mm2
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
/* Pack the 16-bit values to 8-bit values and store the converted
@@ -609,8 +660,13 @@
pmulhuw %mm7, %mm0
pmulhuw %mm7, %mm2
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ por [EMAIL PROTECTED], %mm0
+ por [EMAIL PROTECTED], %mm2
+#else
por alpha, %mm0
por alpha, %mm2
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
packuswb %mm2, %mm0
@@ -625,8 +681,11 @@
/* At this point there can be at most 3 pixels left to process. If
* there is either 2 or 3 left, process 2.
*/
-
+#ifdef GLX_NO_TEXREL
+ movl 16(%esp), %ecx
+#else
movl 12(%esp), %ecx
+#endif /* GLX_NO_TEXREL */
testl $0x02, %ecx
je .L04
@@ -647,8 +706,13 @@
pmulhuw %mm7, %mm0
pmulhuw %mm7, %mm2
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ por [EMAIL PROTECTED], %mm0
+ por [EMAIL PROTECTED], %mm2
+#else
por alpha, %mm0
por alpha, %mm2
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
packuswb %mm2, %mm0
@@ -675,7 +739,11 @@
#endif
pmulhuw %mm7, %mm0
+#if defined(GLX_NO_TEXREL) && defined(__PIC__)
+ por [EMAIL PROTECTED], %mm0
+#else
por alpha, %mm0
+#endif /* defined(GLX_NO_TEXREL) && defined(__PIC__) */
packuswb %mm0, %mm0
@@ -685,5 +753,20 @@
#ifdef USE_INNER_EMMS
emms
#endif
+
+#ifdef GLX_NO_TEXREL
+ popl %ebx
+ ret
+#ifdef __PIC__
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+.globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+#endif /* __PIC__ */
+#else
ret
+#endif /* GLX_NO_TEXREL */
#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) */
--- Mesa-6.5/configs/linux-dri-x86.orig 2006-06-21 17:40:50.000000000 +0000
+++ Mesa-6.5/configs/linux-dri-x86 2006-06-21 17:41:05.000000000 +0000
@@ -5,7 +5,8 @@
CONFIG_NAME = linux-dri-x86
-# Unnecessary on x86, generally.
+# Unnecessary on x86, unless hardening
+# if hardening, add -DGLX_NO_TEXREL to DEFINES in linux-dri, and remove this.
PIC_FLAGS =
# Add -m32 to CFLAGS:
--- Mesa-6.5/src/mesa/x86/mmx_blend.S.orig 2006-06-21 19:00:52.000000000 +0000
+++ Mesa-6.5/src/mesa/x86/mmx_blend.S 2006-06-21 19:15:23.000000000 +0000
@@ -302,8 +302,13 @@
#define TAG(x) CONCAT(x,_min)
#define LLTAG(x) LLBL2(x,_min)
+#ifdef GLX_NO_TEXREL
+#define INIT \
+ MOVQ ( CONTENT(REGOFF([EMAIL PROTECTED], EDX)), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+#else
#define INIT \
MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+#endif /* GLX_NO_TEXREL */
#define MAIN( rgba, dest ) \
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\
@@ -326,8 +331,13 @@
#define TAG(x) CONCAT(x,_max)
#define LLTAG(x) LLBL2(x,_max)
+#ifdef GLX_NO_TEXREL
+#define INIT \
+ MOVQ ( CONTENT(REGOFF([EMAIL PROTECTED], EDX)), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+#else
#define INIT \
MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
+#endif /* GLX_NO_TEXREL */
#define MAIN( rgba, dest ) \
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\
@@ -350,9 +360,15 @@
#define TAG(x) CONCAT(x,_modulate)
#define LLTAG(x) LLBL2(x,_modulate)
+#ifdef GLX_NO_TEXREL
+#define INIT \
+ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\
+ MOVQ ( CONTENT(REGOFF([EMAIL PROTECTED], EDX)), MM7 ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */
+#else
#define INIT \
PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\
MOVQ ( CONTENT(const_0080), MM7 ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */
+#endif /* GLX_NO_TEXREL */
#define MAIN( rgba, dest ) \
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\
Submitted By: Kevin Day <kevin AT kevux DOT org>
Date: 2006-06-21
Initial Package Version: 6.5
Upstream Status: Not submitted
Description: Apply necessary fixes to get this to work with the
NO_TEXREL patch I re-created, based on Declan Moriarty and whomever else
contributed to bug #4197. I am uncertain whether to add -D__PIC__ is safe
here or whether the -fPIC caused it to be auto-added, for now I am leaving
it out.
--- Mesa-6.5/configs/linux-dri.orig 2006-06-21 17:42:12.000000000 +0000
+++ Mesa-6.5/configs/linux-dri 2006-06-21 17:43:22.000000000 +0000
@@ -22,9 +22,9 @@
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
- -DGLX_DIRECT_RENDERING -DHAVE_ALIAS
+ -DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DGLX_NO_TEXREL
-X11_INCLUDES = -I/usr/X11R6/include
+X11_INCLUDES = -I/usr/include
CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(ASM_FLAGS) -std=c99
@@ -35,7 +35,7 @@
ASM_SOURCES =
# Library/program dependencies
-EXTRA_LIB_PATH=-L/usr/X11R6/lib
+EXTRA_LIB_PATH=-L/usr/lib
LIBDRM_LIB = `pkg-config --libs libdrm`
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
--
http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page