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
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

@p96114175 p96114175 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.

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
@@ -83,6 +83,9 @@ For SDL backend, install the [SDL2 library](https://www.libsdl.org/).
* macOS: `brew install sdl2`
* Ubuntu Linux / Debian: `sudo apt install libsdl2-dev`

For DRM backend, install the [libdrm](https://cgit.freedesktop.org/mesa/drm/).
Copy link
Contributor

Choose a reason for hiding this comment

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

Change the hyperlink to https://gitlab.freedesktop.org/mesa/drm

@@ -0,0 +1,24 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Decouple linux VT changes in another pull request which adapts fbdev backend as well. That is, the linux VT routines should be shared between fbdev and DRM backends.

@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.

return false;
}

/* Virtual terminal part is same as fbdev */
Copy link
Contributor

Choose a reason for hiding this comment

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

Decouple this to another pull request to share the Linux VT manipulation.

{
*resources = drmModeGetResources(fd);
if (*resources == NULL) {
log_error("drmModeGetResources failed");
Copy link
Contributor

@jserv jserv Nov 6, 2024

Choose a reason for hiding this comment

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

Make the error messages consistent, starting with "Failed to ..."

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.

3 participants