Skip to content

fix(camera): prefer DConfig resolution over local config (BUG-366203)#490

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
add-uos:fix-366203-prefer-dconfig-resolution
Jun 29, 2026
Merged

fix(camera): prefer DConfig resolution over local config (BUG-366203)#490
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
add-uos:fix-366203-prefer-dconfig-resolution

Conversation

@add-uos

@add-uos add-uos commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

When preferredResolution is set via DConfig, use it directly instead of the locally cached resolution from config file on first launch.

DConfig的preferredResolution配置优先于本地配置文件中的分辨率,
修复首次打开应用时仍使用本地旧配置的问题。

Log: 修复preferredResolution首次启动不生效的问题
PMS: BUG-366203
Influence: 设置preferredResolution后首次启动即可生效,无需重启两次。

Summary by Sourcery

Prioritize DConfig-provided preferred camera resolution over the locally cached configuration on initialization to ensure the configured resolution takes effect on first launch.

Bug Fixes:

  • Ensure preferredResolution from DConfig is applied on first application startup instead of falling back to outdated local config resolution.

Enhancements:

  • Update copyright and SPDX metadata years for the V4L2 camera module header.

When preferredResolution is set via DConfig, use it directly instead
of the locally cached resolution from config file on first launch.

DConfig的preferredResolution配置优先于本地配置文件中的分辨率,
修复首次打开应用时仍使用本地旧配置的问题。

Log: 修复preferredResolution首次启动不生效的问题
PMS: BUG-366203
Influence: 设置preferredResolution后首次启动即可生效,无需重启两次。
@sourcery-ai

sourcery-ai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR ensures that, on first launch, the camera uses the preferred resolution from DConfig (if set) instead of the locally cached resolution, and updates copyright years and includes the necessary header for preferred resolution access.

Sequence diagram for updated camera resolution selection in camInit

sequenceDiagram
    participant camInit
    participant DConfig
    participant v4l2core

    camInit->>v4l2core: v4l2core_prepare_new_format(my_vd, my_config->format)
    camInit->>DConfig: get_preferred_resolution_width()
    camInit->>DConfig: get_preferred_resolution_height()
    alt preferredResolution available
        camInit->>v4l2core: v4l2core_prepare_new_resolution(my_vd, get_preferred_resolution_width(), get_preferred_resolution_height())
        camInit->>camInit: my_config->width = get_my_width()
        camInit->>camInit: my_config->height = get_my_height()
    else no preferredResolution
        camInit->>v4l2core: v4l2core_prepare_new_resolution(my_vd, my_config->width, my_config->height)
    end
    camInit->>v4l2core: v4l2core_update_old_format(my_vd, my_config->width, my_config->height, v4l2core_get_requested_frame_format(my_vd))
Loading

File-Level Changes

Change Details Files
Use DConfig preferredResolution to select camera resolution on initialization, falling back to local config only when DConfig is not set.
  • Include v4l2_formats header to access preferred resolution helpers
  • Add a conditional branch that checks preferred resolution width/height from DConfig
  • Call v4l2core_prepare_new_resolution with preferred resolution when available
  • Fallback to using my_config width/height when no preferred resolution is set
  • Remove previous resolution adjustment logging based on get_my_width/get_my_height
src/src/LPF_V4L2.c
Update copyright and SPDX metadata to reflect extended years.
  • Change copyright year range from 2020 ~ 2021 to 2020 - 2026
  • Change SPDX-FileCopyrightText year to 2023 - 2026
src/src/LPF_V4L2.c

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider caching the results of get_preferred_resolution_width()/get_preferred_resolution_height() in local variables before the conditional to avoid repeated calls and make the logic clearer.
  • When preferredResolution is used, the previous adjustment log for mismatched resolutions is skipped; if that adjustment is still relevant, you may want to preserve some logging so it’s visible when DConfig values are corrected.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider caching the results of get_preferred_resolution_width()/get_preferred_resolution_height() in local variables before the conditional to avoid repeated calls and make the logic clearer.
- When preferredResolution is used, the previous adjustment log for mismatched resolutions is skipped; if that adjustment is still relevant, you may want to preserve some logging so it’s visible when DConfig values are corrected.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@add-uos

add-uos commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot deepin-bot Bot merged commit 6cab0d4 into linuxdeepin:release/eagle Jun 29, 2026
19 checks passed
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

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

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