Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 19776 | Differences between
and this patch

Collapse All | Expand All

(-)xc/lib/GL/glx/glxext.c.orig (+93 lines)
Lines 57-62 Link Here
57
#ifdef DEBUG
57
#ifdef DEBUG
58
void __glXDumpDrawBuffer(__GLXcontext *ctx);
58
void __glXDumpDrawBuffer(__GLXcontext *ctx);
59
#endif
59
#endif
60
#ifdef USE_SPARC_ASM
61
/*
62
 * This is where our dispatch table's bounds are.
63
 * And the static mesa_init is taken directly from
64
 * Mesa's 'sparc.c' initializer.
65
 *
66
 * We need something like this here, because this version
67
 * of openGL/glx never initializes a Mesa context, and so
68
 * the address of the dispatch table pointer never gets stuffed
69
 * into the dispatch jump table otherwise.
70
 *
71
 * It matters only on SPARC, and only if you are using assembler
72
 * code instead of C-code indirect dispatch.
73
 *
74
 * -- FEM, 04.xii.03
75
 */
76
extern unsigned int _mesa_sparc_glapi_begin;
77
extern unsigned int _mesa_sparc_glapi_end;
78
extern void __glapi_sparc_icache_flush(unsigned int *);
79
static void _glx_mesa_init_sparc_glapi_relocs(void);
80
static int _mesa_sparc_needs_init = 1;
81
#define INIT_MESA_SPARC { \
82
    if(_mesa_sparc_needs_init) { \
83
      _glx_mesa_init_sparc_glapi_relocs(); \
84
      _mesa_sparc_needs_init = 0; \
85
  } \
86
}
87
#else
88
#define INIT_MESA_SPARC
89
#endif
60
90
61
/*
91
/*
62
** We setup some dummy structures here so that the API can be used
92
** We setup some dummy structures here so that the API can be used
Lines 488-493 Link Here
488
        }
518
        }
489
    }
519
    }
490
#endif
520
#endif
521
    INIT_MESA_SPARC
491
522
492
    /* The one and only long long lock */
523
    /* The one and only long long lock */
493
    __glXLock();
524
    __glXLock();
Lines 603-608 Link Here
603
634
604
	if (gc->currentDpy == dpy) {
635
	if (gc->currentDpy == dpy) {
605
	    /* Use opcode from gc because its right */
636
	    /* Use opcode from gc because its right */
637
            INIT_MESA_SPARC
606
	    return gc->majorOpcode;
638
	    return gc->majorOpcode;
607
	} else {
639
	} else {
608
	    /*
640
	    /*
Lines 1029-1031 Link Here
1029
    }	    
1061
    }	    
1030
}
1062
}
1031
#endif
1063
#endif
1064
1065
/*
1066
 * Used only when we are sparc, using sparc assembler.
1067
 *
1068
 */
1069
1070
static void
1071
_glx_mesa_init_sparc_glapi_relocs(void)
1072
{
1073
#ifdef  USE_SPARC_ASM
1074
	unsigned int *insn_ptr, *end_ptr;
1075
	unsigned long disp_addr;
1076
1077
	insn_ptr = &_mesa_sparc_glapi_begin;
1078
	end_ptr = &_mesa_sparc_glapi_end;
1079
	disp_addr = (unsigned long) &_glapi_Dispatch;
1080
1081
	/*
1082
         * Verbatim from Mesa sparc.c.  It's needed because there doesn't
1083
         * seem to be a better way to do this:
1084
         *
1085
         * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
1086
         *
1087
         * This code is patching in the ADDRESS of the pointer to the
1088
         * dispatch table.  Hence, it must be called exactly once, because
1089
         * that address is not going to change.
1090
         *
1091
         * What it points to can change, but Mesa (and hence, we) assume
1092
         * that there is only one pointer.
1093
         *
1094
	 */
1095
	while (insn_ptr < end_ptr) {
1096
#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )	
1097
/*
1098
	This code patches for 64-bit addresses.  This had better
1099
	not happen for Sparc/Linux, no matter what architecture we
1100
	are building for.  So, don't do this.
1101
1102
        The 'defined(__linux_64__)' is used here as a placeholder for
1103
        when we do do 64-bit usermode on sparc linux.
1104
	*/
1105
		insn_ptr[0] |= (disp_addr >> (32 + 10));
1106
		insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
1107
		__glapi_sparc_icache_flush(&insn_ptr[0]);
1108
		insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
1109
		insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
1110
		__glapi_sparc_icache_flush(&insn_ptr[2]);
1111
		insn_ptr += 11;
1112
#else
1113
		insn_ptr[0] |= (disp_addr >> 10);
1114
		insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
1115
		__glapi_sparc_icache_flush(&insn_ptr[0]);
1116
		insn_ptr += 5;
1117
#endif
1118
	}
1119
#else
1120
                /* Just no-op
1121
                 *
1122
                 */ 
1123
#endif  /* sparc ASM in use */
1124
}

Return to bug 19776