aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-05-14 18:27:02 +0200
committerDrew DeVault <sir@cmpwn.com>2020-05-14 20:09:28 +0200
commit347bdb6d9a8064e32adbfac5413c9c81fc49109b (patch)
treea307e40c62d24752b8e6cea06d781367cb048c9c /include
parent7693fdb8a78d00e25d59f6399e89ba0e98670493 (diff)
output: make wlr_output_set_gamma atomic
wlr_output_set_gamma is now double-buffered and applies the gamma LUT on the next output commit.
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/drm.h13
-rw-r--r--include/backend/drm/iface.h2
-rw-r--r--include/wlr/interfaces/wlr_output.h2
-rw-r--r--include/wlr/types/wlr_output.h9
4 files changed, 11 insertions, 15 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index d2b3fe3d..4993fe18 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -44,7 +44,6 @@ struct wlr_drm_plane {
enum wlr_drm_crtc_field {
WLR_DRM_CRTC_MODE = 1 << 0,
- WLR_DRM_CRTC_GAMMA_LUT = 1 << 1,
};
struct wlr_drm_crtc {
@@ -72,9 +71,6 @@ struct wlr_drm_crtc {
uint32_t *overlays;
union wlr_drm_crtc_props props;
-
- uint16_t *gamma_table;
- size_t gamma_table_size;
};
struct wlr_drm_backend {
@@ -156,16 +152,11 @@ void restore_drm_outputs(struct wlr_drm_backend *drm);
void scan_drm_connectors(struct wlr_drm_backend *state);
int handle_drm_event(int fd, uint32_t mask, void *data);
bool enable_drm_connector(struct wlr_output *output, bool enable);
-bool set_drm_connector_gamma(struct wlr_output *output, size_t size,
- const uint16_t *r, const uint16_t *g, const uint16_t *b);
bool drm_connector_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode);
+size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
+ struct wlr_drm_crtc *crtc);
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane);
-bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
- struct wlr_drm_crtc *crtc, struct gbm_bo *bo);
-bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm,
- struct wlr_drm_crtc *crtc, int x, int y);
-
#endif
diff --git a/include/backend/drm/iface.h b/include/backend/drm/iface.h
index 9377af03..ae84bafe 100644
--- a/include/backend/drm/iface.h
+++ b/include/backend/drm/iface.h
@@ -22,6 +22,6 @@ extern const struct wlr_drm_interface atomic_iface;
extern const struct wlr_drm_interface legacy_iface;
bool drm_legacy_crtc_set_gamma(struct wlr_drm_backend *drm,
- struct wlr_drm_crtc *crtc);
+ struct wlr_drm_crtc *crtc, size_t size, uint16_t *lut);
#endif
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index 34b3e675..8913cf41 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -24,8 +24,6 @@ struct wlr_output_impl {
bool (*test)(struct wlr_output *output);
bool (*commit)(struct wlr_output *output);
void (*rollback)(struct wlr_output *output);
- bool (*set_gamma)(struct wlr_output *output, size_t size,
- const uint16_t *r, const uint16_t *g, const uint16_t *b);
size_t (*get_gamma_size)(struct wlr_output *output);
bool (*export_dmabuf)(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs);
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 89ad509c..93e7ee9c 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -60,6 +60,7 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_SCALE = 1 << 4,
WLR_OUTPUT_STATE_TRANSFORM = 1 << 5,
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6,
+ WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
};
enum wlr_output_state_buffer_type {
@@ -94,6 +95,10 @@ struct wlr_output_state {
int32_t width, height;
int32_t refresh; // mHz, may be zero
} custom_mode;
+
+ // only valid if WLR_OUTPUT_STATE_GAMMA_LUT
+ uint16_t *gamma_lut;
+ size_t gamma_lut_size;
};
struct wlr_output_impl;
@@ -375,8 +380,10 @@ size_t wlr_output_get_gamma_size(struct wlr_output *output);
* the value returned by `wlr_output_get_gamma_size`.
*
* Providing zero-sized ramps resets the gamma table.
+ *
+ * The gamma table is double-buffered state, see `wlr_output_commit`.
*/
-bool wlr_output_set_gamma(struct wlr_output *output, size_t size,
+void wlr_output_set_gamma(struct wlr_output *output, size_t size,
const uint16_t *r, const uint16_t *g, const uint16_t *b);
bool wlr_output_export_dmabuf(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs);