output: Add ds_output_enable/disable APIs 39/278039/1
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 4 Mar 2022 07:27:16 +0000 (16:27 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 18 Jul 2022 05:08:01 +0000 (14:08 +0900)
Change-Id: I0e267ad8e411462487529bfde3d732a845903773

include/libds/interfaces/output.h
include/libds/output.h
src/libds/output.c

index 9b95db1..6fb2909 100644 (file)
@@ -60,6 +60,8 @@ struct ds_output
         struct wl_signal frame;
         struct wl_signal commit;
     } events;
+
+    bool enabled;
 };
 
 void
index c7ee476..cae9f7f 100644 (file)
@@ -20,6 +20,12 @@ struct ds_output_mode {
 void
 ds_output_destroy(struct ds_output *output);
 
+void
+ds_output_enable(struct ds_output *output);
+
+void
+ds_output_disable(struct ds_output *output);
+
 bool
 ds_output_commit(struct ds_output *output);
 
index 4f67056..bc286f7 100644 (file)
@@ -7,6 +7,7 @@
 
 static void output_handle_display_destroy(struct wl_listener *listener,
         void *data);
+static void output_enable(struct ds_output *output, bool enable);
 static void output_state_clear(struct ds_output_state *state);
 static void output_state_clear_buffer(struct ds_output_state *state);
 
@@ -43,6 +44,18 @@ ds_output_destroy(struct ds_output *output)
         free(output);
 }
 
+void
+ds_output_enable(struct ds_output *output)
+{
+    output_enable(output, true);
+}
+
+void
+ds_output_disable(struct ds_output *output)
+{
+    output_enable(output, false);
+}
+
 WL_EXPORT bool
 ds_output_commit(struct ds_output *output)
 {
@@ -147,3 +160,15 @@ output_state_clear_buffer(struct ds_output_state *state)
 
     state->committed &= ~DS_OUTPUT_STATE_BUFFER;
 }
+
+static void
+output_enable(struct ds_output *output, bool enable)
+{
+    if (output->enabled == enable) {
+        output->pending.committed &= ~DS_OUTPUT_STATE_ENABLED;
+        return;
+    }
+
+    output->pending.committed |= DS_OUTPUT_STATE_ENABLED;
+    output->pending.enabled = enable;
+}