Merge drm-fixes-for-v4.17-rc6-urgent into drm-next
authorDave Airlie <airlied@redhat.com>
Fri, 18 May 2018 04:08:53 +0000 (14:08 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 18 May 2018 04:08:53 +0000 (14:08 +1000)
Need to backmerge some nouveau fixes to reduce
the nouveau -next conflicts a lot.

Signed-off-by: Dave Airlie <airlied@redhat.com>
1  2 
MAINTAINERS
drivers/gpu/drm/amd/display/modules/color/color_gamma.c
drivers/gpu/drm/bridge/Kconfig
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/vc4/vc4_plane.c

diff --cc MAINTAINERS
Simple merge
index 15e5b72e6e0002968960e31f5fabfb61c6547c3a,b3747a019debf8fe7336b408fdaa032e9feae056..8446e0876ac80818e582fc99dff31f52c10dd087
@@@ -1345,113 -1164,6 +1345,113 @@@ axix_x_alloc_fail
        kvfree(rgb_regamma);
  rgb_regamma_alloc_fail:
        kvfree(rgb_user);
-       kfree(rgb_user);
 +rgb_user_alloc_fail:
 +      return ret;
 +}
 +
 +bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf,
 +              const struct regamma_lut *regamma)
 +{
 +      struct gamma_coefficients coeff;
 +      const struct hw_x_point *coord_x = coordinates_x;
 +      uint32_t i = 0;
 +
 +      do {
 +              coeff.a0[i] = dal_fixed31_32_from_fraction(
 +                              regamma->coeff.A0[i], 10000000);
 +              coeff.a1[i] = dal_fixed31_32_from_fraction(
 +                              regamma->coeff.A1[i], 1000);
 +              coeff.a2[i] = dal_fixed31_32_from_fraction(
 +                              regamma->coeff.A2[i], 1000);
 +              coeff.a3[i] = dal_fixed31_32_from_fraction(
 +                              regamma->coeff.A3[i], 1000);
 +              coeff.user_gamma[i] = dal_fixed31_32_from_fraction(
 +                              regamma->coeff.gamma[i], 1000);
 +
 +              ++i;
 +      } while (i != 3);
 +
 +      i = 0;
 +      /* fixed_pt library has problems handling too small values */
 +      while (i != 32) {
 +              output_tf->tf_pts.red[i] = dal_fixed31_32_zero;
 +              output_tf->tf_pts.green[i] = dal_fixed31_32_zero;
 +              output_tf->tf_pts.blue[i] = dal_fixed31_32_zero;
 +              ++coord_x;
 +              ++i;
 +      }
 +      while (i != MAX_HW_POINTS + 1) {
 +              output_tf->tf_pts.red[i] = translate_from_linear_space_ex(
 +                              coord_x->x, &coeff, 0);
 +              output_tf->tf_pts.green[i] = translate_from_linear_space_ex(
 +                              coord_x->x, &coeff, 1);
 +              output_tf->tf_pts.blue[i] = translate_from_linear_space_ex(
 +                              coord_x->x, &coeff, 2);
 +              ++coord_x;
 +              ++i;
 +      }
 +
 +      // this function just clamps output to 0-1
 +      build_new_custom_resulted_curve(MAX_HW_POINTS, &output_tf->tf_pts);
 +      output_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
 +
 +      return true;
 +}
 +
 +bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
 +              const struct regamma_lut *regamma)
 +{
 +      struct dc_transfer_func_distributed_points *tf_pts = &output_tf->tf_pts;
 +      struct dividers dividers;
 +
 +      struct pwl_float_data *rgb_user = NULL;
 +      struct pwl_float_data_ex *rgb_regamma = NULL;
 +      bool ret = false;
 +
 +      if (regamma == NULL)
 +              return false;
 +
 +      output_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
 +
 +      rgb_user = kzalloc(sizeof(*rgb_user) * (GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS),
 +                      GFP_KERNEL);
 +      if (!rgb_user)
 +              goto rgb_user_alloc_fail;
 +
 +      rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS),
 +                      GFP_KERNEL);
 +      if (!rgb_regamma)
 +              goto rgb_regamma_alloc_fail;
 +
 +      dividers.divider1 = dal_fixed31_32_from_fraction(3, 2);
 +      dividers.divider2 = dal_fixed31_32_from_int(2);
 +      dividers.divider3 = dal_fixed31_32_from_fraction(5, 2);
 +
 +      scale_user_regamma_ramp(rgb_user, &regamma->ramp, dividers);
 +
 +      if (regamma->flags.bits.applyDegamma == 1) {
 +              apply_degamma_for_user_regamma(rgb_regamma, MAX_HW_POINTS);
 +              copy_rgb_regamma_to_coordinates_x(coordinates_x,
 +                              MAX_HW_POINTS, rgb_regamma);
 +      }
 +
 +      interpolate_user_regamma(MAX_HW_POINTS, rgb_user,
 +                      regamma->flags.bits.applyDegamma, tf_pts);
 +
 +      // no custom HDR curves!
 +      tf_pts->end_exponent = 0;
 +      tf_pts->x_point_at_y1_red = 1;
 +      tf_pts->x_point_at_y1_green = 1;
 +      tf_pts->x_point_at_y1_blue = 1;
 +
 +      // this function just clamps output to 0-1
 +      build_new_custom_resulted_curve(MAX_HW_POINTS, tf_pts);
 +
 +      ret = true;
 +
 +      kfree(rgb_regamma);
 +rgb_regamma_alloc_fail:
++      kvfree(rgb_user);
  rgb_user_alloc_fail:
        return ret;
  }
Simple merge
Simple merge
Simple merge