X reports 24 bpp depth, but wants 32 bpp size pixels
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1363 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
0b22346cac
commit
2dcc77a557
@ -228,7 +228,7 @@ static void up_x11uninitialize(void)
|
|||||||
* Name: up_x11mapsharedmem
|
* Name: up_x11mapsharedmem
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static inline int up_x11mapsharedmem(int bpp, unsigned int fblen)
|
static inline int up_x11mapsharedmem(int depth, unsigned int fblen)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_SIM_X11NOSHM
|
#ifndef CONFIG_SIM_X11NOSHM
|
||||||
Status result;
|
Status result;
|
||||||
@ -246,7 +246,7 @@ static inline int up_x11mapsharedmem(int bpp, unsigned int fblen)
|
|||||||
|
|
||||||
up_x11traperrors();
|
up_x11traperrors();
|
||||||
g_image = XShmCreateImage(g_display, DefaultVisual(g_display, g_screen),
|
g_image = XShmCreateImage(g_display, DefaultVisual(g_display, g_screen),
|
||||||
bpp, ZPixmap, NULL, &g_xshminfo,
|
depth, ZPixmap, NULL, &g_xshminfo,
|
||||||
g_fbpixelwidth, g_fbpixelheight);
|
g_fbpixelwidth, g_fbpixelheight);
|
||||||
if (up_x11untraperrors())
|
if (up_x11untraperrors())
|
||||||
{
|
{
|
||||||
@ -303,7 +303,7 @@ shmerror:
|
|||||||
|
|
||||||
g_framebuffer = (unsigned char*)malloc(fblen);
|
g_framebuffer = (unsigned char*)malloc(fblen);
|
||||||
|
|
||||||
g_image = XCreateImage(g_display, DefaultVisual(g_display,g_screen), bpp,
|
g_image = XCreateImage(g_display, DefaultVisual(g_display,g_screen), depth,
|
||||||
ZPixmap, 0, (char*)g_framebuffer, g_fbpixelwidth, g_fbpixelheight,
|
ZPixmap, 0, (char*)g_framebuffer, g_fbpixelwidth, g_fbpixelheight,
|
||||||
8, 0);
|
8, 0);
|
||||||
|
|
||||||
@ -335,6 +335,7 @@ int up_x11initialize(unsigned short width, unsigned short height,
|
|||||||
unsigned short *stride)
|
unsigned short *stride)
|
||||||
{
|
{
|
||||||
XWindowAttributes windowAttributes;
|
XWindowAttributes windowAttributes;
|
||||||
|
int depth;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Save inputs */
|
/* Save inputs */
|
||||||
@ -353,10 +354,20 @@ int up_x11initialize(unsigned short width, unsigned short height,
|
|||||||
/* Determine the supported pixel bpp of the current window */
|
/* Determine the supported pixel bpp of the current window */
|
||||||
|
|
||||||
XGetWindowAttributes(g_display, DefaultRootWindow(g_display), &windowAttributes);
|
XGetWindowAttributes(g_display, DefaultRootWindow(g_display), &windowAttributes);
|
||||||
printf("Pixel bpp is %d bits\n", windowAttributes.depth);
|
|
||||||
|
|
||||||
*bpp = windowAttributes.depth;
|
/* Get the pixel depth. If the depth is 24-bits, use 32 because X expects
|
||||||
*stride = (windowAttributes.depth * width / 8);
|
* 32-bit aligment anyway.
|
||||||
|
*/
|
||||||
|
|
||||||
|
depth = windowAttributes.depth;
|
||||||
|
if (depth == 24)
|
||||||
|
{
|
||||||
|
depth = 32;
|
||||||
|
}
|
||||||
|
printf("Pixel bpp is %d bits (using %d)\n", windowAttributes.depth, depth);
|
||||||
|
|
||||||
|
*bpp = depth;
|
||||||
|
*stride = (depth * width / 8);
|
||||||
*fblen = (*stride * height);
|
*fblen = (*stride * height);
|
||||||
|
|
||||||
/* Map the window to shared memory */
|
/* Map the window to shared memory */
|
||||||
|
@ -42,10 +42,16 @@ nx
|
|||||||
CONFIG_SIM_FBBPP - Pixel depth in bits
|
CONFIG_SIM_FBBPP - Pixel depth in bits
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
- If CONFIG_SIM_X11FB is selected then CONFIG_SIM_FBBPP must
|
- If CONFIG_SIM_X11FB is selected then the following are
|
||||||
match the resolution of the display.
|
needed
|
||||||
|
|
||||||
|
CONFIG_SIM_FBBPP (must match the resolution of the display).
|
||||||
|
CONFIG_FB_CMAP=y
|
||||||
|
|
||||||
|
My system has 24-bit color, but packed into 32-bit words so
|
||||||
|
the correct seeting of CONFIG_SIM_FBBPP is 32.
|
||||||
- For whatever value of CONFIG_SIM_FBBPP is selected, then
|
- For whatever value of CONFIG_SIM_FBBPP is selected, then
|
||||||
the corresponing CONFIG_NXGLIB_DISABLE_*BPP setting must
|
the corresponidng CONFIG_NXGLIB_DISABLE_*BPP setting must
|
||||||
not be disabled.
|
not be disabled.
|
||||||
- The default in defconfig is to use a generic memory buffer
|
- The default in defconfig is to use a generic memory buffer
|
||||||
for the framebuffer. defconfig-x11 is an example with X11
|
for the framebuffer. defconfig-x11 is an example with X11
|
||||||
|
@ -224,6 +224,14 @@ CONFIG_MAX_WDOGPARMS=4
|
|||||||
CONFIG_PREALLOC_WDOGS=32
|
CONFIG_PREALLOC_WDOGS=32
|
||||||
CONFIG_PREALLOC_TIMERS=8
|
CONFIG_PREALLOC_TIMERS=8
|
||||||
|
|
||||||
|
#
|
||||||
|
# Framebuffer driver options
|
||||||
|
CONFIG_FB_CMAP=n
|
||||||
|
CONFIG_FB_HWCURSOR=n
|
||||||
|
CONFIG_FB_HWCURSORIMAGE=n
|
||||||
|
#CONFIG_FB_HWCURSORSIZE
|
||||||
|
#CONFIG_FB_TRANSPARENCY
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem configuration
|
# FAT filesystem configuration
|
||||||
# CONFIG_FS_FAT - Enable FAT filesystem support
|
# CONFIG_FS_FAT - Enable FAT filesystem support
|
||||||
|
@ -54,7 +54,7 @@ CONFIG_ARCH_BOARD_SIM=y
|
|||||||
CONFIG_SIM_X11FB=y
|
CONFIG_SIM_X11FB=y
|
||||||
CONFIG_SIM_FBWIDTH=480
|
CONFIG_SIM_FBWIDTH=480
|
||||||
CONFIG_SIM_FBHEIGHT=240
|
CONFIG_SIM_FBHEIGHT=240
|
||||||
CONFIG_SIM_FBBPP=24
|
CONFIG_SIM_FBBPP=32
|
||||||
|
|
||||||
#
|
#
|
||||||
# General OS setup
|
# General OS setup
|
||||||
@ -224,6 +224,14 @@ CONFIG_MAX_WDOGPARMS=4
|
|||||||
CONFIG_PREALLOC_WDOGS=32
|
CONFIG_PREALLOC_WDOGS=32
|
||||||
CONFIG_PREALLOC_TIMERS=8
|
CONFIG_PREALLOC_TIMERS=8
|
||||||
|
|
||||||
|
#
|
||||||
|
# Framebuffer driver options
|
||||||
|
CONFIG_FB_CMAP=y
|
||||||
|
CONFIG_FB_HWCURSOR=n
|
||||||
|
CONFIG_FB_HWCURSORIMAGE=n
|
||||||
|
#CONFIG_FB_HWCURSORSIZE
|
||||||
|
#CONFIG_FB_TRANSPARENCY
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem configuration
|
# FAT filesystem configuration
|
||||||
# CONFIG_FS_FAT - Enable FAT filesystem support
|
# CONFIG_FS_FAT - Enable FAT filesystem support
|
||||||
@ -330,8 +338,8 @@ CONFIG_NXGLIB_DISABLE_2BPP=y
|
|||||||
CONFIG_NXGLIB_DISABLE_4BPP=y
|
CONFIG_NXGLIB_DISABLE_4BPP=y
|
||||||
CONFIG_NXGLIB_DISABLE_8BPP=y
|
CONFIG_NXGLIB_DISABLE_8BPP=y
|
||||||
CONFIG_NXGLIB_DISABLE_16BPP=y
|
CONFIG_NXGLIB_DISABLE_16BPP=y
|
||||||
CONFIG_NXGLIB_DISABLE_24BPP=n
|
CONFIG_NXGLIB_DISABLE_24BPP=y
|
||||||
CONFIG_NXGLIB_DISABLE_32BPP=y
|
CONFIG_NXGLIB_DISABLE_32BPP=n
|
||||||
CONFIG_NXGL_PACKEDMSFIRST=n
|
CONFIG_NXGL_PACKEDMSFIRST=n
|
||||||
CONFIG_NX_MOUSE=n
|
CONFIG_NX_MOUSE=n
|
||||||
CONFIG_NX_KBD=n
|
CONFIG_NX_KBD=n
|
||||||
|
Loading…
Reference in New Issue
Block a user