Skip to content

Commit

Permalink
Failing to get gamma curves shouldn't be fatal in `AtomicKMSOutput::u…
Browse files Browse the repository at this point in the history
…pdate_from_hardware_state()`
  • Loading branch information
AlanGriffiths committed Oct 24, 2024
1 parent 8082102 commit 1b0062f
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/platforms/atomic-kms/server/kms/atomic_kms_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,18 +756,25 @@ void mga::AtomicKMSOutput::update_from_hardware_state(
}();

GammaCurves gamma;
if (current_crtc && crtc_props->has_property("GAMMA_LUT") && crtc_props->has_property("GAMMA_LUT_SIZE"))
{
PropertyBlobData gamma_lut{drm_fd_, static_cast<uint32_t>((*crtc_props)["GAMMA_LUT"])};
auto const gamma_size = gamma_lut.data<struct drm_color_lut>().size();
gamma.red.reserve(gamma_size);
gamma.green.reserve(gamma_size);
gamma.blue.reserve(gamma_size);
for (auto const& entry : gamma_lut.data<struct drm_color_lut>())
if (connected && current_crtc && crtc_props->has_property("GAMMA_LUT") && crtc_props->has_property("GAMMA_LUT_SIZE"))
{
try
{
PropertyBlobData gamma_lut{drm_fd_, static_cast<uint32_t>((*crtc_props)["GAMMA_LUT"])};
auto const gamma_size = gamma_lut.data<struct drm_color_lut>().size();
gamma.red.reserve(gamma_size);
gamma.green.reserve(gamma_size);
gamma.blue.reserve(gamma_size);
for (auto const& entry : gamma_lut.data<struct drm_color_lut>())
{
gamma.red.push_back(entry.red);
gamma.green.push_back(entry.green);
gamma.blue.push_back(entry.blue);
}
}
catch (...)
{
gamma.red.push_back(entry.red);
gamma.green.push_back(entry.green);
gamma.blue.push_back(entry.blue);
log(logging::Severity::warning, MIR_LOG_COMPONENT, std::current_exception(), "Failed to get gamma curves");
}
}

Expand Down

0 comments on commit 1b0062f

Please sign in to comment.