display: add getter/setter for white balance 35/284135/4 accepted/tizen/unified/20221116.120910 accepted/tizen/unified/20221116.164426
authorYunhee Seo <yuni.seo@samsung.com>
Thu, 10 Nov 2022 08:19:39 +0000 (17:19 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Mon, 14 Nov 2022 08:01:01 +0000 (17:01 +0900)
Add a getter and setter function of display white balance which controls RGB gain and offset.

White balancing is adjusting standard point of white color, this because the light source is different for each device.
gain value is a value to be multiplied for RGB value calculation.
offset vealue is a value to be added for RGB value calculation.

These are function prototype to be added.
int hal_device_display_set_white_balance(enum hal_display_white_balance, int value);
int hal_device_display_get_white_balance(enum hal_display_white_balance, int* value);

With this enum type, it is possible to get and set RGB gain and offset value for white balancing.
It is used as a parameter of HAL getter and setter function.
enum hal_display_white_balance {
HAL_DISPLAY_WHITE_BALANCE_R_GAIN,
HAL_DISPLAY_WHITE_BALANCE_G_GAIN,
HAL_DISPLAY_WHITE_BALANCE_B_GAIN,
HAL_DISPLAY_WHITE_BALANCE_R_OFFSET,
HAL_DISPLAY_WHITE_BALANCE_G_OFFSET,
HAL_DISPLAY_WHITE_BALANCE_B_OFFSET,
};

Change-Id: I3afe3953e15b61657a8dfd842a30fde553359586
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
include/backend/hal-display-interface.h
include/hal-display.h
src/display.c

index d2ecc35..b297d10 100644 (file)
@@ -50,6 +50,15 @@ enum display_aod_mode {
        DISPLAY_AOD_MODE_ON,
 };
 
+enum hal_display_white_balance {
+       HAL_DISPLAY_WHITE_BALANCE_R_GAIN,
+       HAL_DISPLAY_WHITE_BALANCE_G_GAIN,
+       HAL_DISPLAY_WHITE_BALANCE_B_GAIN,
+       HAL_DISPLAY_WHITE_BALANCE_R_OFFSET,
+       HAL_DISPLAY_WHITE_BALANCE_G_OFFSET,
+       HAL_DISPLAY_WHITE_BALANCE_B_OFFSET,
+};
+
 typedef struct _hal_backend_display_funcs {
        /* Control display brightness */
        int (*get_max_brightness)(int *brightness);
@@ -83,6 +92,10 @@ typedef struct _hal_backend_display_funcs {
        int (*get_min_frame_rate)(int *rate);
        int (*get_frame_rate)(int *rate);
        int (*set_frame_rate)(int rate);
+
+       /* Control display white balance */
+       int (*set_white_balance)(enum hal_display_white_balance, int value);
+       int (*get_white_balance)(enum hal_display_white_balance, int *value);
 } hal_backend_display_funcs;
 
 #ifdef __cplusplus
index e01b4b9..3f8dede 100644 (file)
@@ -43,6 +43,8 @@ int hal_device_display_get_max_frame_rate(int *rate);
 int hal_device_display_get_min_frame_rate(int *rate);
 int hal_device_display_get_frame_rate(int *rate);
 int hal_device_display_set_frame_rate(int rate);
+int hal_device_display_set_white_balance(enum hal_display_white_balance, int value);
+int hal_device_display_get_white_balance(enum hal_display_white_balance, int* value);
 
 #ifdef __cplusplus
 }
index 52ba9f9..ebb69fd 100644 (file)
@@ -328,3 +328,35 @@ int hal_device_display_set_frame_rate(int rate)
 
        return hal_display_funcs->set_frame_rate(rate);
 }
+
+int hal_device_display_set_white_balance(enum hal_display_white_balance white_balance_type, int value)
+{
+       int ret;
+
+       if (!hal_display_funcs && !hal_initialized) {
+               if ((ret = hal_device_display_get_backend()) < 0)
+                       return ret;
+       }
+
+       if (!hal_display_funcs ||
+               !hal_display_funcs->set_white_balance)
+               return -ENODEV;
+
+       return hal_display_funcs->set_white_balance(white_balance_type, value);
+}
+
+int hal_device_display_get_white_balance(enum hal_display_white_balance white_balance_type, int* value)
+{
+       int ret;
+
+       if (!hal_display_funcs && !hal_initialized) {
+               if ((ret = hal_device_display_get_backend()) < 0)
+                       return ret;
+       }
+
+       if (!hal_display_funcs ||
+               !hal_display_funcs->get_white_balance)
+               return -ENODEV;
+
+       return hal_display_funcs->get_white_balance(white_balance_type, value);
+}
\ No newline at end of file