* actually set device_chipset before reading it.

* make shared memory info naming clearer.
* move frame buffer internal offset read to driver
* remove check of > 512MB as we really should always use frame_buffer_size


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41569 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV
2011-05-18 18:38:28 +00:00
parent c2069a9a2e
commit 90af954387
3 changed files with 28 additions and 22 deletions
@@ -74,16 +74,19 @@ struct radeon_shared_info {
uint8* status_page;
addr_t physical_status_page;
uint8* graphics_memory;
addr_t physical_graphics_memory;
uint32 graphics_memory_size;
uint32 graphics_aperture_size;
addr_t frame_buffer_base; // map base of frame buffer
addr_t frame_buffer_phys; // card PCI BAR address of FB
uint32 frame_buffer_int; // card internal offset of FB
uint32 frame_buffer_size; // card internal FB aperture size
uint32 frame_buffer_pci; // physical PCI address of FB
uint32 frame_buffer_offset; // offset within FB (pri vs sec)
bool has_edid;
edid1_info edid_info;
addr_t frame_buffer;
uint32 frame_buffer_offset;
struct lock accelerant_lock;
struct lock engine_lock;
+3 -3
View File
@@ -190,11 +190,11 @@ CardFBSet(int crtNumber, display_mode *mode)
// only for chipsets > r600
// R5xx - RS690 case is GRPH_CONTROL bit 16
uint32 fbIntAddress = read32(R6XX_CONFIG_FB_BASE);
uint32 fbIntAddress = gInfo->shared_info->frame_buffer_int;
uint32 fbOffset = gInfo->shared_info->frame_buffer_offset;
write32(regOffset + gRegister->grphPrimarySurfaceAddr,
fbOffset + fbIntAddress);
fbIntAddress + fbOffset);
write32(regOffset + gRegister->grphPitch, bytesPerRow / 4);
write32(regOffset + gRegister->grphSurfaceOffsetX, 0);
@@ -347,7 +347,7 @@ radeon_get_frame_buffer_config(frame_buffer_config *config)
config->frame_buffer = gInfo->shared_info->graphics_memory + offset;
config->frame_buffer_dma
= (uint8 *)gInfo->shared_info->physical_graphics_memory + offset;
= (uint8 *)gInfo->shared_info->frame_buffer_phys + offset;
config->bytes_per_row = gInfo->shared_info->bytes_per_row;
return B_OK;
@@ -90,10 +90,11 @@ radeon_hd_init(radeon_info &info)
mmioMapper.Detach();
frambufferMapper.Detach();
info.shared_info->device_chipset = info.device_chipset;
info.shared_info->registers_area = info.registers_area;
info.shared_info->frame_buffer_offset = 0;
info.shared_info->physical_graphics_memory
info.shared_info->frame_buffer_phys
= info.pci->u.h0.base_registers[RHD_FB_BAR];
info.shared_info->frame_buffer_offset = 0;
// Pull active monitor VESA EDID from boot loader
edid1_info* edidInfo = (edid1_info*)get_boot_item(EDID_BOOT_INFO,
@@ -109,33 +110,35 @@ radeon_hd_init(radeon_info &info)
info.shared_info->has_edid = false;
}
info.shared_info->frame_buffer_int
= read32(info.registers + R6XX_CONFIG_FB_BASE);
// Populate graphics_memory/aperture_size with KB
if (info.shared_info->device_chipset >= RADEON_R800) {
// R800+ has memory stored in MB
info.shared_info->graphics_memory_size
= read32(info.registers + R6XX_CONFIG_MEMSIZE) * 1024;
info.shared_info->graphics_aperture_size
info.shared_info->frame_buffer_size
= read32(info.registers + R6XX_CONFIG_APER_SIZE) * 1024;
} else {
// R600-R700 has memory stored in bytes
info.shared_info->graphics_memory_size
= read32(info.registers + R6XX_CONFIG_MEMSIZE) / 1024;
info.shared_info->graphics_aperture_size
info.shared_info->frame_buffer_size
= read32(info.registers + R6XX_CONFIG_APER_SIZE) / 1024;
}
int32 memory_size = info.shared_info->graphics_memory_size / 1024;
int32 aperture_size = info.shared_info->graphics_aperture_size / 1024;
TRACE("card(%ld): found %ld MB memory on card.\n", info.id,
memory_size);
TRACE("card(%ld): found %ld MB aperture on card.\n", info.id,
aperture_size);
int32 frame_buffer_size = info.shared_info->frame_buffer_size / 1024;
// if there are more then 512MB memory on the card, only map
// the aperture size to prevent overflow of gart
if (info.shared_info->graphics_memory_size > 524288)
info.shared_info->graphics_memory_size
= info.shared_info->graphics_aperture_size;
TRACE("card(%ld): Found %ld MB memory on card\n", info.id,
memory_size);
TRACE("card(%ld): Frame buffer aperture internal location is %08x\n",
info.id, (unsigned int)info.shared_info->frame_buffer_int);
TRACE("card(%ld): Frame buffer aperture size is %ld MB\n", info.id,
frame_buffer_size);
TRACE("card(%ld): %s completed successfully!\n", info.id, __func__);
return B_OK;