monitor: Add API to get GAMMA LUT size

Will be used to generate look up tables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
This commit is contained in:
Jonas Ådahl 2021-10-26 11:45:17 +02:00 committed by Marge Bot
parent 8446cd9f4f
commit c6c3f340ec
4 changed files with 40 additions and 1 deletions

View File

@ -459,4 +459,11 @@ GList * meta_monitor_manager_get_virtual_monitors (MetaMonitorManager *manager);
void meta_monitor_manager_maybe_emit_privacy_screen_change (MetaMonitorManager *manager);
void meta_monitor_manager_get_crtc_gamma (MetaMonitorManager *manager,
MetaCrtc *crtc,
size_t *size,
unsigned short **red,
unsigned short **green,
unsigned short **blue);
#endif /* META_MONITOR_MANAGER_PRIVATE_H */

View File

@ -1152,7 +1152,7 @@ update_has_builtin_panel (MetaMonitorManager *manager)
obj_props[PROP_HAS_BUILTIN_PANEL]);
}
static void
void
meta_monitor_manager_get_crtc_gamma (MetaMonitorManager *manager,
MetaCrtc *crtc,
size_t *size,

View File

@ -618,6 +618,36 @@ meta_monitor_create_spec (MetaMonitor *monitor,
};
}
/**
* meta_monitor_get_gamma_lut_size:
* @monitor: The MetaMonitor instance to retrieve the size from.
*
* Get the size of the look-up tables (LUTs) for the monitor.
*
* Retrieve the size of the LUT used to implement the encoding or decoding
* transfer functions ("gamma", "degamma") for the CRTC or CRTCs that backs
* this monitor.
*
* Returns: The number of look-up table entries possible for the monitor. It is
* assumed that each CRTC of a monitor has identical gamma LUT sizes.
*/
size_t
meta_monitor_get_gamma_lut_size (MetaMonitor *monitor)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (priv->backend);
MetaOutput *output;
MetaCrtc *crtc;
size_t size;
output = meta_monitor_get_main_output (monitor);
crtc = meta_output_get_assigned_crtc (output);
meta_monitor_manager_get_crtc_gamma (monitor_manager, crtc,
&size, NULL, NULL, NULL);
return size;
}
static void
meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
{

View File

@ -295,4 +295,6 @@ gboolean meta_monitor_set_privacy_screen_enabled (MetaMonitor *monitor,
gboolean enabled,
GError **error);
size_t meta_monitor_get_gamma_lut_size (MetaMonitor *monitor);
#endif /* META_MONITOR_H */