do not use module_data if using hal-tdm 91/253991/1
authorJunkyeong Kim <jk0430.kim@samsung.com>
Sun, 7 Feb 2021 08:59:14 +0000 (17:59 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 22 Feb 2021 04:10:01 +0000 (13:10 +0900)
Change-Id: I76484c8202d435f63f43fde8f3775f3910d81c87
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tdm_display.c
src/tdm_helper.c

index 0ab009a..a7a44f7 100644 (file)
@@ -969,17 +969,18 @@ tdm_display_get_backend_info(tdm_display *dpy, const char **name,
                break;
        }
 
-       assert(module_data != NULL);
-
-       if (name)
-               *name = module_data->name;
-       if (vendor)
-               *vendor = module_data->vendor;
-       if (major)
-               *major = TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version);
-       if (minor)
-               *minor = TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version);
-
+       if (!private_module->use_hal_tdm) {
+               assert(module_data != NULL);
+
+               if (name)
+                       *name = module_data->name;
+               if (vendor)
+                       *vendor = module_data->vendor;
+               if (major)
+                       *major = TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version);
+               if (minor)
+                       *minor = TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version);
+       }
        _pthread_mutex_unlock(&private_display->lock);
 
        return ret;
@@ -1013,14 +1014,16 @@ tdm_module_get_info(tdm_module *module, const char **name,
 
        module_data = private_module->module_data;
 
-       if (name)
-               *name = module_data->name;
-       if (vendor)
-               *vendor = module_data->vendor;
-       if (major)
-               *major = TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version);
-       if (minor)
-               *minor = TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version);
+       if (!private_module->use_hal_tdm) {
+               if (name)
+                       *name = module_data->name;
+               if (vendor)
+                       *vendor = module_data->vendor;
+               if (major)
+                       *major = TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version);
+               if (minor)
+                       *minor = TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version);
+       }
 
        _pthread_mutex_unlock(&private_display->lock);
 
@@ -1032,14 +1035,16 @@ tdm_module_check_abi(tdm_private_module *private_module, int abimaj, int abimin)
 {
        tdm_backend_module *module = private_module->module_data;
 
-       if (TDM_BACKEND_GET_ABI_MAJOR(module->abi_version) > abimaj)
-               return 1;
+       if (!private_module->use_hal_tdm) {
+               if (TDM_BACKEND_GET_ABI_MAJOR(module->abi_version) > abimaj)
+                       return 1;
 
-       if (TDM_BACKEND_GET_ABI_MAJOR(module->abi_version) < abimaj)
-               return 0;
+               if (TDM_BACKEND_GET_ABI_MAJOR(module->abi_version) < abimaj)
+                       return 0;
 
-       if (TDM_BACKEND_GET_ABI_MINOR(module->abi_version) < abimin)
-               return 0;
+               if (TDM_BACKEND_GET_ABI_MINOR(module->abi_version) < abimin)
+                       return 0;
+       }
 
        return 1;
 }
index b2f5d77..2990bd8 100644 (file)
@@ -766,14 +766,15 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
 
        /* module information */
        module_data = private_module->module_data;
-       TDM_SNPRINTF(reply, len, "['%s' backend information]\n", module_data->name);
-       TDM_SNPRINTF(reply, len, "vendor: %s\n", module_data->vendor);
-       TDM_SNPRINTF(reply, len, "version: %d.%d\n\n",
-                                (int)TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version),
-                                (int)TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version));
-
+       if (!private_module->use_hal_tdm) {
+               TDM_SNPRINTF(reply, len, "['%s' backend information]\n", module_data->name);
+               TDM_SNPRINTF(reply, len, "vendor: %s\n", module_data->vendor);
+               TDM_SNPRINTF(reply, len, "version: %d.%d\n\n",
+                                        (int)TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version),
+                                        (int)TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version));
+       }
        /* output information */
-       TDM_SNPRINTF(reply, len, "['%s' backend output information]\n", module_data->name);
+       TDM_SNPRINTF(reply, len, "['%s' backend output information]\n", module_data ? module_data->name : "hal-tdm");
        TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n");
        TDM_SNPRINTF(reply, len, "idx   maker   model   name   type   status   dpms   subpixel   align_w   min   max   phy(mm)\n");
        TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n");
@@ -865,7 +866,7 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
        TDM_SNPRINTF(reply, len, "\n");
 
        /* layer information */
-       TDM_SNPRINTF(reply, len, "['%s' backend layer information]\n", module_data->name);
+       TDM_SNPRINTF(reply, len, "['%s' backend layer information]\n", module_data ? module_data->name : "hal-tdm");
        TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
        TDM_SNPRINTF(reply, len, "idx   output   zpos   buf   format   size   crop   geometry   transform\n");
        TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
@@ -972,7 +973,7 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
 
        if (private_module->capabilities & TDM_DISPLAY_CAPABILITY_PP) {
                const char *sep = "";
-               TDM_SNPRINTF(reply, len, "['%s' backend PP information]\n", module_data->name);
+               TDM_SNPRINTF(reply, len, "['%s' backend PP information]\n", module_data ? module_data->name : "hal-tdm");
                TDM_SNPRINTF(reply, len, "caps\t: ");
                tdm_pp_caps_str(private_module->caps_pp.capabilities, &reply, len);
                TDM_SNPRINTF(reply, len, "\n");
@@ -1010,13 +1011,13 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
                        }
                }
        } else {
-               TDM_SNPRINTF(reply, len, "['%s' backend No PP capability]\n", module_data->name);
+               TDM_SNPRINTF(reply, len, "['%s' backend No PP capability]\n", module_data ? module_data->name : "hal-tdm");
        }
        TDM_SNPRINTF(reply, len, "\n");
 
        if (private_module->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) {
                const char *sep = "";
-               TDM_SNPRINTF(reply, len, "['%s' backend capture information]\n", module_data->name);
+               TDM_SNPRINTF(reply, len, "['%s' backend capture information]\n", module_data ? module_data->name : "hal-tdm");
                TDM_SNPRINTF(reply, len, "caps\t: ");
                tdm_capture_caps_str(private_module->caps_capture.capabilities, &reply, len);
                TDM_SNPRINTF(reply, len, "\n");
@@ -1049,7 +1050,7 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re
                        }
                }
        } else {
-               TDM_SNPRINTF(reply, len, "['%s' backend No Capture capability]\n", module_data->name);
+               TDM_SNPRINTF(reply, len, "['%s' backend No Capture capability]\n", module_data ? module_data->name : "hal-tdm");
        }
        TDM_SNPRINTF(reply, len, "\n");
        return reply;