drm/amd/display: Gamma logic limitations causing unintended use of RAM over ROM.
authorHarmanprit Tatla <harmanprit.tatla@amd.com>
Mon, 27 May 2019 18:22:30 +0000 (14:22 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 11 Jun 2019 17:50:57 +0000 (12:50 -0500)
[Why]
Our existing logic in deciding whether to use RAM or ROM
depends on whether we are dealing with an identity gamma ramp.

[How]
In addition to the is_identity flag
a new is_logical_identity flag has been
added. The is_identity flag now denotes
whether the OS gamma is an RGB256 identity
and the new logical identity will inidicate
that the given gamma ramp regardless of its
type is identity.

Signed-off-by: Harmanprit Tatla <harmanprit.tatla@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
drivers/gpu/drm/amd/display/modules/color/color_gamma.c

index 479c5f8352f9f95013494307fee379e6c4ec7b5b..821d4f260764d9e20a82b22e2acb09e55ee30c36 100644 (file)
@@ -453,7 +453,11 @@ struct dc_gamma {
        /* private to DC core */
        struct dc_context *ctx;
 
+       /* is_identity is used for RGB256 gamma identity which can also be programmed in INPUT_LUT.
+        * is_logical_identity indicates the given gamma ramp regardless of type is identity.
+        */
        bool is_identity;
+       bool is_logical_identity;
 };
 
 /* Used by both ipp amd opp functions*/
index 8601d371776e6ea3a0a89767f5c42f67fa872b8d..3f413fb9f2ce24d11ed419b7c0475d00b85cd74d 100644 (file)
@@ -1569,7 +1569,8 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
                        output_tf->tf == TRANSFER_FUNCTION_SRGB) {
                if (ramp == NULL)
                        return true;
-               if (ramp->is_identity || (!mapUserRamp && ramp->type == GAMMA_RGB_256))
+               if ((ramp->is_logical_identity) ||
+                               (!mapUserRamp && ramp->type == GAMMA_RGB_256))
                        return true;
        }