Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Linux DRM backend #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Support Linux DRM backend #69

wants to merge 2 commits into from

Conversation

Bennctu
Copy link
Collaborator

@Bennctu Bennctu commented Nov 3, 2024

Currently, using the DRM legacy interface is suitable for Mado's backend because we only need basic window display without advanced features.

backend/drm.c Outdated Show resolved Hide resolved
@jserv jserv requested a review from shengwen-tw November 3, 2024 15:05
backend/drm.c Outdated Show resolved Hide resolved
@jserv
Copy link
Contributor

jserv commented Nov 3, 2024

Currently, using the DRM legacy interface is suitable for Mado's backend because we only need basic window display without advanced features.

What compatibility risks exist when using DRM legacy interfaces with newer Linux kernels? Could you verify the compatibility status of libdrm across different kernel versions?

What prevents the DRM backend from rendering content across the full screen resolution?

@jserv
Copy link
Contributor

jserv commented Nov 3, 2024

@a1091150, You might check DRM backend for your environment as well.

Makefile Show resolved Hide resolved

return true;

bail_crtc:
Copy link
Collaborator

@huaxinliao huaxinliao Nov 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about this. It should be as below.

/* Retrieve resources */
if (!get_resources(tx->drm_dri_fd, &RES(tx)))
    goto bail_res;
....
bail_fb:
    drmModeRmFB(tx->drm_dri_fd, tx->fb_id);
    munmap(tx->fb_base, tx->fb_len);
bail_crtc:
    drmModeFreeCrtc(CRTC(tx));
bail_conn:
    drmModeFreeConnector(CONN(tx));
bail_res:
    drmModeFreeResources(RES(tx));

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase the latest main branch and resolve conflicts.

README.md Outdated Show resolved Hide resolved
backend/linux_vt.c Outdated Show resolved Hide resolved
@Bennctu
Copy link
Collaborator Author

Bennctu commented Nov 6, 2024

Currently, using the DRM legacy interface is suitable for Mado's backend because we only need basic window display without advanced features.

What compatibility risks exist when using DRM legacy interfaces with newer Linux kernels? Could you verify the compatibility status of libdrm across different kernel versions?

What prevents the DRM backend from rendering content across the full screen resolution?

I need more time to research and adjust.

backend/drm.c Outdated Show resolved Hide resolved
backend/drm.c Outdated Show resolved Hide resolved
configs/Kconfig Outdated Show resolved Hide resolved
backend/drm.c Outdated Show resolved Hide resolved
backend/drm.c Outdated Show resolved Hide resolved
backend/drm.c Outdated Show resolved Hide resolved
backend/drm.c Show resolved Hide resolved
@jserv
Copy link
Contributor

jserv commented Nov 11, 2024

Check the DRM implementation for reference: https://github.com/zlgopen/awtk-linux-fb/blob/master/awtk-port/lcd_linux/lcd_linux_drm.c

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase the latest main branch and utilize backend/linux_vt.h.

Implemented DRM-based framebuffer setup, including:
 - Opening DRM device
 - Creating dumb buffers and mapping them to framebuffers
 - Setting mode and handling CRTC for connected display output

Currently, using the DRM legacy interface is suitable for Mado's backend
if we only need basic window display without advanced features. The DRM
legacy is simpler to implement.

Close sysprog21#60

/* Register the Linux DRM backend */

const twin_backend_t g_twin_backend = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add poll operation as it is required in recent main branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the original implementation, we creates another thread to handle the events in function twin_linux_evdev_thread. So do you suggest refactoring linux_input.c#L255~278?

Or we just assign NULL to .poll?

/* Register the Linux DRM backend */

const twin_backend_t g_twin_backend = {
    .init = twin_drm_init,
    .poll = NULL,  /*without implementation*/
    .configure = twin_drm_configure,
    .exit = twin_drm_exit,
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alanjian85, can you comment this?

$ sudo ./demo-drm
```

The DRM device can be assigened via the environment variable `DRI_CARD`.
Copy link
Contributor

@jserv jserv Nov 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRI_CARD is not common for understanding. How about DRMDEVICE?

@jserv jserv requested a review from alanjian85 November 28, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants