[hwc] use TDM_OUTPUT_CAPABILITY_HWC instead of TDM_DISPLAY_CAPABILITY_HWC 10/158510/1 accepted/tizen/unified/20171102.061517 submit/tizen/20171101.104829
authorRoman Marchenko <r.marchenko@samsung.com>
Wed, 1 Nov 2017 09:47:14 +0000 (11:47 +0200)
committerRoman Marchenko <r.marchenko@samsung.com>
Wed, 1 Nov 2017 09:56:31 +0000 (11:56 +0200)
When tdm backend does not want the control hwc policy on one of the outputs
(eg HDMI output), it don't set this capability flag and e20 should use layers

Change-Id: I3a21f094e72ca92fc4a545590ceff4e2228feb19
Signed-off-by: Roman Marchenko <r.marchenko@samsung.com>
include/tdm.h
include/tdm_common.h
src/tdm.c
src/tdm_backend.c
src/tdm_output.c
src/tdm_private.h

index 56d7dea..18241c0 100644 (file)
@@ -62,7 +62,6 @@ extern "C" {
 typedef enum {
        TDM_DISPLAY_CAPABILITY_PP       = (1 << 0), /**< if hardware supports pp operation */
        TDM_DISPLAY_CAPABILITY_CAPTURE  = (1 << 1), /**< if hardware supports capture operation */
-       TDM_DISPLAY_CAPABILITY_HWC      = (1 << 2), /**< if hardware supports hwc operation @since 2.0.0*/
 } tdm_display_capability;
 
 /**
index 6ba2784..84549f3 100644 (file)
@@ -91,6 +91,7 @@ typedef enum {
  */
 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;
 
 /**
index 10071a0..d0f0e44 100644 (file)
--- a/src/tdm.c
+++ b/src/tdm.c
@@ -950,13 +950,6 @@ tdm_display_init(tdm_error *error)
                tdm_display_enable_commit_per_vblank(private_display, enable);
        }
 
-       str = getenv("TDM_HWC");
-       if (str) {
-               char *end;
-               int enable = strtol(str, &end, 10);
-               private_display->hwc_enable = enable;
-       }
-
        if (pthread_mutex_init(&private_display->lock, NULL)) {
                ret = TDM_ERROR_OPERATION_FAILED;
                TDM_ERR("mutex init failed: %m");
@@ -981,9 +974,6 @@ tdm_display_init(tdm_error *error)
        if (ret != TDM_ERROR_NONE)
                goto failed_load;
 
-       if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_HWC))
-               private_display->hwc_enable = 0;
-
        stamp2 = tdm_helper_get_time();
        TDM_DBG("loading backend time: %.3f ms", (stamp2 - stamp1) * 1000.0);
        stamp1 = stamp2;
@@ -1021,9 +1011,9 @@ tdm_display_init(tdm_error *error)
        private_display->init_count = 1;
        private_display->commit_type = TDM_COMMIT_TYPE_NONE;
 
-       if (private_display->hwc_enable) {
-               tdm_private_output *o = NULL;
-               LIST_FOR_EACH_ENTRY(o, &private_display->output_list, link)
+       tdm_private_output *o = NULL;
+       LIST_FOR_EACH_ENTRY(o, &private_display->output_list, link) {
+               if (o->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC)
                        tdm_output_need_validate_event_init(o);
        }
 
index b5e50c6..9c1992d 100644 (file)
@@ -142,7 +142,6 @@ tdm_backend_register_func_hwc_window(tdm_display *dpy, tdm_func_hwc_window *func
        if (_check_abi_version(module, 2, 0) < 0)
                return TDM_ERROR_BAD_MODULE;
 
-       private_display->capabilities |= TDM_DISPLAY_CAPABILITY_HWC;
        private_display->func_hwc_window = *func_hwc_window;
 
        return TDM_ERROR_NONE;
index 98b1a5a..54178f2 100644 (file)
@@ -298,7 +298,7 @@ tdm_output_get_layer_count(tdm_output *output, int *count)
 
        _pthread_mutex_lock(&private_display->lock);
 
-       if (private_display->hwc_enable) {
+       if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) {
                *count = 0;
                _pthread_mutex_unlock(&private_display->lock);
                return TDM_ERROR_NONE;
@@ -330,7 +330,7 @@ tdm_output_get_layer(tdm_output *output, int index, tdm_error *error)
        if (error)
                *error = TDM_ERROR_NONE;
 
-       if (private_display->hwc_enable) {
+       if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) {
                _pthread_mutex_unlock(&private_display->lock);
                if (error)
                        *error = TDM_ERROR_INVALID_PARAMETER;
@@ -1347,7 +1347,7 @@ tdm_output_hwc_create_window(tdm_output *output, tdm_error *error)
 
        _pthread_mutex_lock(&private_display->lock);
 
-       if (private_display->hwc_enable)
+       if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC)
                hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, error);
        else
                if (error)
@@ -1666,6 +1666,9 @@ tdm_output_need_validate_event_init(tdm_output *output)
 
        TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), TDM_ERROR_OPERATION_FAILED);
 
+       if (!(private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC))
+               return TDM_ERROR_NONE;
+
        /* build in eventfd fds into event_loop listened & handled by the tdm-thread */
        fd = eventfd(0, 0);
        TDM_WARNING_IF_FAIL(fd >= 0);
index 6bfbe10..e6c0801 100644 (file)
@@ -181,8 +181,6 @@ struct _tdm_private_display {
        int commit_per_vblank;
        tdm_commit_type commit_type;
 
-       int hwc_enable;
-
        int print_fps;
 };