class ColorConversionStateMachine

Defined at line 50 of file ../../src/ui/scenic/lib/flatland/engine/color_conversion_state_machine.h

Due to semantic differences between how the display controller (DC) and the GPU renderer

handle color conversion (CC), the logic of when and how to apply color correction is

surprisingly complex. This class is meant to encapsulate that logic separately from

the display compositor, engine, and other graphics code.

On the one hand, the DC is stateful. This means that once CC is set and confirmed with

a successful call to ApplyConfig(), it continues to apply on all subsequent frames until

new CC values are set and confirmed with a new call to ApplyConfig().

On the other hand, the GPU renderer is not stateful. It needs to be told every frame whether

or not it should apply color correction.

This can lead to some undesirable scenarios if not properly handled. For instance, say on

frame N we use the DC for CC, and on frame N+1 we need to switch to GPU rendering. The CC

that was applied to the DC on frame N is still in effect. This means that if the GPU

renderer were to apply color correction on frame N+1, we would in effect be applying CC twice.

Public Methods

void SetData (const ColorConversionData & data)

Defined at line 20 of file ../../src/ui/scenic/lib/flatland/engine/color_conversion_state_machine.cc

std::optional<ColorConversionData> GetDataToApply ()

Returns the CC data that should be applied next. If std::nullopt, then there is no data that

needs applying at the current time.

Defined at line 22 of file ../../src/ui/scenic/lib/flatland/engine/color_conversion_state_machine.cc

void SetApplyConfigSucceeded ()

Should be called directly after a successful call DisplayController::ApplyConfig() with

valid color correction data.

Defined at line 12 of file ../../src/ui/scenic/lib/flatland/engine/color_conversion_state_machine.cc

bool GpuRequiresDisplayClearing ()

There are times where the GPU rendering path will need to clear past color conversion state

from the display controller before applying its own state. This happens if State_A is applied

on Frame_A on the display controller, but then the client updates the color conversion state,

but the new state is unable to be applied to the display controller and we need to fallback

to GPU composition. If we do not clear the old state, we will end up applying the new state

on top of the old one, to undefined results.

Defined at line 29 of file ../../src/ui/scenic/lib/flatland/engine/color_conversion_state_machine.cc

void DisplayCleared ()

Call this after clearing the display state on the GPU path when prompted to do so by

|GpuRequiresDisplayClearing|=true.

Defined at line 34 of file ../../src/ui/scenic/lib/flatland/engine/color_conversion_state_machine.cc