mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
Fallback gamma on legacy if properties don't exist
This commit is contained in:
parent
dd69d7b764
commit
7cb828ac70
1 changed files with 10 additions and 0 deletions
|
@ -201,6 +201,12 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
|
|||
uint32_t size) {
|
||||
struct drm_color_lut gamma[size];
|
||||
|
||||
// Fallback to legacy gamma interface when gamma properties are not available
|
||||
// (can happen on older intel gpu's that support gamma but not degamma)
|
||||
if (crtc->props.gamma_lut == 0) {
|
||||
return legacy_iface.crtc_set_gamma(drm, crtc, r, g, b, size);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
gamma[i].red = r[i];
|
||||
gamma[i].green = g[i];
|
||||
|
@ -227,6 +233,10 @@ static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
|
|||
struct wlr_drm_crtc *crtc) {
|
||||
uint64_t gamma_lut_size;
|
||||
|
||||
if (crtc->props.gamma_lut_size == 0) {
|
||||
return legacy_iface.crtc_get_gamma_size(drm, crtc);
|
||||
}
|
||||
|
||||
if (!wlr_drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
|
||||
&gamma_lut_size)) {
|
||||
wlr_log(L_ERROR, "Unable to get gamma lut size");
|
||||
|
|
Loading…
Reference in a new issue