dpms: handling extended DPMS modes 60/162160/2
authorBoram Park <boram1288.park@samsung.com>
Wed, 29 Nov 2017 06:20:28 +0000 (15:20 +0900)
committerBoram Park <boram1288.park@samsung.com>
Thu, 30 Nov 2017 03:55:04 +0000 (12:55 +0900)
Change-Id: Ic847321b932625daa6b357ffd435ec719d140ad9

client/tdm_client.c
include/tdm_common.h
src/tdm_macro.h
src/tdm_output.c

index 6153187ae8f0696f2da19a3bd8f8afcc239e5b46..a855e8f8faf04c42cc02c57ebba04f2b318d983d 100644 (file)
@@ -274,6 +274,13 @@ _tdm_client_output_cb_dpms(void *data, struct wl_tdm_output *wl_tdm_output, uint
 
        TDM_RETURN_IF_FAIL(private_output != NULL);
 
+       /* If value is extended value, we handle it as DPMS on in client side
+        * The extended DPMS value is valid only in server side.
+        * Or, need to export to client side also?
+        */
+       if (value > TDM_OUTPUT_DPMS_OFF)
+               value = TDM_OUTPUT_DPMS_ON;
+
        if (private_output->dpms == value)
                return;
 
index f35321647be4ff5b2dabc291820ca9e99c015de4..d087fc85a2592c238a04d6c4d075b1c13cf50feb 100644 (file)
@@ -87,11 +87,15 @@ typedef enum {
 /**
  * @brief The output capability enumeration
  * @details
- * @remark
+ * If a backend module provides #TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS, we can set
+ * an extended DPMS mode to an output which a backend module supports.
+ * Don't use the low-4bit for an extended DPMS mode value. It's used for default
+ * DPMS modes.
  */
 typedef enum {
        TDM_OUTPUT_CAPABILITY_ASYNC_DPMS         = (1 << 0), /**< if a outupt supports asynchronous DPMS operation */
        TDM_OUTPUT_CAPABILITY_HWC                = (1 << 1), /**< if a outupt supports hwc operation @since 2.0.0*/
+       TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS      = (1 << 2), /**< if a outupt supports extended DPMS operation @since 2.0.0 */
 } tdm_output_capability;
 
 /**
index 775354e20ff3440d69c689263c6f9d11fa2e1cc5..9a99ae36981133b5f18b2330bfe4eaf60ca368ec 100644 (file)
@@ -162,6 +162,7 @@ extern "C" {
 /* can't export VSYNC macro because we can't define the exact meaning of vsync off
  * at this time. Does committing in standy mode work? Doesn't committing in suspend mode work?
  */
+#define TDM_OUTPUT_DPMS_DEFAULT_MASK         0xF
 #define TDM_OUTPUT_DPMS_VSYNC_OFF_MASK       0x2
 #define TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms)   ((dpms) & TDM_OUTPUT_DPMS_VSYNC_OFF_MASK)
 
index 42dfe87f191129d62e532e7f9bb80fab924aa5bf..9188c9c47b97a75ab14f04e298724c177b880584 100644 (file)
@@ -1209,6 +1209,19 @@ tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
        tdm_func_output *func_output;
        OUTPUT_FUNC_ENTRY();
 
+       if (dpms_value > TDM_OUTPUT_DPMS_OFF) {
+               if (dpms_value & TDM_OUTPUT_DPMS_DEFAULT_MASK) {
+                       TDM_ERR("Don't use the low-4bit for an extended DPMS mode: dpms_value(%x)", dpms_value);
+                       return TDM_ERROR_BAD_REQUEST;
+               }
+
+               if (!(private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS)) {
+                       TDM_ERR("output(%d) doesn't support the extended DPMS control: '%s'",
+                                       private_output->pipe, tdm_dpms_str(dpms_value));
+                       return TDM_ERROR_BAD_REQUEST;
+               }
+       }
+
        _pthread_mutex_lock(&private_display->lock);
 
        if (private_output->waiting_dpms_change) {
@@ -1264,6 +1277,19 @@ tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value)
                return TDM_ERROR_BAD_REQUEST;
        }
 
+       if (dpms_value > TDM_OUTPUT_DPMS_OFF) {
+               if (dpms_value & TDM_OUTPUT_DPMS_DEFAULT_MASK) {
+                       TDM_ERR("Don't use the low-4bit for an extended DPMS mode: dpms_value(%x)", dpms_value);
+                       return TDM_ERROR_BAD_REQUEST;
+               }
+
+               if (!(private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS)) {
+                       TDM_ERR("output(%d) doesn't support the extended DPMS control: '%s'",
+                                       private_output->pipe, tdm_dpms_str(dpms_value));
+                       return TDM_ERROR_BAD_REQUEST;
+               }
+       }
+
        _pthread_mutex_lock(&private_display->lock);
 
        if (private_output->waiting_dpms_change) {