if (updates[i].gamma &&
updates[i].gamma != surface->public.gamma_correction) {
if (surface->public.gamma_correction != NULL)
- dc_gamma_release(surface->public.
+ dc_gamma_release(&surface->public.
gamma_correction);
dc_gamma_retain(updates[i].gamma);
static void destruct(struct surface *surface)
{
if (surface->protected.public.gamma_correction != NULL) {
- dc_gamma_release(surface->protected.public.gamma_correction);
- surface->protected.public.gamma_correction = NULL;
+ dc_gamma_release(&surface->protected.public.gamma_correction);
}
if (surface->protected.public.in_transfer_func != NULL) {
dc_transfer_func_release(
++gamma->ref_count;
}
-void dc_gamma_release(const struct dc_gamma *dc_gamma)
+void dc_gamma_release(const struct dc_gamma **dc_gamma)
{
- struct gamma *gamma = DC_GAMMA_TO_GAMMA(dc_gamma);
+ struct gamma *gamma = DC_GAMMA_TO_GAMMA(*dc_gamma);
ASSERT(gamma->ref_count > 0);
--gamma->ref_count;
if (gamma->ref_count == 0)
dm_free(gamma);
+
+ *dc_gamma = NULL;
}
struct dc_gamma *dc_create_gamma()
void dc_surface_release(const struct dc_surface *dc_surface);
void dc_gamma_retain(const struct dc_gamma *dc_gamma);
-void dc_gamma_release(const struct dc_gamma *dc_gamma);
+void dc_gamma_release(const struct dc_gamma **dc_gamma);
struct dc_gamma *dc_create_gamma(void);
void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
for (i = 0; i < core_color->num_sinks; i++)
if (core_color->state[i].gamma)
- dc_gamma_release(core_color->state[i].gamma);
+ dc_gamma_release(&core_color->state[i].gamma);
dm_free(core_color->state);
for (i = 0; i < core_color->num_sinks; i++) {
if (core_color->caps[i].sink == sink) {
if (core_color->state[i].gamma) {
- dc_gamma_release(core_color->state[i].gamma);
- core_color->state[i].gamma = NULL;
+ dc_gamma_release(&core_color->state[i].gamma);
}
/* To remove this sink, shift everything after down */
if (core_color->state[sink_index].gamma != gamma) {
if (core_color->state[sink_index].gamma)
dc_gamma_release(
- core_color->state[sink_index].
- gamma);
+ &core_color->state[sink_index].gamma);
dc_gamma_retain(gamma);
core_color->state[sink_index].gamma = gamma;