return error during DPMS off 35/65535/1
authorBoram Park <boram1288.park@samsung.com>
Fri, 8 Apr 2016 08:36:27 +0000 (17:36 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 11 Apr 2016 10:33:09 +0000 (19:33 +0900)
Change-Id: Idb99a669b6d4dffe78e7914b130ec78d97617fe1

src/tdm_capture.c
src/tdm_display.c
src/tdm_private.h

index a4bdffdf163dee95f5a01bacae328c1018c313d5..411d20993fe10816afd04fbb29ec06d266ca66b3 100644 (file)
@@ -393,11 +393,20 @@ EXTERN tdm_error
 tdm_capture_commit(tdm_capture *capture)
 {
        tdm_buffer_info *b = NULL, *bb = NULL;
+       tdm_private_output *private_output;
 
        CAPTURE_FUNC_ENTRY();
 
        _pthread_mutex_lock(&private_display->lock);
 
+       private_output = private_capture->private_output;
+       if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
+               TDM_WRN("output(%d) dpms: %s", private_output->pipe,
+                       dpms_str(private_output->current_dpms_value));
+               _pthread_mutex_unlock(&private_display->lock);
+               return TDM_ERROR_BAD_REQUEST;
+       }
+
        if (!func_capture->capture_commit) {
                _pthread_mutex_unlock(&private_display->lock);
                TDM_DBG("failed: not implemented!!");
index 959cf7f592d210500d81d4a7e7e900aa28dd4874..d804f9d5ecd2a510633104420694706bac5085c7 100644 (file)
@@ -125,7 +125,7 @@ struct type_name dpms_names[] = {
        { TDM_OUTPUT_DPMS_OFF, "off" },
 };
 
-static type_name_fn(dpms)
+INTERN type_name_fn(dpms)
 
 struct type_name status_names[] = {
        { TDM_OUTPUT_CONN_STATUS_DISCONNECTED, "disconnected" },
@@ -133,7 +133,7 @@ struct type_name status_names[] = {
        { TDM_OUTPUT_CONN_STATUS_MODE_SETTED, "mode_setted" },
 };
 
-static type_name_fn(status)
+INTERN type_name_fn(status)
 
 EXTERN tdm_error
 tdm_display_get_capabilities(tdm_display *dpy,
@@ -959,6 +959,13 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
 
        _pthread_mutex_lock(&private_display->lock);
 
+       if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
+               TDM_WRN("output(%d) dpms: %s", private_output->pipe,
+                       dpms_str(private_output->current_dpms_value));
+               _pthread_mutex_unlock(&private_display->lock);
+               return TDM_ERROR_BAD_REQUEST;
+       }
+
        func_output = &private_display->func_output;
 
        if (!func_output->output_wait_vblank) {
@@ -1046,6 +1053,13 @@ tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
 
        _pthread_mutex_lock(&private_display->lock);
 
+       if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
+               TDM_WRN("output(%d) dpms: %s", private_output->pipe,
+                       dpms_str(private_output->current_dpms_value));
+               _pthread_mutex_unlock(&private_display->lock);
+               return TDM_ERROR_BAD_REQUEST;
+       }
+
        ret = _tdm_output_commit(output, sync, func, user_data);
 
        _pthread_mutex_unlock(&private_display->lock);
@@ -1125,6 +1139,8 @@ tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
        }
 
        ret = func_output->output_set_dpms(private_output->output_backend, dpms_value);
+       if (ret == TDM_ERROR_NONE)
+               private_output->current_dpms_value = dpms_value;
 
        _pthread_mutex_unlock(&private_display->lock);
 
index 93d1e948ec2c8466550e2aa36e36828070a56944..db82944f8d7f744d663818c124b2010f9cf1adf2 100644 (file)
@@ -84,6 +84,11 @@ extern int tdm_debug_thread;
 #define TDM_TRACE_END()
 #endif
 
+#define prototype_name_fn(res) const char * res##_str(int type)
+
+prototype_name_fn(dpms);
+prototype_name_fn(status);
+
 typedef enum {
         TDM_CAPTURE_TARGET_OUTPUT,
         TDM_CAPTURE_TARGET_LAYER,
@@ -149,6 +154,7 @@ struct _tdm_private_output {
        tdm_output *output_backend;
 
        unsigned int pipe;
+       tdm_output_dpms current_dpms_value;
 
        int regist_vblank_cb;
        int regist_commit_cb;