|
Lines 62-67
Link Here
|
| 62 |
void __glXDumpDrawBuffer(__GLXcontext *ctx); |
62 |
void __glXDumpDrawBuffer(__GLXcontext *ctx); |
| 63 |
#endif |
63 |
#endif |
| 64 |
|
64 |
|
|
|
65 |
#ifdef USE_SPARC_ASM |
| 66 |
/* |
| 67 |
* This is where our dispatch table's bounds are. |
| 68 |
* And the static mesa_init is taken directly from |
| 69 |
* Mesa's 'sparc.c' initializer. |
| 70 |
* |
| 71 |
* We need something like this here, because this version |
| 72 |
* of openGL/glx never initializes a Mesa context, and so |
| 73 |
* the address of the dispatch table pointer never gets stuffed |
| 74 |
* into the dispatch jump table otherwise. |
| 75 |
* |
| 76 |
* It matters only on SPARC, and only if you are using assembler |
| 77 |
* code instead of C-code indirect dispatch. |
| 78 |
* |
| 79 |
* -- FEM, 04.xii.03 |
| 80 |
*/ |
| 81 |
extern unsigned int _mesa_sparc_glapi_begin; |
| 82 |
extern unsigned int _mesa_sparc_glapi_end; |
| 83 |
extern void __glapi_sparc_icache_flush(unsigned int *); |
| 84 |
static void _glx_mesa_init_sparc_glapi_relocs(void); |
| 85 |
static int _mesa_sparc_needs_init = 1; |
| 86 |
#define INIT_MESA_SPARC { \ |
| 87 |
if(_mesa_sparc_needs_init) { \ |
| 88 |
_glx_mesa_init_sparc_glapi_relocs(); \ |
| 89 |
_mesa_sparc_needs_init = 0; \ |
| 90 |
} \ |
| 91 |
} |
| 92 |
#else |
| 93 |
#define INIT_MESA_SPARC |
| 94 |
#endif |
| 95 |
|
| 65 |
static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, |
96 |
static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, |
| 66 |
GLXDrawable read, GLXContext gc); |
97 |
GLXDrawable read, GLXContext gc); |
| 67 |
|
98 |
|
|
Lines 832-837
Link Here
|
| 832 |
} |
863 |
} |
| 833 |
#endif |
864 |
#endif |
| 834 |
|
865 |
|
|
|
866 |
INIT_MESA_SPARC |
| 835 |
/* The one and only long long lock */ |
867 |
/* The one and only long long lock */ |
| 836 |
__glXLock(); |
868 |
__glXLock(); |
| 837 |
|
869 |
|
|
Lines 946-951
Link Here
|
| 946 |
|
978 |
|
| 947 |
if (gc->currentDpy == dpy) { |
979 |
if (gc->currentDpy == dpy) { |
| 948 |
/* Use opcode from gc because its right */ |
980 |
/* Use opcode from gc because its right */ |
|
|
981 |
INIT_MESA_SPARC |
| 949 |
return gc->majorOpcode; |
982 |
return gc->majorOpcode; |
| 950 |
} else { |
983 |
} else { |
| 951 |
/* |
984 |
/* |
|
Lines 1449-1451
Link Here
|
| 1449 |
} |
1482 |
} |
| 1450 |
} |
1483 |
} |
| 1451 |
#endif |
1484 |
#endif |
|
|
1485 |
|
| 1486 |
/* |
| 1487 |
* Used only when we are sparc, using sparc assembler. |
| 1488 |
* |
| 1489 |
*/ |
| 1490 |
|
| 1491 |
static void |
| 1492 |
_glx_mesa_init_sparc_glapi_relocs(void) |
| 1493 |
{ |
| 1494 |
#ifdef USE_SPARC_ASM |
| 1495 |
unsigned int *insn_ptr, *end_ptr; |
| 1496 |
unsigned long disp_addr; |
| 1497 |
|
| 1498 |
insn_ptr = &_mesa_sparc_glapi_begin; |
| 1499 |
end_ptr = &_mesa_sparc_glapi_end; |
| 1500 |
disp_addr = (unsigned long) &_glapi_Dispatch; |
| 1501 |
|
| 1502 |
/* |
| 1503 |
* Verbatim from Mesa sparc.c. It's needed because there doesn't |
| 1504 |
* seem to be a better way to do this: |
| 1505 |
* |
| 1506 |
* UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset ) |
| 1507 |
* |
| 1508 |
* This code is patching in the ADDRESS of the pointer to the |
| 1509 |
* dispatch table. Hence, it must be called exactly once, because |
| 1510 |
* that address is not going to change. |
| 1511 |
* |
| 1512 |
* What it points to can change, but Mesa (and hence, we) assume |
| 1513 |
* that there is only one pointer. |
| 1514 |
* |
| 1515 |
*/ |
| 1516 |
while (insn_ptr < end_ptr) { |
| 1517 |
#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) ) |
| 1518 |
/* |
| 1519 |
This code patches for 64-bit addresses. This had better |
| 1520 |
not happen for Sparc/Linux, no matter what architecture we |
| 1521 |
are building for. So, don't do this. |
| 1522 |
|
| 1523 |
The 'defined(__linux_64__)' is used here as a placeholder for |
| 1524 |
when we do do 64-bit usermode on sparc linux. |
| 1525 |
*/ |
| 1526 |
insn_ptr[0] |= (disp_addr >> (32 + 10)); |
| 1527 |
insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10); |
| 1528 |
__glapi_sparc_icache_flush(&insn_ptr[0]); |
| 1529 |
insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1)); |
| 1530 |
insn_ptr[3] |= (disp_addr & ((1 << 10) - 1)); |
| 1531 |
__glapi_sparc_icache_flush(&insn_ptr[2]); |
| 1532 |
insn_ptr += 11; |
| 1533 |
#else |
| 1534 |
insn_ptr[0] |= (disp_addr >> 10); |
| 1535 |
insn_ptr[1] |= (disp_addr & ((1 << 10) - 1)); |
| 1536 |
__glapi_sparc_icache_flush(&insn_ptr[0]); |
| 1537 |
insn_ptr += 5; |
| 1538 |
#endif |
| 1539 |
#else |
| 1540 |
/* Just no-op |
| 1541 |
* |
| 1542 |
*/ |
| 1543 |
#endif /* sparc ASM in use */ |
| 1544 |
} |
| 1545 |
} |