output: Add ds_output_enable/disable APIs 53/278153/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:58:18 +0000 (14:58 +0900)
Change-Id: Idd7c1c7770b136bf240adbe34214101558aa31fe

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

index 9b95db10e0484b6152984f60c1d5cf433ba3ce91..6fb29097ede9950ca2bb7b92a877a90c09fa4905 100644 (file)
@@ -60,6 +60,8 @@ struct ds_output
         struct wl_signal frame;
         struct wl_signal commit;
     } events;
+
+    bool enabled;
 };
 
 void
index c7ee476417cfadda57a4c498b1440cbd0339acd3..cae9f7ff0824b86938a8af6db56a8325b15e740f 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 4f67056ccb0586ea23ff5857630bb67ce344d0db..bc286f77c64c9b5903beebb195f8ef2155071ad3 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;
+}