diff --git a/arch/arm/src/lpc17xx/Kconfig b/arch/arm/src/lpc17xx/Kconfig index 2b25d41601..b75adb5d52 100644 --- a/arch/arm/src/lpc17xx/Kconfig +++ b/arch/arm/src/lpc17xx/Kconfig @@ -451,6 +451,18 @@ config LPC17_EXTDRAMHEAP ---help--- Add the external SDRAM into the heap. +config LPC17_EXTDRAMHEAP_OFFSET + int "DRAM heap offset" + default 0 + depends on LPC17_EXTDRAMHEAP + ---help--- + Memory may be reserved at the beginning of DRAM for other purposes + (for example for video framebuffers). Memory can similar be + reserved at the end of DRAM using LPC17_EXTDRAMSIZE. The amount to + be added to the heap will be from DRAM_BASE + LPC17_EXTDRAMHEAP_OFFSET + through DRAM_BASE + LPC17_EXTDRAMSIZE where (DRAM_BASE is the base + address of CS0). + endif config LPC17_EXTSRAM0 diff --git a/arch/arm/src/lpc17xx/lpc17_allocateheap.c b/arch/arm/src/lpc17xx/lpc17_allocateheap.c index e2ca6933ca..b97c8b055d 100644 --- a/arch/arm/src/lpc17xx/lpc17_allocateheap.c +++ b/arch/arm/src/lpc17xx/lpc17_allocateheap.c @@ -381,6 +381,14 @@ void up_addregion(void) #if CONFIG_MM_REGIONS >= 3 #if defined(CONFIG_LPC17_EXTDRAM) && defined(CONFIG_LPC17_EXTDRAMHEAP) { + /* Memory may be reserved at the beginning of DRAM for other purposes + * (for example for video framebuffers). Memory can similar be + * reserved at the end of DRAM using LPC17_EXTDRAMSIZE. The amount to + * be added to the heap will be from DRAM_BASE + LPC17_EXTDRAMHEAP_OFFSET + * through DRAM_BASE + LPC17_EXTDRAMSIZE where (DRAM_BASE is the base + * address of CS0). + */ + uintptr_t dram_end = LPC17_EXTDRAM_CS0 + CONFIG_LPC17_EXTDRAMSIZE; uintptr_t dram_start; uintptr_t heap_size; @@ -398,9 +406,11 @@ void up_addregion(void) } else { - /* Use the entire SDRAM for heap */ + /* Use the entire SDRAM for heap (possible reserving a portion at + * the beginning of DRAM. + */ - dram_start = LPC17_EXTDRAM_CS0; + dram_start = LPC17_EXTDRAM_CS0 + CONFIG_LPC17_EXTDRAMHEAP_OFFSET; } heap_size = dram_end - dram_start; diff --git a/configs/open1788/README.txt b/configs/open1788/README.txt index 4886234b8d..1a06568375 100644 --- a/configs/open1788/README.txt +++ b/configs/open1788/README.txt @@ -572,3 +572,12 @@ Configuration Directories has been verified that the pdcurses demos that require menu interactions work well with the discrete joystick. + pwfb: + ----- + + This configuration uses the test at apps/examples/pwfb to verify the + operation of the per-window framebuffers. + + STATUS: + 2019-03-16: The test does not succeed. There are still numerou + problems to be overcome. diff --git a/configs/open1788/pwfb/defconfig b/configs/open1788/pwfb/defconfig new file mode 100644 index 0000000000..709581c27e --- /dev/null +++ b/configs/open1788/pwfb/defconfig @@ -0,0 +1,66 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_EXAMPLES_PWFB_DEFAULT_COLORS is not set +# CONFIG_EXAMPLES_PWFB_DEFAULT_FONT is not set +# CONFIG_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="open1788" +CONFIG_ARCH_BOARD_OPEN1788=y +CONFIG_ARCH_CHIP_LPC1788=y +CONFIG_ARCH_CHIP_LPC17XX=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARM_MPU=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=11934 +CONFIG_EXAMPLES_PWFB=y +CONFIG_EXAMPLES_PWFB_BGCOLOR=0x7b5d +CONFIG_EXAMPLES_PWFB_BPP=16 +CONFIG_EXAMPLES_PWFB_COLOR1=0xe73f +CONFIG_EXAMPLES_PWFB_COLOR2=0xdefb +CONFIG_EXAMPLES_PWFB_COLOR3=0xff76 +CONFIG_EXAMPLES_PWFB_FONTCOLOR=0x0000 +CONFIG_EXAMPLES_PWFB_FONTID=1 +CONFIG_EXPERIMENTAL=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LPC17_EXTDRAM=y +CONFIG_LPC17_EXTDRAMHEAP_OFFSET=393216 +CONFIG_LPC17_EXTDRAMSIZE=67108864 +CONFIG_LPC17_GPDMA=y +CONFIG_LPC17_LCD=y +CONFIG_LPC17_LCD_BPP16=y +CONFIG_LPC17_UART0=y +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MMCSD=y +CONFIG_MM_REGIONS=3 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LIBRARY=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONT_SANS23X27=y +CONFIG_NX_BLOCKING=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_RAM_SIZE=65536 +CONFIG_RAM_START=0x10000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=16 +CONFIG_START_MONTH=3 +CONFIG_START_YEAR=2019 +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_TASK_NAME_SIZE=0 +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USER_ENTRYPOINT="pwfb_main" +CONFIG_WDOG_INTRESERVE=0 diff --git a/graphics/nxbe/nxbe_setsize.c b/graphics/nxbe/nxbe_setsize.c index 63379b14e1..f7e77067ec 100644 --- a/graphics/nxbe/nxbe_setsize.c +++ b/graphics/nxbe/nxbe_setsize.c @@ -117,7 +117,7 @@ static void nxbe_realloc(FAR struct nxbe_window_s *wnd, newidth = wnd->bounds.pt2.x - wnd->bounds.pt1.x + 1; newheight = wnd->bounds.pt2.y - wnd->bounds.pt1.y + 1; bpp = wnd->be->plane[0].pinfo.bpp; - newstride = (bpp * newidth + 7) >> 8; + newstride = (bpp * newidth + 7) >> 3; newfbsize = newstride * newheight; #ifdef CONFIG_BUILD_KERNEL @@ -134,7 +134,9 @@ static void nxbe_realloc(FAR struct nxbe_window_s *wnd, { /* Fall back to no RAM back up */ - gerr("ERROR: mm_pgalloc() failed\n"); + gerr("ERROR: mm_pgalloc() failed for fbsize=%lu, npages=%u\n", + (unsigned long)newfbsize, npages); + mm_pgfree(wnd->fbmem, wnd->npages); wnd->stride = 0; wnd->npages = 0; @@ -150,7 +152,9 @@ static void nxbe_realloc(FAR struct nxbe_window_s *wnd, { /* Fall back to no RAM back up */ - gerr("ERROR: mm_pgalloc() failed\n"); + gerr("ERROR: kumm_malloc() failed for fbsize=%lu\n", + (unsigned long)newfbsize); + kumm_free(wnd->fbmem); wnd->stride = 0; wnd->fbmem = NULL; diff --git a/graphics/nxmu/nxmu_openwindow.c b/graphics/nxmu/nxmu_openwindow.c index 6e12bcc297..94836f687b 100644 --- a/graphics/nxmu/nxmu_openwindow.c +++ b/graphics/nxmu/nxmu_openwindow.c @@ -106,7 +106,7 @@ void nxmu_openwindow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd) width = wnd->bounds.pt2.x - wnd->bounds.pt1.x + 1; height = wnd->bounds.pt2.y - wnd->bounds.pt1.y + 1; bpp = wnd->be->plane[0].pinfo.bpp; - wnd->stride = (bpp * width + 7) >> 8; + wnd->stride = (bpp * width + 7) >> 3; fbsize = wnd->stride * height; #ifdef CONFIG_BUILD_KERNEL @@ -129,7 +129,9 @@ void nxmu_openwindow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd) { /* Fall back to no RAM back up */ - gerr("ERROR: mm_pgalloc() failed\n"); + gerr("ERROR: mm_pgalloc() failed for fbsize=%lu, npages=%u\n", + (unsigned long)fbsize, wnd->npages); + wnd->stride = 0; wnd->npages = 0; NXBE_CLRRAMBACKED(wnd); @@ -148,7 +150,9 @@ void nxmu_openwindow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd) { /* Fall back to no RAM back up */ - gerr("ERROR: mm_pgalloc() failed\n"); + gerr("ERROR: kumm_malloc() failed for fbsize=%lu\n", + (unsigned long)fbsize); + wnd->stride = 0; NXBE_CLRRAMBACKED(wnd); } diff --git a/graphics/nxmu/nxmu_redrawreq.c b/graphics/nxmu/nxmu_redrawreq.c index 6dc7e8caaa..00e84b92a6 100644 --- a/graphics/nxmu/nxmu_redrawreq.c +++ b/graphics/nxmu/nxmu_redrawreq.c @@ -69,6 +69,7 @@ void nxmu_redrawreq(FAR struct nxbe_window_s *wnd, if (NXBE_ISRAMBACKED(wnd)) { + struct nxgl_rect_s wndrect; FAR const void *src[CONFIG_NX_NPLANES] = { (FAR const void *)wnd->fbmem @@ -78,7 +79,14 @@ void nxmu_redrawreq(FAR struct nxbe_window_s *wnd, 0, 0 }; - nxbe_bitmap_dev(wnd, rect, src, &origin, wnd->stride); + /* Put the rectangle back relative to the window */ + + nxgl_rectoffset(&wndrect, rect, + -wnd->bounds.pt1.x, -wnd->bounds.pt1.y); + + /* And render the bitmap */ + + nxbe_bitmap_dev(wnd, &wndrect, src, &origin, wnd->stride); } else #endif @@ -97,4 +105,3 @@ void nxmu_redrawreq(FAR struct nxbe_window_s *wnd, sizeof(struct nxclimsg_redraw_s)); } } -