Skip to content

refactor(compositor): remove drm_format.hpp and redundant using aliases#143

Merged
K1ngst0m merged 1 commit intomainfrom
dev/refactor-util-2
Mar 25, 2026
Merged

refactor(compositor): remove drm_format.hpp and redundant using aliases#143
K1ngst0m merged 1 commit intomainfrom
dev/refactor-util-2

Conversation

@K1ngst0m
Copy link
Copy Markdown
Collaborator

@K1ngst0m K1ngst0m commented Mar 25, 2026

Summary by CodeRabbit

  • Refactor
    • Internal code organization and cleanup: streamlined utility dependencies and consolidated format conversion logic to improve maintainability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4064586b-012e-4ca0-bf16-389ce4d97fa9

📥 Commits

Reviewing files that changed from the base of the PR and between 652f3af and 0503ce3.

📒 Files selected for processing (3)
  • src/compositor/compositor_present.cpp
  • src/compositor/compositor_state.hpp
  • src/util/drm_format.hpp
💤 Files with no reviewable changes (2)
  • src/util/drm_format.hpp
  • src/compositor/compositor_state.hpp

📝 Walkthrough

Walkthrough

The pull request internalizes the DRM-to-Vulkan format conversion function by moving it from a shared utility header into the compositor's presentation file, eliminates unused namespace imports from the compositor state header, and deletes the now-unneeded utility header file.

Changes

Cohort / File(s) Summary
Compositor Present Implementation
src/compositor/compositor_present.cpp
Added local drm_to_vk_format() function implementing DRM-to-Vulkan format mapping via switch statement, replacing external utility dependency with inline implementation.
Compositor State Header Cleanup
src/compositor/compositor_state.hpp
Removed seven unused Wayland/wlroots using declarations (wl_listener, wlr_layer_shell_v1, wlr_pointer_constraint_v1, wlr_surface, wlr_xdg_popup, wlr_xdg_toplevel, wlr_xwayland_surface).
Deleted Utility Header
src/util/drm_format.hpp
Removed standalone DRM format conversion utility header containing the centralized drm_to_vk_format() function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Review effort 3/5

Poem

🐰 A rabbit hops through code so neat,
Moves functions to where they belong,
Sweeps away imports obsolete,
Makes the compositor strong!
One less header in the way,
Cleaner files to brighten the day! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing drm_format.hpp and redundant using aliases in the compositor module.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/refactor-util-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Copy Markdown

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

Review Summary by Qodo

Remove drm_format.hpp and consolidate format conversion logic

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Remove unused drm_format.hpp utility header file
• Move drm_to_vk_format() function to compositor module
• Remove redundant using aliases from compositor state
• Reduce unnecessary dependencies and improve code locality
Diagram
flowchart LR
  A["drm_format.hpp<br/>utility header"] -->|"function moved"| B["compositor_present.cpp<br/>local function"]
  C["compositor_state.hpp<br/>using aliases"] -->|"remove unused"| D["cleaned up<br/>namespace"]
  B --> E["drm_to_vk_format<br/>conversion logic"]
Loading

Grey Divider

File Changes

1. src/compositor/compositor_present.cpp Refactoring +23/-2

Move format conversion to local scope

• Remove include of util/drm_format.hpp
• Add include of vulkan/vulkan.hpp
• Implement local drm_to_vk_format() function with DRM to Vulkan format mappings
• Update call site to use local function instead of utility namespace function

src/compositor/compositor_present.cpp


2. src/compositor/compositor_state.hpp Refactoring +0/-7

Remove redundant namespace using declarations

• Remove 8 unused using aliases: wl_listener, wlr_layer_shell_v1, wlr_pointer_constraint_v1,
 wlr_surface, wlr_xdg_popup, wlr_xdg_toplevel, wlr_xwayland_surface
• Keep only actively used type aliases

src/compositor/compositor_state.hpp


3. src/util/drm_format.hpp Refactoring +0/-30

Delete unused drm format utility header

• Delete entire utility header file
• Function drm_to_vk_format() moved to compositor module
• Remove dependency on vulkan/vulkan.hpp from util namespace

src/util/drm_format.hpp


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 25, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@K1ngst0m K1ngst0m merged commit 6fe4a50 into main Mar 25, 2026
5 checks passed
@K1ngst0m K1ngst0m deleted the dev/refactor-util-2 branch March 25, 2026 12:16
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