Skip to content

Conversation

@GongHeng2017
Copy link
Contributor

@GongHeng2017 GongHeng2017 commented Jul 22, 2025

-- In some special computer, the GPU info not show. -- Add logic to show GPU info.

Log: add feature for GPU.
Task: https://pms.uniontech.com/task-view-378987.html

Summary by Sourcery

Provide enhanced GPU information support by adding configurable command-based retrieval, EDID parsing for monitors, and integration via a new CustomGenerator and D-Bus method.

New Features:

  • Allow specifying a custom GPU info command in DConfig and retrieve its output.
  • Implement a stand-alone customgpuinfo binary that uses glxinfo and kernel meminfo to extract GPU details.
  • Add CommonTools::parseEDID to parse EDID blobs and register display monitors.
  • Introduce CustomGenerator to generate GPU and monitor devices using custom commands and EDID parsing.
  • Expose a new getGpuInfoByCustom D-Bus method for fetching GPU info on the server.

Enhancements:

  • Extend DeviceGpu with setGpuInfoByCustom and register a new 'CustomType' in the device factory.

Build:

  • Add customgpuinfo subdirectory and binary to the server CMake configuration.

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 22, 2025

Reviewer's Guide

This PR adds support for retrieving GPU and monitor information via a configurable external command and EDID parsing by extending CommonTools utilities, D-Bus interfaces, device classes, and introducing a CustomGenerator plus a standalone helper binary.

Sequence diagram for custom GPU info retrieval process

sequenceDiagram
    participant CustomGenerator
    participant CommonTools
    participant DBusInterface
    participant DeviceInterface
    participant customgpuinfo
    CustomGenerator->>CommonTools: getGpuInfoCommandFromDConfig()
    CustomGenerator->>DBusInterface: getGpuInfoByCustom(cmd, args, gpuInfo)
    DBusInterface->>DeviceInterface: D-Bus call getGpuInfoByCustom(cmd, args)
    DeviceInterface->>customgpuinfo: Execute customgpuinfo helper
    customgpuinfo-->>DeviceInterface: Return GPU info
    DeviceInterface-->>DBusInterface: Return GPU info
    DBusInterface-->>CustomGenerator: Return GPU info
    CustomGenerator->>DeviceGpu: setGpuInfoByCustom(mapInfo)
Loading

Class diagram for new and updated GPU info retrieval classes

classDiagram
    class CommonTools {
        +static void parseEDID(QStringList allEDIDS, QString input)
        +static QString getGpuInfoCommandFromDConfig()
    }
    class DeviceGpu {
        +void setGpuInfoByCustom(QMap<QString, QString> mapInfo)
    }
    class DBusInterface {
        +bool getGpuInfoByCustom(QString cmd, QStringList arguments, QString &gpuInfo)
    }
    class DeviceInterface {
        +QString getGpuInfoByCustom(QString cmd, QStringList arguments)
    }
    class DeviceFactory {
        +DeviceGenerator* getDeviceGenerator()
    }
    class CustomGenerator {
        +void generatorGpuDevice()
        +void generatorMonitorDevice()
    }
    class DeviceGenerator {
        +virtual void generatorGpuDevice()
        +virtual void generatorMonitorDevice()
    }
    CustomGenerator --|> DeviceGenerator
    DeviceFactory --> CustomGenerator
    CommonTools --> EDIDParser
    CommonTools --> DeviceMonitor
    CustomGenerator --> CommonTools
    CustomGenerator --> DBusInterface
    CustomGenerator --> DeviceGpu
    DeviceGpu --> DeviceBaseInfo
    DBusInterface --> DeviceInterface
    DeviceInterface --> QProcess
    DeviceInterface --> QProcessEnvironment
Loading

Class diagram for the new customgpuinfo helper binary

classDiagram
    class customgpuinfo {
        +main(int argc, char* argv[])
        +getGpuBaseInfo(QMap<QString, QString> &mapInfo)
        +getGpuMemInfoForFTDTM(QMap<QString, QString> &mapInfo)
    }
    customgpuinfo --> QProcess
    customgpuinfo --> QFile
Loading

File-Level Changes

Change Details Files
Add GPU info command retrieval and EDID parsing utilities in CommonTools
  • Added parseEDID to extract EDID blocks and feed them through EDIDParser
  • Added getGpuInfoCommandFromDConfig to read custom GPU info command from DConfig
  • Declared new methods in commontools.h
deepin-devicemanager/src/Tool/commontools.cpp
deepin-devicemanager/src/Tool/commontools.h
Extend DeviceInterface to execute custom GPU info commands and expose via D-Bus
  • Implemented getGpuInfoByCustom using QProcess, environment injection, and result caching
  • Exposed the method as Q_SCRIPTABLE in the D-Bus interface header
  • Added necessary includes (QProcess, QDebug)
deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.cpp
deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.h
Update DBusInterface to invoke getGpuInfoByCustom remotely
  • Added client-side getGpuInfoByCustom to call the new D-Bus method and capture output
  • Handled call failures with error logging
deepin-devicemanager/src/GenerateDevice/DBusInterface.cpp
deepin-devicemanager/src/GenerateDevice/DBusInterface.h
Support custom GPU attributes in DeviceGpu
  • Added setGpuInfoByCustom to map Name, Vendor, Model, Graphics Memory
  • Integrated the new setter into the device creation flow
deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp
deepin-devicemanager/src/DeviceManager/DeviceGpu.h
Introduce CustomGenerator and integrate into factory for custom GPU/monitor devices
  • Implemented CustomGenerator with generatorGpuDevice and generatorMonitorDevice to parse command output and EDID
  • Updated commonfunction enum to include kCustomType
  • Registered CustomGenerator in DeviceFactory for CustomType
deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp
deepin-devicemanager/src/GenerateDevice/CustomGenerator.h
deepin-devicemanager/src/commonfunction.h
deepin-devicemanager/src/commonfunction.cpp
deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp
Provide standalone customgpuinfo tool and update build configuration
  • Added customgpuinfo main.cpp to fetch GLX renderer/vendor strings and kernel meminfo
  • Created customgpuinfo/CMakeLists.txt and integrated it into the server CMakeLists.txt
  • Configured installation under the deepin-devicemanager lib path
deepin-devicemanager-server/customgpuinfo/main.cpp
deepin-devicemanager-server/customgpuinfo/CMakeLists.txt
deepin-devicemanager-server/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@add-uos
Copy link
Contributor

add-uos commented Jul 22, 2025

image

流水线有些问题

-- In some special computer, the GPU info not show.
-- Add logic to show GPU info.

Log: add feature for GPU.
Task: https://pms.uniontech.com/task-view-378987.html
@GongHeng2017 GongHeng2017 force-pushed the 202507091717-eagle-featGPU branch from 87f43e9 to 6a70dee Compare July 22, 2025 09:50
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GongHeng2017, max-lvs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@GongHeng2017
Copy link
Contributor Author

image 流水线有些问题

done

@GongHeng2017
Copy link
Contributor Author

/forcemerge

@deepin-bot deepin-bot bot merged commit 350c0a6 into linuxdeepin:develop/eagle Jul 22, 2025
30 checks passed
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