lvgl/lvgl

What pass `connector_id` in `lv_linux_drm_set_file` on first time setup?

Closed this issue Β· 14 comments

LVGL version

v9.1.0

What happened?

lv_linux_drm_set_file is need connector_id, but I can't get it anywhere, it's design defects?
I try 0, itn's work.

How to reproduce?

    lv_init();

    lv_display_t * display = lv_linux_drm_create();

    lv_linux_drm_set_file(display, "/dev/dri/card0", 0);

If there is no first call to lv_linux_drm_set_file, then fb is -1, and the connector_id cannot be obtained. Only after calling lv_linux_drm_set_file can fb have a value and the connector_id can be obtained, so I don't know how much this value should be passed in.

The DRM driver was contributed @MiSimon. Michael, could you take a look at this issue?

I found that my device can pass 113, and this value will not change.

But I encountered a more strange problem.

VID_20240430_083854.1.mp4

But I encountered a more strange problem.

It's interesting because this issue usually happens in LV_DISPLAY_RENDER_MODE_PARTIALwhen the rendered image is copied incorrectly. However the DRM driver uses LV_DISPLAY_RENDER_MODE_DIRECT.

Maybe a color format mismatch? In lv_linux_drm_set_file please call lv_display_set_color_fromat(disp, LV_COLOR_FORMAT_...) explicitly to be sure that the LVGL display's color format is correct.

Only LV_COLOR_FORMAT_NATIVE display and refresh, other fromat can only display the first frame, or not display it, and there will be the situation I saw in my previous video.

The DRM driver was contributed @MiSimon. Michael, could you take a look at this issue?

@kisvegabor I was just the last one who touched it as I prepared the UEFI CI makefile. I think the code comes from the lv_drivers repo.

Sorry @MiSimon, I think @niklasf should be the one who can help us out. 🀞

Hi. In most cases usage will look like:

lv_display_t * display = lv_linux_drm_create();
lv_linux_drm_set_file(display, "/dev/dri/card0", -1 /* use first connector */);

If that's not good, drm_info is a nice tool to enumerate connectors and their modes and properties. For example, the output might look like:

Node: /dev/dri/card0                <-- path
β”œβ”€β”€β”€Driver: vc4 (Broadcom VC4 graphics) version 0.0.0 (20140616)
β”‚   β”œβ”€β”€β”€DRM_CLIENT_CAP_STEREO_3D supported
β”‚   β”œβ”€β”€β”€DRM_CLIENT_CAP_UNIVERSAL_PLANES supported
β”‚   β”œβ”€β”€β”€DRM_CLIENT_CAP_ATOMIC supported
[...]
β”‚   β”œβ”€β”€β”€DRM_CAP_ADDFB2_MODIFIERS = 1
β”‚   β”œβ”€β”€β”€DRM_CAP_PAGE_FLIP_TARGET = 0
β”‚   β”œβ”€β”€β”€DRM_CAP_CRTC_IN_VBLANK_EVENT = 1
β”‚   β”œβ”€β”€β”€DRM_CAP_SYNCOBJ = 1
β”‚   └───DRM_CAP_SYNCOBJ_TIMELINE = 0
β”œβ”€β”€β”€Device: platform brcm,bcm2835-vc4
β”œβ”€β”€β”€Framebuffer size
β”‚   β”œβ”€β”€β”€Width: [0, 2048]
β”‚   └───Height: [0, 2048]
β”œβ”€β”€β”€Connectors
β”‚   β”œβ”€β”€β”€Connector 0
β”‚   β”‚   β”œβ”€β”€β”€Object ID: 32          <-- the connector id i could have used instead of -1
β”‚   β”‚   β”œβ”€β”€β”€Type: HDMI-A
β”‚   β”‚   β”œβ”€β”€β”€Status: connected
β”‚   β”‚   β”œβ”€β”€β”€Physical size: 530x300 mm
β”‚   β”‚   β”œβ”€β”€β”€Subpixel: unknown
β”‚   β”‚   β”œβ”€β”€β”€Encoders: {0}
β”‚   β”‚   β”œβ”€β”€β”€Modes
β”‚   β”‚   β”‚   β”œβ”€β”€β”€1920x1080@60.00 preferred driver phsync pvsync
β”‚   β”‚   β”‚   β”œβ”€β”€β”€1920x1080@60.00 driver phsync pvsync 16:9
[...]
β”‚   β”‚   β”‚   └───720x400@70.08 driver nhsync pvsync
β”‚   β”‚   └───Properties
β”‚   β”‚       β”œβ”€β”€β”€"EDID" (immutable): blob = 294
β”‚   β”‚       β”œβ”€β”€β”€"DPMS": enum {On, Standby, Suspend, Off} = On
β”‚   β”‚       β”œβ”€β”€β”€"link-status": enum {Good, Bad} = Good
β”‚   β”‚       β”œβ”€β”€β”€"non-desktop" (immutable): range [0, 1] = 0
β”‚   β”‚       β”œβ”€β”€β”€"TILE" (immutable): blob = 0
β”‚   β”‚       β”œβ”€β”€β”€"CRTC_ID" (atomic): object CRTC = 90
β”‚   β”‚       β”œβ”€β”€β”€"Colorspace": enum {Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater} = Default
β”‚   β”‚       β”œβ”€β”€β”€"left margin": range [0, 100] = 0
β”‚   β”‚       β”œβ”€β”€β”€"right margin": range [0, 100] = 0
β”‚   β”‚       β”œβ”€β”€β”€"top margin": range [0, 100] = 0
β”‚   β”‚       β”œβ”€β”€β”€"bottom margin": range [0, 100] = 0
β”‚   β”‚       β”œβ”€β”€β”€"max bpc": range [8, 12] = 8
β”‚   β”‚       β”œβ”€β”€β”€"Broadcast RGB": enum {Automatic, Full, Limited 16:235} = Automatic
β”‚   β”‚       └───"Output format": enum {Automatic, RGB, YCbCr 4:2:2, YCbCr 4:4:4} = Automatic
β”‚   └───Connector 1
β”‚       β”œβ”€β”€β”€Object ID: 57
[...]

Thank you for the info! I think it would be important to document for the future DRM users. Would you mind adding a brief guide about it here?

Thanks, -1 is work, but still like this.

But I encountered a more strange problem.

VID_20240430_083854.1.mp4

We need some feedback on this issue.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

As there was no activity here for a while we close this issue. But don't worry, the conversation is still here and you can get back to it at any time.

So feel free to comment if you have remarks or ideas on this topic.