libbcm_host api graphics_get_display_size hangs on original raspberry pi (armv6l), but not on Raspberry pi 3 (armv7l)
after recent firmware/kernel update to 4.9.11.
Sample program. rpi.c:
#include <stdio.h>
#include <stdint.h>
#include <bcm_host.h>
int main(void)
{
uint32_t screen_width, screen_height;
bcm_host_init();
printf("Calling graphics_get_display_size\n");
int32_t success = graphics_get_display_size(DISPMANX_ID_MAIN_LCD, &screen_width, &screen_height);
if (success < 0)
{
printf("graphics_get_display_size failed - %d\n", success);
}
else
{
printf("graphics_get_display_size ok width=%d, height=%d\n", screen_width, screen_height);
}
return 0;
}
built using:
gcc -O0 -g -o rpi rpi.c -I/opt/vc/include -L/opt/vc/lib -lbcm_host
On armvl6 it hangs here:
gdb rpi
run
...
Calling graphics_get_display_size
^C
Thread 1 "rpi" received signal SIGINT, Interrupt.
0x76ddbf70 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
(gdb) where
#0 0x76ddbf70 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
#1 0x76ddc0b4 in __new_sem_wait_slow.constprop.0 ()
from /usr/lib/libpthread.so.0
#2 0x76fa2868 in dispmanx_get_handle () from /opt/vc/lib/libbcm_host.so
#3 0x76fa3510 in vc_dispmanx_display_open () from /opt/vc/lib/libbcm_host.so
#4 0x76f977fc in graphics_get_display_size () from /opt/vc/lib/libbcm_host.so
#5 0x000106f4 in main () at rpi.c:10
on armv7l (RPI 3) works as expected.
./rpi
Calling graphics_get_display_size
graphics_get_display_size ok width=720, height=480
This was working ok on previous 4.4.x kernels on both models.
Regards
Andrew Roberts