Skip to content

Refactor functions in graphics_flags.h/cc and their usage in flags.cc - #3264

Open
cjreynol wants to merge 12 commits into
google:mainfrom
cjreynol:calculated_gpu_mode_metrics
Open

cjreynol wants to merge 12 commits into
google:mainfrom
cjreynol:calculated_gpu_mode_metrics

Conversation

@cjreynol

@cjreynol cjreynol commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

This is pre-work for gathering the calculated_gpu_mode value for metrics. I needed to make the actual gpu_mode selection logic available at the top-level, and while I was at it I split all of the determination logic from the instance updating logic in the former ConfigureGpuSettings.

Bug: 481846356

@cjreynol cjreynol self-assigned this Sep 29, 2026
@cjreynol
cjreynol force-pushed the calculated_gpu_mode_metrics branch from 47244a2 to 4611a34 Compare October 1, 2026 03:31
@cjreynol cjreynol changed the title Gather calculated_gpu_mode metrics Refactor functions in graphics_flags.h/cc and their usage in flags.cc Oct 1, 2026
The passed in (or default) flag value was assigned instead of the
calculated one.

This vector of values was only used for `CheckSnapshotCompatibility`.

Bug: 481846356
The goal is to separate the `GpuMode` calculating logic from the
`CuttlefishConfig::MutableInstanceSpecific` mutation/setting logic.  We
need to be able to re-use the calculation logic for metrics without
making any modifications.

The plan is to pick apart the mixed logic to separate everything, then
put all of the determination logic back together.

Bug: 481846356
Piecemeal stripping out logic from the monolithic function with mutation.

Bug: 481846356
@cjreynol
cjreynol force-pushed the calculated_gpu_mode_metrics branch from 4611a34 to 8907aea Compare October 1, 2026 21:39
So both `#ifdef __APPLE__` and `#ifndef` have the same interface.  This
will make it easier to use for metrics.

Bug: 481846356
To avoid the extra calls and conditionals in the logic for setting
config values.

Bug: 481846356
The entire anonymous namespace belonged in the same block.  The
[[maybe_unused]] notation is not necessary with this condensing.

The only remaining `#ifdef __APPLE__` code should be the alternative
versions of `GetGraphicsAvailability` and `SelectGpuMode`.

Bug: 481846356
@cjreynol
cjreynol force-pushed the calculated_gpu_mode_metrics branch from 8907aea to b09eb25 Compare October 1, 2026 21:52
@cjreynol
cjreynol marked this pull request as ready for review October 1, 2026 21:52
@cjreynol cjreynol added kokoro:force-run Trigger a presubmit build unconditionally. kokoro:run Run e2e tests. labels Oct 1, 2026
@cjreynol
cjreynol requested a review from jmacnak October 1, 2026 21:52
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed kokoro:run Run e2e tests. kokoro:force-run Trigger a presubmit build unconditionally. labels Oct 1, 2026

This branch has not been deployed

No deployments
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.

2 participants