* add allocation of atombios fb scratch
* add free of allocated fb scratch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42591 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7a2d0c5e92
commit
77e8ac07c6
@ -1272,6 +1272,7 @@ atom_destroy(atom_context *ctx)
|
||||
{
|
||||
if (ctx != NULL) {
|
||||
free(ctx->iio);
|
||||
free(ctx->scratch);
|
||||
delete_sem(ctx->exec_sem);
|
||||
}
|
||||
|
||||
@ -1319,3 +1320,32 @@ atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev,
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
atom_allocate_fb_scratch(atom_context *ctx)
|
||||
{
|
||||
int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware);
|
||||
uint16 data_offset;
|
||||
int usage_bytes = 0;
|
||||
_ATOM_VRAM_USAGE_BY_FIRMWARE *firmware;
|
||||
|
||||
if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) {
|
||||
firmware = (_ATOM_VRAM_USAGE_BY_FIRMWARE *)
|
||||
((uint16*)ctx->bios + data_offset);
|
||||
|
||||
TRACE("Atom firmware requested 0x%" B_PRIX32 " %" B_PRIu16 "kb\n",
|
||||
firmware->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware,
|
||||
firmware->asFirmwareVramReserveInfo[0].usFirmwareUseInKb);
|
||||
|
||||
usage_bytes
|
||||
= firmware->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024;
|
||||
}
|
||||
if (usage_bytes == 0)
|
||||
usage_bytes = 20 * 1024;
|
||||
/* allocate some scratch memory */
|
||||
ctx->scratch = (uint32*)malloc(usage_bytes);
|
||||
if (!ctx->scratch)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -154,5 +154,7 @@ status_t atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev,
|
||||
uint8 * crev);
|
||||
status_t atom_asic_init(atom_context *);
|
||||
void atom_destroy(atom_context *);
|
||||
status_t atom_allocate_fb_scratch(atom_context *ctx);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -111,6 +111,7 @@ radeon_init_bios(uint8* bios)
|
||||
// Post card
|
||||
|
||||
radeon_bios_init_scratch();
|
||||
atom_allocate_fb_scratch(gAtomContext);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user