Skip to content

Fix compatibility with Linux kernel 6.17#81

Open
MatiZappacosta wants to merge 1 commit intoklogg:masterfrom
MatiZappacosta:fix-kernel-6.17-compatibility
Open

Fix compatibility with Linux kernel 6.17#81
MatiZappacosta wants to merge 1 commit intoklogg:masterfrom
MatiZappacosta:fix-kernel-6.17-compatibility

Conversation

@MatiZappacosta
Copy link
Copy Markdown

  • Replace drm_fbdev_generic.h with drm_fbdev_shmem.h
  • Remove deprecated .lastclose and .date from drm_driver
  • Add DRM_FBDEV_SHMEM_DRIVER_OPS macro
  • Update bridge_attach signature (add encoder parameter)
  • Update mode_valid signature (add const)
  • Migrate from struct edid to struct drm_edid API:
    • drm_do_get_edid -> drm_edid_read_custom
    • drm_connector_update_edid_property -> drm_edid_connector_update
    • drm_detect_hdmi_monitor -> drm_edid_is_digital
    • drm_add_edid_modes -> drm_edid_connector_add_modes
    • kfree -> drm_edid_free

Tested on Ubuntu 24.04 with kernel 6.17.0-14-generic

- Replace drm_fbdev_generic.h with drm_fbdev_shmem.h
- Remove deprecated .lastclose and .date from drm_driver
- Add DRM_FBDEV_SHMEM_DRIVER_OPS macro
- Update bridge_attach signature (add encoder parameter)
- Update mode_valid signature (add const)
- Migrate from struct edid to struct drm_edid API:
  - drm_do_get_edid -> drm_edid_read_custom
  - drm_connector_update_edid_property -> drm_edid_connector_update
  - drm_detect_hdmi_monitor -> drm_edid_is_digital
  - drm_add_edid_modes -> drm_edid_connector_add_modes
  - kfree -> drm_edid_free

Tested on Ubuntu 24.04 with kernel 6.17.0-14-generic
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @MatiZappacosta, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the DRM driver to ensure compatibility with Linux kernel 6.17. It involves modernizing the framebuffer device handling, removing deprecated driver fields, and migrating to the newer drm_edid API for Extended Display Identification Data processing. These changes align the driver with current kernel standards and improve its robustness.

Highlights

  • Updated DRM framebuffer header: Replaced drm_fbdev_generic.h with drm_fbdev_shmem.h to align with kernel changes.
  • Removed deprecated DRM driver fields: Eliminated .lastclose and .date from the drm_driver structure.
  • Integrated shared memory framebuffer operations: Added DRM_FBDEV_SHMEM_DRIVER_OPS macro for modern framebuffer handling.
  • Adjusted DRM bridge attachment signature: Modified bridge_attach to include an encoder parameter.
  • Updated DRM mode validation signature: Added const qualifier to the mode parameter in the mode_valid function.
  • Migrated EDID API usage: Transitioned from struct edid to struct drm_edid and updated related functions like drm_do_get_edid to drm_edid_read_custom, drm_connector_update_edid_property to drm_edid_connector_update, drm_detect_hdmi_monitor to drm_edid_is_digital, drm_add_edid_modes to drm_edid_connector_add_modes, and kfree to drm_edid_free for EDID structures.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • bridge/it66121_drv.c
    • Updated edid member in it66121_priv to drm_edid type.
    • Replaced kfree with drm_edid_free for EDID memory management.
    • Migrated EDID retrieval from drm_do_get_edid to drm_edid_read_custom.
    • Updated EDID property handling from drm_connector_update_edid_property to drm_edid_connector_update.
    • Changed HDMI monitor detection from drm_detect_hdmi_monitor to drm_edid_is_digital.
    • Switched mode addition from drm_add_edid_modes to drm_edid_connector_add_modes.
    • Modified it66121_connector_mode_valid signature to accept a const drm_display_mode.
    • Adjusted it66121_bridge_attach signature to include a drm_encoder parameter.
  • fl2000.h
    • Replaced drm_fbdev_generic.h include with drm_fbdev_shmem.h.
  • fl2000_drm.c
    • Removed deprecated .lastclose and .date fields from fl2000_drm_driver.
    • Added DRM_FBDEV_SHMEM_DRIVER_OPS macro to the drm_driver structure.
    • Commented out the explicit call to drm_fbdev_generic_setup as it's now handled by DRM_FBDEV_SHMEM_DRIVER_OPS.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully updates the driver for compatibility with Linux kernel 6.17. The changes involve migrating from deprecated EDID APIs to the new drm_edid API, updating function signatures, and replacing drm_fbdev_generic.h with drm_fbdev_shmem.h. The removal of .lastclose and .date from drm_driver and the addition of DRM_FBDEV_SHMEM_DRIVER_OPS are also correctly implemented. The changes appear to be well-tested and address the compatibility issues effectively.

Comment thread bridge/it66121_drv.c
Comment on lines +401 to +413
const struct drm_edid *drm_edid = priv->drm_edid;
int count;

if (!edid) {
edid = drm_do_get_edid(connector, it66121_get_edid_block, priv);
if (!edid)
if (!drm_edid) {
drm_edid = drm_edid_read_custom(connector, it66121_get_edid_block, priv);
if (!drm_edid)
return 0;

drm_connector_update_edid_property(connector, edid);

priv->dvi_mode = !drm_detect_hdmi_monitor(edid);
priv->edid = edid;
drm_edid_connector_update(connector, drm_edid);
priv->dvi_mode = !drm_edid_is_digital(drm_edid);
priv->drm_edid = drm_edid;
}

return drm_add_edid_modes(connector, edid);
count = drm_edid_connector_add_modes(connector);
return count;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The it66121_connector_get_modes function has been updated to use the new drm_edid API. Specifically, drm_do_get_edid is replaced by drm_edid_read_custom, drm_connector_update_edid_property by drm_edid_connector_update, drm_detect_hdmi_monitor by drm_edid_is_digital, and drm_add_edid_modes by drm_edid_connector_add_modes. This is a critical update for compatibility with the new kernel version.

Comment thread bridge/it66121_drv.c
struct hdmi_avi_infoframe hdmi_avi_infoframe;

struct edid *edid;
const struct drm_edid *drm_edid;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The type of edid has been changed from struct edid * to const struct drm_edid *. This is a necessary update to align with the new DRM EDID API, ensuring proper handling of EDID data.

Comment thread bridge/it66121_drv.c
Comment on lines +314 to +315
drm_edid_free(priv->drm_edid);
priv->drm_edid = NULL;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The kfree(priv->edid) and priv->edid = NULL calls have been correctly replaced with drm_edid_free(priv->drm_edid) and priv->drm_edid = NULL. This change is essential for proper memory management when using the new drm_edid API.

Comment thread bridge/it66121_drv.c

static enum drm_mode_status it66121_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
const struct drm_display_mode *mode)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The mode parameter in it66121_connector_mode_valid has been correctly updated to const struct drm_display_mode *mode. This change reflects the updated signature for mode_valid in the DRM framework.

Comment thread bridge/it66121_drv.c

/* TODO: rewrite register access properly, add error processing */
static int it66121_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags)
static int it66121_bridge_attach(struct drm_bridge *bridge, struct drm_encoder *encoder, enum drm_bridge_attach_flags flags)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The it66121_bridge_attach function signature has been updated to include a struct drm_encoder *encoder parameter. This is a necessary change to match the new bridge_attach signature in the DRM framework.

Comment thread fl2000.h
#include <drm/drm_fb_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_fbdev_generic.h>
#include <drm/drm_fbdev_shmem.h>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The include drm/drm_fbdev_generic.h has been correctly replaced with drm/drm_fbdev_shmem.h. This update is necessary for compatibility with the Linux kernel 6.17.

Comment thread fl2000_drm.c
static struct drm_driver fl2000_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
.lastclose = drm_fb_helper_lastclose,
.ioctls = NULL,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The .lastclose = drm_fb_helper_lastclose field has been removed from fl2000_drm_driver. This is in line with the deprecation of .lastclose in drm_driver.

Comment thread fl2000_drm.c
.release = fl2000_drm_release,

DRM_GEM_DMA_DRIVER_OPS_VMAP,
DRM_FBDEV_SHMEM_DRIVER_OPS,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The DRM_FBDEV_SHMEM_DRIVER_OPS macro has been added to fl2000_drm_driver. This is a necessary addition to support the new drm_fbdev_shmem API.

Comment thread fl2000_drm.c
.name = DRM_DRIVER_NAME,
.desc = DRM_DRIVER_DESC,
.date = DRM_DRIVER_DATE,
.major = DRM_DRIVER_MAJOR,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The .date = DRM_DRIVER_DATE field has been removed from fl2000_drm_driver. This is in line with the deprecation of .date in drm_driver.

Comment thread fl2000_drm.c
fl2000_usb_magic(usb_dev);

drm_fbdev_generic_setup(drm, FL2000_FB_BPP);
// fbdev setup removed - handled by DRM_FBDEV_SHMEM_DRIVER_OPS
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The call to drm_fbdev_generic_setup has been removed and replaced with a comment indicating that fbdev setup is now handled by DRM_FBDEV_SHMEM_DRIVER_OPS. This is a correct change reflecting the migration to the new fbdev API.

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.

1 participant