]> Git Repo - linux.git/commitdiff
Merge tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm...
authorDave Airlie <[email protected]>
Mon, 4 Aug 2014 07:57:34 +0000 (17:57 +1000)
committerDave Airlie <[email protected]>
Mon, 4 Aug 2014 07:57:34 +0000 (17:57 +1000)
Final feature pull for 3.17.

drm-intel-next-2014-07-25:
- Ditch UMS support (well just the config option for now)
- Prep work for future platforms (Sonika Jindal, Damien)
- runtime pm/soix fixes (Paulo, Jesse)
- psr tracking improvements, locking fixes, now enabled by default!
- rps fixes for chv (Deepak, Ville)
- drm core patches for rotation support (Ville, Sagar Kamble) - the i915 parts
  unfortunately didn't make it yet
- userptr fixes (Chris)
- minimum backlight brightness (Jani), acked long ago by Matthew Garret on irc -
  I've forgotten about this patch :(

QA is a bit unhappy about the DP MST stuff since it broke hpd testing a
bit, but otherwise looks sane. I've backmerged drm-next to resolve
conflicts with the mst stuff, which means the new tag itself doesn't
contain the overview as usual.

* tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel: (75 commits)
  drm/i915/userptr: Keep spin_lock/unlock in the same block
  drm/i915: Allow overlapping userptr objects
  drm/i915: Ditch UMS config option
  drm/i915: respect the VBT minimum backlight brightness
  drm/i915: extract backlight minimum brightness from VBT
  drm/i915: Replace HAS_PCH_SPLIT which incorrectly lets some platforms in
  drm/i915: Returning from increase/decrease of pllclock when invalid
  drm/i915: Setting legacy palette correctly for different platforms
  drm/i915: Avoid incorrect returning for some platforms
  drm/i915: Writing proper check for reading of pipe status reg
  drm/i915: Returning the right VGA control reg for platforms
  drm/i915: Allowing changing of wm latencies for valid platforms
  drm/i915: Adding HAS_GMCH_DISPLAY macro
  drm/i915: Fix possible overflow when recording semaphore states.
  drm/i915: Do not unmap object unless no other VMAs reference it
  drm/i915: remove plane/cursor/pipe assertions from intel_crtc_disable
  drm/i915: Reorder ctx unref on ppgtt cleanup
  drm/i915/error: Check the potential ctx obj's vm
  drm/i915: Fix printing proper min/min/rpe values in debugfs
  drm/i915: BDW can also detect unclaimed registers
  ...

1  2 
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/i915/intel_ddi.c

index c3a5a8f0825b3a073dc5b368dbd69c109b9c37cb,901b81246b13954935d7a2329c6d47a43cd6816c..3c4a62169f288237fa19ade7e0829467d097dd04
@@@ -182,6 -182,12 +182,12 @@@ static const struct drm_prop_enum_list 
        { DRM_MODE_SCALE_ASPECT, "Full aspect" },
  };
  
+ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
+       { DRM_MODE_PICTURE_ASPECT_NONE, "Automatic" },
+       { DRM_MODE_PICTURE_ASPECT_4_3, "4:3" },
+       { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
+ };
  /*
   * Non-global properties, but "required" for certain connectors.
   */
@@@ -361,32 -367,6 +367,32 @@@ const char *drm_get_format_name(uint32_
  }
  EXPORT_SYMBOL(drm_get_format_name);
  
 +/*
 + * Internal function to assign a slot in the object idr and optionally
 + * register the object into the idr.
 + */
 +static int drm_mode_object_get_reg(struct drm_device *dev,
 +                                 struct drm_mode_object *obj,
 +                                 uint32_t obj_type,
 +                                 bool register_obj)
 +{
 +      int ret;
 +
 +      mutex_lock(&dev->mode_config.idr_mutex);
 +      ret = idr_alloc(&dev->mode_config.crtc_idr, register_obj ? obj : NULL, 1, 0, GFP_KERNEL);
 +      if (ret >= 0) {
 +              /*
 +               * Set up the object linking under the protection of the idr
 +               * lock so that other users can't see inconsistent state.
 +               */
 +              obj->id = ret;
 +              obj->type = obj_type;
 +      }
 +      mutex_unlock(&dev->mode_config.idr_mutex);
 +
 +      return ret < 0 ? ret : 0;
 +}
 +
  /**
   * drm_mode_object_get - allocate a new modeset identifier
   * @dev: DRM device
  int drm_mode_object_get(struct drm_device *dev,
                        struct drm_mode_object *obj, uint32_t obj_type)
  {
 -      int ret;
 +      return drm_mode_object_get_reg(dev, obj, obj_type, true);
 +}
  
 +static void drm_mode_object_register(struct drm_device *dev,
 +                                   struct drm_mode_object *obj)
 +{
        mutex_lock(&dev->mode_config.idr_mutex);
 -      ret = idr_alloc(&dev->mode_config.crtc_idr, obj, 1, 0, GFP_KERNEL);
 -      if (ret >= 0) {
 -              /*
 -               * Set up the object linking under the protection of the idr
 -               * lock so that other users can't see inconsistent state.
 -               */
 -              obj->id = ret;
 -              obj->type = obj_type;
 -      }
 +      idr_replace(&dev->mode_config.crtc_idr, obj, obj->id);
        mutex_unlock(&dev->mode_config.idr_mutex);
 -
 -      return ret < 0 ? ret : 0;
  }
  
  /**
@@@ -869,7 -855,7 +875,7 @@@ int drm_connector_init(struct drm_devic
  
        drm_modeset_lock_all(dev);
  
 -      ret = drm_mode_object_get(dev, &connector->base, DRM_MODE_OBJECT_CONNECTOR);
 +      ret = drm_mode_object_get_reg(dev, &connector->base, DRM_MODE_OBJECT_CONNECTOR, false);
        if (ret)
                goto out_unlock;
  
@@@ -962,8 -948,6 +968,8 @@@ int drm_connector_register(struct drm_c
  {
        int ret;
  
 +      drm_mode_object_register(connector->dev, &connector->base);
 +
        ret = drm_sysfs_connector_add(connector);
        if (ret)
                return ret;
@@@ -1462,6 -1446,33 +1468,33 @@@ int drm_mode_create_scaling_mode_proper
  }
  EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
  
+ /**
+  * drm_mode_create_aspect_ratio_property - create aspect ratio property
+  * @dev: DRM device
+  *
+  * Called by a driver the first time it's needed, must be attached to desired
+  * connectors.
+  *
+  * Returns:
+  * Zero on success, errno on failure.
+  */
+ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
+ {
+       if (dev->mode_config.aspect_ratio_property)
+               return 0;
+       dev->mode_config.aspect_ratio_property =
+               drm_property_create_enum(dev, 0, "aspect ratio",
+                               drm_aspect_ratio_enum_list,
+                               ARRAY_SIZE(drm_aspect_ratio_enum_list));
+       if (dev->mode_config.aspect_ratio_property == NULL)
+               return -ENOMEM;
+       return 0;
+ }
+ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
  /**
   * drm_mode_create_dirty_property - create dirty property
   * @dev: DRM device
@@@ -3476,19 -3487,28 +3509,28 @@@ EXPORT_SYMBOL(drm_property_create_enum)
  struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
                                         int flags, const char *name,
                                         const struct drm_prop_enum_list *props,
-                                        int num_values)
+                                        int num_props,
+                                        uint64_t supported_bits)
  {
        struct drm_property *property;
-       int i, ret;
+       int i, ret, index = 0;
+       int num_values = hweight64(supported_bits);
  
        flags |= DRM_MODE_PROP_BITMASK;
  
        property = drm_property_create(dev, flags, name, num_values);
        if (!property)
                return NULL;
+       for (i = 0; i < num_props; i++) {
+               if (!(supported_bits & (1ULL << props[i].type)))
+                       continue;
  
-       for (i = 0; i < num_values; i++) {
-               ret = drm_property_add_enum(property, i,
+               if (WARN_ON(index >= num_values)) {
+                       drm_property_destroy(dev, property);
+                       return NULL;
+               }
+               ret = drm_property_add_enum(property, index++,
                                      props[i].type,
                                      props[i].name);
                if (ret) {
@@@ -4936,6 -4956,36 +4978,36 @@@ int drm_format_vert_chroma_subsampling(
  }
  EXPORT_SYMBOL(drm_format_vert_chroma_subsampling);
  
+ /**
+  * drm_rotation_simplify() - Try to simplify the rotation
+  * @rotation: Rotation to be simplified
+  * @supported_rotations: Supported rotations
+  *
+  * Attempt to simplify the rotation to a form that is supported.
+  * Eg. if the hardware supports everything except DRM_REFLECT_X
+  * one could call this function like this:
+  *
+  * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
+  *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
+  *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
+  *
+  * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
+  * transforms the hardware supports, this function may not
+  * be able to produce a supported transform, so the caller should
+  * check the result afterwards.
+  */
+ unsigned int drm_rotation_simplify(unsigned int rotation,
+                                  unsigned int supported_rotations)
+ {
+       if (rotation & ~supported_rotations) {
+               rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
+               rotation = (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 4);
+       }
+       return rotation;
+ }
+ EXPORT_SYMBOL(drm_rotation_simplify);
  /**
   * drm_mode_config_init - initialize DRM mode_configuration structure
   * @dev: DRM device
@@@ -5054,3 -5104,21 +5126,21 @@@ void drm_mode_config_cleanup(struct drm
        drm_modeset_lock_fini(&dev->mode_config.connection_mutex);
  }
  EXPORT_SYMBOL(drm_mode_config_cleanup);
+ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
+                                                      unsigned int supported_rotations)
+ {
+       static const struct drm_prop_enum_list props[] = {
+               { DRM_ROTATE_0,   "rotate-0" },
+               { DRM_ROTATE_90,  "rotate-90" },
+               { DRM_ROTATE_180, "rotate-180" },
+               { DRM_ROTATE_270, "rotate-270" },
+               { DRM_REFLECT_X,  "reflect-x" },
+               { DRM_REFLECT_Y,  "reflect-y" },
+       };
+       return drm_property_create_bitmask(dev, 0, "rotation",
+                                          props, ARRAY_SIZE(props),
+                                          supported_rotations);
+ }
+ EXPORT_SYMBOL(drm_mode_create_rotation_property);
index 2d73430a0d271a97ff0b829d08d6c187d00418f5,18489066cfe555461fb169278d0f345c12cc6161..5db0b5552e39a5005f1c9e1dde74fe7216bb5037
@@@ -1243,7 -1243,7 +1243,7 @@@ static bool hsw_ddi_pll_get_hw_state(st
        return val & WRPLL_PLL_ENABLE;
  }
  
- static char *hsw_ddi_pll_names[] = {
+ static const char * const hsw_ddi_pll_names[] = {
        "WRPLL 1",
        "WRPLL 2",
  };
@@@ -1515,13 -1515,15 +1515,13 @@@ void intel_ddi_init(struct drm_device *
        struct intel_digital_port *intel_dig_port;
        struct intel_encoder *intel_encoder;
        struct drm_encoder *encoder;
 -      struct intel_connector *hdmi_connector = NULL;
 -      struct intel_connector *dp_connector = NULL;
        bool init_hdmi, init_dp;
  
        init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
                     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
        init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
        if (!init_dp && !init_hdmi) {
 -              DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible\n",
 +              DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, assuming it is\n",
                              port_name(port));
                init_hdmi = true;
                init_dp = true;
                                           DDI_A_4_LANES);
  
        intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
 -      intel_encoder->crtc_mask =  (1 << 0) | (1 << 1) | (1 << 2);
 +      intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
        intel_encoder->cloneable = 0;
        intel_encoder->hot_plug = intel_ddi_hot_plug;
  
 -      intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
 -      dev_priv->hpd_irq_port[port] = intel_dig_port;
 +      if (init_dp) {
 +              if (!intel_ddi_init_dp_connector(intel_dig_port))
 +                      goto err;
  
 -      if (init_dp)
 -              dp_connector = intel_ddi_init_dp_connector(intel_dig_port);
 +              intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
 +              dev_priv->hpd_irq_port[port] = intel_dig_port;
 +      }
  
        /* In theory we don't need the encoder->type check, but leave it just in
         * case we have some really bad VBTs... */
 -      if (intel_encoder->type != INTEL_OUTPUT_EDP && init_hdmi)
 -              hdmi_connector = intel_ddi_init_hdmi_connector(intel_dig_port);
 -
 -      if (!dp_connector && !hdmi_connector) {
 -              drm_encoder_cleanup(encoder);
 -              kfree(intel_dig_port);
 +      if (intel_encoder->type != INTEL_OUTPUT_EDP && init_hdmi) {
 +              if (!intel_ddi_init_hdmi_connector(intel_dig_port))
 +                      goto err;
        }
 +
 +      return;
 +
 +err:
 +      drm_encoder_cleanup(encoder);
 +      kfree(intel_dig_port);
  }
This page took 0.0766289999999999 seconds and 4 git commands to generate.