kingbox1 wrote: ↑
Tue Aug 20, 2019 6:00 am
I have recently got my new pi4 device. However, I am getting trouble trying to get the device id of my primary monitor.
I am using vc_dispmanx_display_open(int device_id) to open a display when i want to draw something to that monitor and I managed to find that the device_id for two display output port on pi4 is 2 and 7(weird....) and I can use Xrandr or Xinerama extension sdk to get the monitor layout or the primary monitor and its position. However, I cannot find a way to map the primary monitor to the device id(2 or 7). Any advice??
I'm not entirely sure what you're trying to achieve, but the display ids 2/7 (if you're curious what other ids exist, have a look at /opt/vc/include/interface/vmcs_host/vc_dispmanx_types.h
) are relevant for dispmanx, while X now uses DRM to show content. The latter doesn't expose the internally used dispmanx display ids, so the only way to correlate them AFAIK is to use the offset within the display_number array from vc_tv_get_attached_devices and the connectors returned by drmModeGetResources. See also here