Update the (old) radeon driver to work with Haiku. We need to explicitly tell that the areas are B_USER_CLONEABLE_AREA's that they can be shared with the accelerant.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12002 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2005-03-25 20:15:46 +00:00
parent 22cf66212c
commit e72fa01ce3
3 changed files with 10 additions and 6 deletions
@@ -401,6 +401,8 @@ static status_t initRingBuffer( device_info *di, int aring_size )
OUTREG( regs, RADEON_CP_RB_WPTR, 0 ); OUTREG( regs, RADEON_CP_RB_WPTR, 0 );
//*cp->ring.head = 0; //*cp->ring.head = 0;
cp->ring.tail = 0; cp->ring.tail = 0;
return B_OK;
} }
static void uninitRingBuffer( device_info *di ) static void uninitRingBuffer( device_info *di )
@@ -455,6 +457,8 @@ static status_t initCPFeedback( device_info *di )
*(uint32 *)MEM2CPU( cp->feedback.mem_type, cp->feedback.head_mem_offset) = 0; *(uint32 *)MEM2CPU( cp->feedback.mem_type, cp->feedback.head_mem_offset) = 0;
memset( MEM2CPU( cp->feedback.mem_type, cp->feedback.scratch_mem_offset), 0, 0x40 ); memset( MEM2CPU( cp->feedback.mem_type, cp->feedback.scratch_mem_offset), 0, 0x40 );
//*cp->ring.head = 0; //*cp->ring.head = 0;
return B_OK;
} }
static void uninitCPFeedback( device_info *di ) static void uninitCPFeedback( device_info *di )
@@ -48,7 +48,7 @@ static status_t createGARTBuffer( GART_info *gart, size_t size )
// the DMA buffer, we have to grant access for all apps // the DMA buffer, we have to grant access for all apps
gart->buffer.area = create_area( "Radeon PCI GART buffer", gart->buffer.area = create_area( "Radeon PCI GART buffer",
&gart->buffer.ptr, B_ANY_KERNEL_ADDRESS, &gart->buffer.ptr, B_ANY_KERNEL_ADDRESS,
size, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA ); size, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA );
if( gart->buffer.area < 0 ) { if( gart->buffer.area < 0 ) {
SHOW_ERROR( 1, "cannot create PCI GART buffer (%s)", SHOW_ERROR( 1, "cannot create PCI GART buffer (%s)",
strerror( gart->buffer.area )); strerror( gart->buffer.area ));
@@ -80,7 +80,7 @@ static status_t createGARTBuffer( GART_info *gart, size_t size )
// question: is this necessary for a PCI GART because of bus snooping? // question: is this necessary for a PCI GART because of bus snooping?
gart->buffer.unaligned_area = create_area( "Radeon PCI GART buffer", gart->buffer.unaligned_area = create_area( "Radeon PCI GART buffer",
&unaligned_addr, B_ANY_KERNEL_ADDRESS, &unaligned_addr, B_ANY_KERNEL_ADDRESS,
2 * size, B_CONTIGUOUS/*B_FULL_LOCK*/, B_READ_AREA | B_WRITE_AREA ); 2 * size, B_CONTIGUOUS/*B_FULL_LOCK*/, B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA );
if( gart->buffer.unaligned_area < 0 ) { if( gart->buffer.unaligned_area < 0 ) {
SHOW_ERROR( 1, "cannot create PCI GART buffer (%s)", SHOW_ERROR( 1, "cannot create PCI GART buffer (%s)",
strerror( gart->buffer.unaligned_area )); strerror( gart->buffer.unaligned_area ));
@@ -139,7 +139,7 @@ static status_t initGATT( GART_info *gart )
gart->GATT.area = create_area( "Radeon GATT", (void **)&gart->GATT.ptr, gart->GATT.area = create_area( "Radeon GATT", (void **)&gart->GATT.ptr,
B_ANY_KERNEL_ADDRESS, B_ANY_KERNEL_ADDRESS,
(num_pages * sizeof( uint32 ) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1), (num_pages * sizeof( uint32 ) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1),
B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA ); B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA );
if( gart->GATT.area < 0 ) { if( gart->GATT.area < 0 ) {
SHOW_ERROR( 1, "cannot create GATT table (%s)", SHOW_ERROR( 1, "cannot create GATT table (%s)",
@@ -67,7 +67,7 @@ status_t Radeon_MapDevice( device_info *di, bool mmio_only )
di->pcii.u.h0.base_register_sizes[regs], di->pcii.u.h0.base_register_sizes[regs],
B_ANY_KERNEL_ADDRESS, B_ANY_KERNEL_ADDRESS,
/*// for "poke" debugging /*// for "poke" debugging
B_READ_AREA + B_WRITE_AREA*/0, B_READ_AREA + B_WRITE_AREA*/ B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
(void **)&(di->regs)); (void **)&(di->regs));
if( si->regs_area < 0 ) if( si->regs_area < 0 )
return si->regs_area; return si->regs_area;
@@ -204,7 +204,7 @@ status_t Radeon_FirstOpen( device_info *di )
(void **)&(di->si), (void **)&(di->si),
B_ANY_KERNEL_ADDRESS, B_ANY_KERNEL_ADDRESS,
(sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1), (sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1),
B_FULL_LOCK, 0); B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
if (di->shared_area < 0) { if (di->shared_area < 0) {
result = di->shared_area; result = di->shared_area;
goto err8; goto err8;
@@ -257,7 +257,7 @@ status_t Radeon_FirstOpen( device_info *di )
(void **)&(di->vc), (void **)&(di->vc),
B_ANY_KERNEL_ADDRESS, B_ANY_KERNEL_ADDRESS,
(sizeof(virtual_card) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1), (sizeof(virtual_card) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1),
B_FULL_LOCK, 0); B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
if (di->virtual_card_area < 0) { if (di->virtual_card_area < 0) {
result = di->virtual_card_area; result = di->virtual_card_area;
goto err7; goto err7;