Merge pull request #1211 from kwagyeman/kwabena/fb_alloc_cleanup

Cleanup FB_ALLOC_OVERLAY pointers
This commit is contained in:
Ibrahim Abd Elkader 2021-03-08 02:41:06 +02:00 committed by GitHub
commit afb8f9e47d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 10 deletions

View File

@ -28,8 +28,8 @@ static uint32_t alloc_bytes_peak;
#if defined(OMV_FB_OVERLAY_MEMORY)
#define FB_OVERLAY_MEMORY_FLAG 0x1
extern char _fballoc_overlay;
static char *pointer_overlay = &_fballoc_overlay;
extern char _fballoc_overlay_end, _fballoc_overlay_start;
static char *pointer_overlay = &_fballoc_overlay_end;
#endif
// fb_alloc_free_till_mark() will not free past this.
@ -57,7 +57,7 @@ void fb_alloc_init0()
{
pointer = &_fballoc;
#if defined(OMV_FB_OVERLAY_MEMORY)
pointer_overlay = &_fballoc_overlay;
pointer_overlay = &_fballoc_overlay_end;
#endif
}
@ -167,7 +167,7 @@ void *fb_alloc(uint32_t size, int hints)
#if defined(OMV_FB_OVERLAY_MEMORY)
if ((!(hints & FB_ALLOC_PREFER_SIZE))
&& (((uint32_t) (pointer_overlay - OMV_FB_OVERLAY_MEMORY_ORIGIN)) >= size)) {
&& (((uint32_t) (pointer_overlay - &_fballoc_overlay_start)) >= size)) {
// Return overlay memory instead.
pointer_overlay -= size;
result = pointer_overlay;
@ -204,7 +204,7 @@ void *fb_alloc_all(uint32_t *size, int hints)
#if defined(OMV_FB_OVERLAY_MEMORY)
if (!(hints & FB_ALLOC_PREFER_SIZE)) {
*size = (uint32_t) (pointer_overlay - OMV_FB_OVERLAY_MEMORY_ORIGIN);
*size = (uint32_t) (pointer_overlay - &_fballoc_overlay_start);
temp = IM_MIN(temp, *size);
}
#endif

View File

@ -179,7 +179,6 @@
#define OMV_AXI_SRAM_LENGTH 512K
#define OMV_DRAM_ORIGIN 0xC0000000
#define OMV_DRAM_LENGTH 32M
#define OMV_FB_OVERLAY_MEMORY_ORIGIN OMV_AXI_SRAM_ORIGIN
// Domain 1 DMA buffers region.
#define OMV_DMA_MEMORY_D1 AXI_SRAM

View File

@ -176,7 +176,6 @@
#define OMV_AXI_SRAM_LENGTH 512K
#define OMV_DRAM_ORIGIN 0xC0000000
#define OMV_DRAM_LENGTH 64M
#define OMV_FB_OVERLAY_MEMORY_ORIGIN OMV_AXI_SRAM_ORIGIN
// Domain 1 DMA buffers region.
#define OMV_DMA_MEMORY_D1 AXI_SRAM

View File

@ -179,7 +179,6 @@
#define OMV_DRAM_LENGTH 8M
#define OMV_FLASH_EXT_ORIGIN 0x90000000
#define OMV_FLASH_EXT_LENGTH 16M
#define OMV_FB_OVERLAY_MEMORY_ORIGIN OMV_AXI_SRAM_ORIGIN
// Domain 1 DMA buffers region.
#define OMV_DMA_MEMORY_D1 AXI_SRAM

View File

@ -126,7 +126,6 @@ SECTIONS
. = ALIGN(4);
_fballoc_overlay_start = .;
. = . + OMV_FB_OVERLAY_MEMORY_OFFSET;
_fballoc_overlay = .;
_fballoc_overlay_end = .;
} >OMV_FB_OVERLAY_MEMORY
#endif

View File

@ -107,7 +107,6 @@ SECTIONS
. = ALIGN(4);
_fballoc_overlay_start = .;
. = . + OMV_FB_OVERLAY_MEMORY_OFFSET;
_fballoc_overlay = .;
_fballoc_overlay_end = .;
} >OMV_FB_OVERLAY_MEMORY
#endif