mirror of
https://github.com/apache/nuttx.git
synced 2026-08-12 16:06:51 +00:00
bcm2711/fb: Use physical device resolution OR force resolution
This change causes the frame buffer allocation to use the connected device's physical resolution by default. The user also has the option to force a request for a different, compile-time selected resolution if the physical display can support something else the user would prefer. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit is contained in:
parent
15a68ccc55
commit
0f14427658
2 changed files with 44 additions and 9 deletions
|
|
@ -340,6 +340,26 @@ config BCM2711_FRAMEBUFFER
|
|||
---help---
|
||||
Support for the VideoCore frame buffer interface.
|
||||
|
||||
config BCM2711_FB_WIDTH
|
||||
int "Default x resolution (width)"
|
||||
default 1920
|
||||
---help---
|
||||
The x resolution (width) of the frame buffer.
|
||||
|
||||
config BCM2711_FB_HEIGHT
|
||||
int "Default y resolution (height)"
|
||||
default 1080
|
||||
---help---
|
||||
The y resolution (height) of the frame buffer.
|
||||
|
||||
config BCM2711_FB_FORCE_RESOLUTION
|
||||
bool "Force resolution"
|
||||
depends on VIDEO_FB
|
||||
default n
|
||||
---help---
|
||||
Force the frame buffer allocation to use the default resolution instead
|
||||
of querying the physical display and using that.
|
||||
|
||||
endmenu # Broadcom BCM2711 Peripheral Selection
|
||||
|
||||
endif # ARCH_CHIP_BCM2711
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@
|
|||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Screen resolution */
|
||||
|
||||
#define FB_WIDTH (1920)
|
||||
#define FB_HEIGHT (1080)
|
||||
|
||||
/* Bits per pixel (32 for RGB) */
|
||||
|
||||
#define FB_BPP (32)
|
||||
|
|
@ -344,8 +339,8 @@ int up_fbinitialize(int display)
|
|||
{
|
||||
int err;
|
||||
uint8_t tries = 0;
|
||||
uint32_t xres = FB_WIDTH;
|
||||
uint32_t yres = FB_HEIGHT;
|
||||
uint32_t xres = CONFIG_BCM2711_FB_WIDTH;
|
||||
uint32_t yres = CONFIG_BCM2711_FB_HEIGHT;
|
||||
uint32_t bpp = FB_BPP;
|
||||
struct bcm2711_fb_s *priv;
|
||||
|
||||
|
|
@ -371,6 +366,24 @@ int up_fbinitialize(int display)
|
|||
priv->fb = NULL;
|
||||
priv->fbsize = 0;
|
||||
|
||||
#ifndef CONFIG_BCM2711_FB_FORCE_RESOLUTION
|
||||
/* Ask for physical resolution to choose the frame buffer resolution */
|
||||
|
||||
err = bcm2711_mbox_getdisp(&xres, &yres);
|
||||
if (err < 0)
|
||||
{
|
||||
gerr("Couldn't get display dimensions: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = bcm2711_mbox_getdepth(&bpp);
|
||||
if (err < 0)
|
||||
{
|
||||
gerr("Couldn't get display depth: %d", err);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the frame-buffer in a bulk request. Doing this piece-wise
|
||||
* never seems to work, always resulting a virtual resolution of 2x2 px.
|
||||
* This attempts the initialization three times since the operation always
|
||||
|
|
@ -391,12 +404,14 @@ int up_fbinitialize(int display)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (xres != FB_WIDTH || yres != FB_HEIGHT)
|
||||
#ifdef CONFIG_BCM2711_FB_FORCE_RESOLUTION
|
||||
if (xres != CONFIG_BCM2711_FB_WIDTH || yres != CONFIG_BCM2711_FB_HEIGHT)
|
||||
{
|
||||
gerr("Display mismatch: wanted %u x %u px, but got %u x %u px",
|
||||
FB_WIDTH, FB_HEIGHT, xres, yres);
|
||||
CONFIG_BCM2711_FB_WIDTH, CONFIG_BCM2711_FB_HEIGHT, xres, yres);
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bpp != FB_BPP)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue