vblank: using tdm_output function to get DPMS status. 14/160414/1
authorBoram Park <boram1288.park@samsung.com>
Thu, 16 Nov 2017 04:56:37 +0000 (13:56 +0900)
committerBoram Park <boram1288.park@samsung.com>
Thu, 16 Nov 2017 05:33:53 +0000 (14:33 +0900)
Storing DPMS value made inconsistency with output's DPMS value

Change-Id: I303486cda38c2d8c9c01346facf1e7848b9c63e3

src/tdm_vblank.c

index 931842d..b2ccb95 100644 (file)
@@ -98,7 +98,6 @@ typedef struct _tdm_private_vblank {
        tdm_display *dpy;
        tdm_output *output;
        tdm_output_conn_status connection;
-       tdm_output_dpms dpms;
        unsigned int vrefresh;
 
        tdm_vblank_event_type last_type;
@@ -323,7 +322,6 @@ _tdm_vblank_update_output_info(tdm_private_vblank *private_vblank)
 {
        tdm_output *output = private_vblank->output;
        tdm_output_conn_status connection = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
-       tdm_output_dpms dpms = TDM_OUTPUT_DPMS_OFF;
        unsigned int vrefresh = 0;
 
        tdm_output_get_conn_status(output, &connection);
@@ -335,7 +333,6 @@ _tdm_vblank_update_output_info(tdm_private_vblank *private_vblank)
                        vrefresh = mode->vrefresh;
                else
                        VWR("mode not setted!!!");
-               tdm_output_get_dpms(output, &dpms);
        }
 
        if (vrefresh == 0) {
@@ -343,7 +340,6 @@ _tdm_vblank_update_output_info(tdm_private_vblank *private_vblank)
                vrefresh = TDM_VBLANK_DEFAULT_VREFRESH;
        }
 
-       private_vblank->dpms = dpms;
        private_vblank->connection = connection;
        private_vblank->vrefresh = vrefresh;
        private_vblank->HW_vblank_gap = 1.0 / private_vblank->vrefresh;
@@ -351,8 +347,8 @@ _tdm_vblank_update_output_info(tdm_private_vblank *private_vblank)
        if (private_vblank->fps_changeable)
                private_vblank->fps = vrefresh;
 
-       VIN("dpms(%d) connection(%d) vrefresh(%d) fps(%d) fps_changeable(%d)",
-               private_vblank->dpms, private_vblank->connection,
+       VIN("connection(%d) vrefresh(%d) fps(%d) fps_changeable(%d)",
+               private_vblank->connection,
                private_vblank->vrefresh, private_vblank->fps, private_vblank->fps_changeable);
 }
 
@@ -366,12 +362,9 @@ _tdm_vblank_cb_output_change(tdm_output *output, tdm_output_change_type type,
 
        switch (type) {
        case TDM_OUTPUT_CHANGE_DPMS:
-               if (private_vblank->dpms == value.u32)
-                       break;
                VIN("dpms %s", tdm_dpms_str(value.u32));
-               _tdm_vblank_update_output_info(private_vblank);
                private_vblank->check_HW_or_SW = 1;
-               if (private_vblank->dpms != TDM_OUTPUT_DPMS_ON) {
+               if (value.u32 != TDM_OUTPUT_DPMS_ON) {
                        if (private_vblank->enable_fake)
                                _tdm_vblank_change_to_SW(private_vblank);
                        else
@@ -514,8 +507,8 @@ tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error)
 
        _tdm_vblank_valid_list_add(&private_vblank->valid_link, &valid_vblank_list);
 
-       VIN("created. vrefresh(%d) dpms(%d) connection(%d)",
-               private_vblank->vrefresh, private_vblank->dpms, private_vblank->connection);
+       VIN("created. vrefresh(%d) connection(%d)",
+               private_vblank->vrefresh, private_vblank->connection);
 
        return (tdm_vblank *)private_vblank;
 }
@@ -1055,6 +1048,7 @@ tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
 {
        tdm_private_vblank *private_vblank = vblank;
        tdm_vblank_wait_info *wait_info;
+       tdm_output_dpms dpms = TDM_OUTPUT_DPMS_OFF;
        unsigned int fps;
        tdm_error ret;
 
@@ -1066,12 +1060,14 @@ tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
                return TDM_ERROR_BAD_REQUEST;
        }
 
+       tdm_output_get_dpms(private_vblank->output, &dpms);
+
        if (!private_vblank->enable_fake) {
                if (private_vblank->connection == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) {
                        VER("can't wait a vblank: output disconnected");
                        return TDM_ERROR_OUTPUT_DISCONNECTED;
                }
-               if (private_vblank->dpms != TDM_OUTPUT_DPMS_ON) {
+               if (dpms != TDM_OUTPUT_DPMS_ON) {
                        VER("can't wait a vblank: DPMS off");
                        return TDM_ERROR_DPMS_OFF;
                }
@@ -1122,7 +1118,7 @@ tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
         */
        if (private_vblank->vrefresh % fps)
                wait_info->type = VBLANK_TYPE_SW;
-       else if (private_vblank->dpms == TDM_OUTPUT_DPMS_OFF ||
+       else if (dpms == TDM_OUTPUT_DPMS_OFF ||
                         private_vblank->connection == TDM_OUTPUT_CONN_STATUS_DISCONNECTED)
                wait_info->type = VBLANK_TYPE_SW_FAKE;
        else if (private_vblank->offset == 0)