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

Cog + DRM Lease #613

Open
woutervanh opened this issue Oct 16, 2023 · 1 comment
Open

Cog + DRM Lease #613

woutervanh opened this issue Oct 16, 2023 · 1 comment

Comments

@woutervanh
Copy link

woutervanh commented Oct 16, 2023

I'm trying to get cog working with drm lease in stead of drm directly. For that I adapted cog-platform-drm.c, to work together with drm-lease-manager (https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/drm-lease-manager.git):

#if 0
drmDevice *devices[64];
memset(devices, 0, sizeof(*devices) * 64);

int num_devices = drmGetDevices2(0, devices, 64);
if (num_devices < 0)
    return FALSE;

for (int i = 0; i < num_devices; ++i) {
    drmDevice* device = devices[i];
    g_debug ("init_drm: enumerated device %p, available_nodes %d",
             device, device->available_nodes);

    if (device->available_nodes & (1 << DRM_NODE_PRIMARY))
        g_debug ("init_drm:   DRM_NODE_PRIMARY: %s", device->nodes[DRM_NODE_PRIMARY]);
    if (device->available_nodes & (1 << DRM_NODE_CONTROL))
        g_debug ("init_drm:   DRM_NODE_CONTROL: %s", device->nodes[DRM_NODE_CONTROL]);
    if (device->available_nodes & (1 << DRM_NODE_RENDER))
        g_debug ("init_drm:   DRM_NODE_RENDER: %s", device->nodes[DRM_NODE_RENDER]);
}

for (int i = 0; i < num_devices; ++i) {
    drmDevice* device = devices[i];
    if (!(device->available_nodes & (1 << DRM_NODE_PRIMARY)))
        continue;

    drm_data.fd = open (device->nodes[DRM_NODE_PRIMARY], O_RDWR);
    if (drm_data.fd < 0)
        continue;

    drm_data.base_resources = drmModeGetResources (drm_data.fd);
    if (drm_data.base_resources) {
        g_debug ("init_drm: using device %p, DRM_NODE_PRIMARY %s",
                 device, device->nodes[DRM_NODE_PRIMARY]);
        break;
    }

    close (drm_data.fd);
    drm_data.fd = -1;
}

drmFreeDevices(devices, num_devices);
#else
struct dlm_lease *lease = dlm_get_lease("card1-DPI-1");
drm_data.fd = dlm_lease_fd(lease);
drm_data.base_resources = drmModeGetResources (drm_data.fd);
#endif
if (!drm_data.base_resources)
return FALSE;

It works well, in a sense that it gets the drm device, detects resolution, modesettings etc. But at some point, it tries to authenticate wl_display, which fails. I find this strange as I'm running it from console with platform -P drm, so don't know where this wl_display is coming from, why it's trying to authenticate, and why it is failing. If I run it via drm directly, it succeeds.

This is with drm:
[3083033.269] [email protected](1)
[3083033.520] -> [email protected]()
This is with a lease:
[2887550.595] [email protected](1)
[2887550.866] -> [email protected](wl_drm@5, 0, "authenticate failed")

Any help or pointer?

@woutervanh
Copy link
Author

woutervanh commented Oct 19, 2023

What I'm trying to accomplish, is there a way to have video played on it's own hw plane? Without going through the gpu? and maybe without using punch hole approach too? And if using punch hole, what's the best proven approach?

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

No branches or pull requests

1 participant