drm/amd/display: Roll core_gamma into dc_gamma
Signed-off-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0b0aab86d5
commit
7a6c4af6bf
@ -1500,12 +1500,10 @@ void dc_update_surfaces_and_stream(struct dc *dc,
|
|||||||
if (srf_updates[i].gamma &&
|
if (srf_updates[i].gamma &&
|
||||||
srf_updates[i].gamma != surface->gamma_correction) {
|
srf_updates[i].gamma != surface->gamma_correction) {
|
||||||
if (surface->gamma_correction != NULL)
|
if (surface->gamma_correction != NULL)
|
||||||
dc_gamma_release(&surface->
|
dc_gamma_release(&surface->gamma_correction);
|
||||||
gamma_correction);
|
|
||||||
|
|
||||||
dc_gamma_retain(srf_updates[i].gamma);
|
dc_gamma_retain(srf_updates[i].gamma);
|
||||||
surface->gamma_correction =
|
surface->gamma_correction = srf_updates[i].gamma;
|
||||||
srf_updates[i].gamma;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (srf_updates[i].in_transfer_func &&
|
if (srf_updates[i].in_transfer_func &&
|
||||||
|
@ -137,37 +137,33 @@ void dc_surface_release(struct dc_surface *surface)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dc_gamma_retain(const struct dc_gamma *dc_gamma)
|
void dc_gamma_retain(struct dc_gamma *gamma)
|
||||||
{
|
{
|
||||||
struct core_gamma *gamma = DC_GAMMA_TO_CORE(dc_gamma);
|
|
||||||
|
|
||||||
ASSERT(gamma->ref_count > 0);
|
ASSERT(gamma->ref_count > 0);
|
||||||
++gamma->ref_count;
|
++gamma->ref_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dc_gamma_release(const struct dc_gamma **dc_gamma)
|
void dc_gamma_release(struct dc_gamma **gamma)
|
||||||
{
|
{
|
||||||
struct core_gamma *gamma = DC_GAMMA_TO_CORE(*dc_gamma);
|
ASSERT((*gamma)->ref_count > 0);
|
||||||
|
--(*gamma)->ref_count;
|
||||||
|
|
||||||
ASSERT(gamma->ref_count > 0);
|
if ((*gamma)->ref_count == 0)
|
||||||
--gamma->ref_count;
|
dm_free((*gamma));
|
||||||
|
|
||||||
if (gamma->ref_count == 0)
|
*gamma = NULL;
|
||||||
dm_free(gamma);
|
|
||||||
|
|
||||||
*dc_gamma = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dc_gamma *dc_create_gamma()
|
struct dc_gamma *dc_create_gamma()
|
||||||
{
|
{
|
||||||
struct core_gamma *gamma = dm_alloc(sizeof(*gamma));
|
struct dc_gamma *gamma = dm_alloc(sizeof(*gamma));
|
||||||
|
|
||||||
if (gamma == NULL)
|
if (gamma == NULL)
|
||||||
goto alloc_fail;
|
goto alloc_fail;
|
||||||
|
|
||||||
++gamma->ref_count;
|
++gamma->ref_count;
|
||||||
|
|
||||||
return &gamma->public;
|
return gamma;
|
||||||
|
|
||||||
alloc_fail:
|
alloc_fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -326,7 +326,7 @@ struct dc_surface {
|
|||||||
struct dc_plane_dcc_param dcc;
|
struct dc_plane_dcc_param dcc;
|
||||||
struct dc_hdr_static_metadata hdr_static_ctx;
|
struct dc_hdr_static_metadata hdr_static_ctx;
|
||||||
|
|
||||||
const struct dc_gamma *gamma_correction;
|
struct dc_gamma *gamma_correction;
|
||||||
struct dc_transfer_func *in_transfer_func;
|
struct dc_transfer_func *in_transfer_func;
|
||||||
|
|
||||||
enum dc_color_space color_space;
|
enum dc_color_space color_space;
|
||||||
@ -394,8 +394,8 @@ const struct dc_surface_status *dc_surface_get_status(
|
|||||||
void dc_surface_retain(struct dc_surface *dc_surface);
|
void dc_surface_retain(struct dc_surface *dc_surface);
|
||||||
void dc_surface_release(struct dc_surface *dc_surface);
|
void dc_surface_release(struct dc_surface *dc_surface);
|
||||||
|
|
||||||
void dc_gamma_retain(const struct dc_gamma *dc_gamma);
|
void dc_gamma_retain(struct dc_gamma *dc_gamma);
|
||||||
void dc_gamma_release(const struct dc_gamma **dc_gamma);
|
void dc_gamma_release(struct dc_gamma **dc_gamma);
|
||||||
struct dc_gamma *dc_create_gamma(void);
|
struct dc_gamma *dc_create_gamma(void);
|
||||||
|
|
||||||
void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
|
void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
|
||||||
|
@ -415,6 +415,13 @@ struct dc_gamma {
|
|||||||
uint16_t red[INPUT_LUT_ENTRIES];
|
uint16_t red[INPUT_LUT_ENTRIES];
|
||||||
uint16_t green[INPUT_LUT_ENTRIES];
|
uint16_t green[INPUT_LUT_ENTRIES];
|
||||||
uint16_t blue[INPUT_LUT_ENTRIES];
|
uint16_t blue[INPUT_LUT_ENTRIES];
|
||||||
|
|
||||||
|
/* private to DC core */
|
||||||
|
struct dc_context *ctx;
|
||||||
|
|
||||||
|
/* private to dc_surface.c */
|
||||||
|
int ref_count;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Used by both ipp amd opp functions*/
|
/* Used by both ipp amd opp functions*/
|
||||||
|
@ -40,17 +40,6 @@ struct core_stream;
|
|||||||
|
|
||||||
#define MAX_CLOCK_SOURCES 7
|
#define MAX_CLOCK_SOURCES 7
|
||||||
|
|
||||||
#define DC_GAMMA_TO_CORE(dc_gamma) \
|
|
||||||
container_of(dc_gamma, struct core_gamma, public)
|
|
||||||
|
|
||||||
struct core_gamma {
|
|
||||||
struct dc_gamma public;
|
|
||||||
struct dc_context *ctx;
|
|
||||||
|
|
||||||
/* private to dc_surface.c */
|
|
||||||
int ref_count;
|
|
||||||
};
|
|
||||||
|
|
||||||
void enable_surface_flip_reporting(struct dc_surface *dc_surface,
|
void enable_surface_flip_reporting(struct dc_surface *dc_surface,
|
||||||
uint32_t controller_id);
|
uint32_t controller_id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user