Merge remote-tracking branch 'airlied/drm-next' into topic/drm-misc
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 25 Oct 2016 08:06:04 +0000 (10:06 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 25 Oct 2016 08:06:04 +0000 (10:06 +0200)
Backmerge latest drm-next to have a baseline for the
s/fence/dma_fence/ patch from Chris.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
15 files changed:
drivers/dma-buf/fence.c
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_blend.c
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/i2c/tda998x_drv.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/msm/adreno/adreno_device.c
drivers/gpu/drm/msm/adreno/adreno_gpu.h
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
drivers/gpu/drm/msm/msm_debugfs.c
include/drm/drm_blend.h
include/drm/drm_crtc.h
include/drm/drm_dp_helper.h
include/linux/fence-array.h

index 4d51f9e83fa83ad9a815cb8525756437d81fe650..cc05dddc77a6c23ed106f8dd755af5e7348ef3df 100644 (file)
@@ -68,6 +68,8 @@ int fence_signal_locked(struct fence *fence)
        struct fence_cb *cur, *tmp;
        int ret = 0;
 
+       lockdep_assert_held(fence->lock);
+
        if (WARN_ON(!fence))
                return -EINVAL;
 
index f817063878899eabd6cfcbd6c942dabdf8e79e2b..1b5a32df9a9a793f3dfbf527f5980a9eb1ccd0d4 100644 (file)
@@ -705,8 +705,7 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
                state->src_w = val;
        } else if (property == config->prop_src_h) {
                state->src_h = val;
-       } else if (property == config->rotation_property ||
-                  property == plane->rotation_property) {
+       } else if (property == plane->rotation_property) {
                if (!is_power_of_2(val & DRM_ROTATE_MASK))
                        return -EINVAL;
                state->rotation = val;
@@ -766,8 +765,7 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
                *val = state->src_w;
        } else if (property == config->prop_src_h) {
                *val = state->src_h;
-       } else if (property == config->rotation_property ||
-                  property == plane->rotation_property) {
+       } else if (property == plane->rotation_property) {
                *val = state->rotation;
        } else if (property == plane->zpos_property) {
                *val = state->zpos;
index e52aece309009be8f354a4b2368ba2d9804daf2b..1f2412c7ccfdb2929555c63bec6e3ccf136589f8 100644 (file)
@@ -89,7 +89,7 @@
  * On top of this basic transformation additional properties can be exposed by
  * the driver:
  *
- * - Rotation is set up with drm_mode_create_rotation_property(). It adds a
+ * - Rotation is set up with drm_plane_create_rotation_property(). It adds a
  *   rotation and reflection step between the source and destination rectangles.
  *   Without this property the rectangle is only scaled, but not rotated or
  *   reflected.
  */
 
 /**
- * drm_mode_create_rotation_property - create a new rotation property
- * @dev: DRM device
+ * drm_plane_create_rotation_property - create a new rotation property
+ * @plane: drm plane
+ * @rotation: initial value of the rotation property
  * @supported_rotations: bitmask of supported rotations and reflections
  *
  * This creates a new property with the selected support for transformations.
- * The resulting property should be stored in @rotation_property in
- * &drm_mode_config. It then must be attached to each plane which supports
- * rotations using drm_object_attach_property().
- *
- * FIXME: Probably better if the rotation property is created on each plane,
- * like the zpos property. Otherwise it's not possible to allow different
- * rotation modes on different planes.
  *
  * Since a rotation by 180° degress is the same as reflecting both along the x
  * and the y axis the rotation property is somewhat redundant. Drivers can use
  * rotation. After reflection, the rotation is applied to the image sampled from
  * the source rectangle, before scaling it to fit the destination rectangle.
  */
-struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
-                                                      unsigned int supported_rotations)
-{
-       static const struct drm_prop_enum_list props[] = {
-               { __builtin_ffs(DRM_ROTATE_0) - 1,   "rotate-0" },
-               { __builtin_ffs(DRM_ROTATE_90) - 1,  "rotate-90" },
-               { __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" },
-               { __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" },
-               { __builtin_ffs(DRM_REFLECT_X) - 1,  "reflect-x" },
-               { __builtin_ffs(DRM_REFLECT_Y) - 1,  "reflect-y" },
-       };
-
-       return drm_property_create_bitmask(dev, 0, "rotation",
-                                          props, ARRAY_SIZE(props),
-                                          supported_rotations);
-}
-EXPORT_SYMBOL(drm_mode_create_rotation_property);
-
 int drm_plane_create_rotation_property(struct drm_plane *plane,
                                       unsigned int rotation,
                                       unsigned int supported_rotations)
index 95de47ba1e77f9eacfa034f76cfa08e58019587e..9506933b41cd392d7cbe0c0c64af4ee4ac0a3562 100644 (file)
@@ -1260,6 +1260,34 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
        return ret == xfers ? 0 : -1;
 }
 
+static void connector_bad_edid(struct drm_connector *connector,
+                              u8 *edid, int num_blocks)
+{
+       int i;
+
+       if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+               return;
+
+       dev_warn(connector->dev->dev,
+                "%s: EDID is invalid:\n",
+                connector->name);
+       for (i = 0; i < num_blocks; i++) {
+               u8 *block = edid + i * EDID_LENGTH;
+               char prefix[20];
+
+               if (drm_edid_is_zero(block, EDID_LENGTH))
+                       sprintf(prefix, "\t[%02x] ZERO ", i);
+               else if (!drm_edid_block_valid(block, i, false, NULL))
+                       sprintf(prefix, "\t[%02x] BAD  ", i);
+               else
+                       sprintf(prefix, "\t[%02x] GOOD ", i);
+
+               print_hex_dump(KERN_WARNING,
+                              prefix, DUMP_PREFIX_NONE, 16, 1,
+                              block, EDID_LENGTH, false);
+       }
+}
+
 /**
  * drm_do_get_edid - get EDID data using a custom EDID block read function
  * @connector: connector we're probing
@@ -1283,7 +1311,6 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
 {
        int i, j = 0, valid_extensions = 0;
        u8 *edid, *new;
-       bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
 
        if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
                return NULL;
@@ -1292,7 +1319,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
        for (i = 0; i < 4; i++) {
                if (get_edid_block(data, edid, 0, EDID_LENGTH))
                        goto out;
-               if (drm_edid_block_valid(edid, 0, print_bad_edid,
+               if (drm_edid_block_valid(edid, 0, false,
                                         &connector->edid_corrupt))
                        break;
                if (i == 0 && drm_edid_is_zero(edid, EDID_LENGTH)) {
@@ -1304,54 +1331,60 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
                goto carp;
 
        /* if there's no extensions, we're done */
-       if (edid[0x7e] == 0)
+       valid_extensions = edid[0x7e];
+       if (valid_extensions == 0)
                return (struct edid *)edid;
 
-       new = krealloc(edid, (edid[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
+       new = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
        if (!new)
                goto out;
        edid = new;
 
        for (j = 1; j <= edid[0x7e]; j++) {
-               u8 *block = edid + (valid_extensions + 1) * EDID_LENGTH;
+               u8 *block = edid + j * EDID_LENGTH;
 
                for (i = 0; i < 4; i++) {
                        if (get_edid_block(data, block, j, EDID_LENGTH))
                                goto out;
-                       if (drm_edid_block_valid(block, j,
-                                                print_bad_edid, NULL)) {
-                               valid_extensions++;
+                       if (drm_edid_block_valid(block, j, false, NULL))
                                break;
-                       }
                }
 
-               if (i == 4 && print_bad_edid) {
-                       dev_warn(connector->dev->dev,
-                        "%s: Ignoring invalid EDID block %d.\n",
-                        connector->name, j);
-
-                       connector->bad_edid_counter++;
-               }
+               if (i == 4)
+                       valid_extensions--;
        }
 
        if (valid_extensions != edid[0x7e]) {
+               u8 *base;
+
+               connector_bad_edid(connector, edid, edid[0x7e] + 1);
+
                edid[EDID_LENGTH-1] += edid[0x7e] - valid_extensions;
                edid[0x7e] = valid_extensions;
-               new = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
+
+               new = kmalloc((valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
                if (!new)
                        goto out;
+
+               base = new;
+               for (i = 0; i <= edid[0x7e]; i++) {
+                       u8 *block = edid + i * EDID_LENGTH;
+
+                       if (!drm_edid_block_valid(block, i, false, NULL))
+                               continue;
+
+                       memcpy(base, block, EDID_LENGTH);
+                       base += EDID_LENGTH;
+               }
+
+               kfree(edid);
                edid = new;
        }
 
        return (struct edid *)edid;
 
 carp:
-       if (print_bad_edid) {
-               dev_warn(connector->dev->dev, "%s: EDID block %d invalid.\n",
-                        connector->name, j);
-       }
-       connector->bad_edid_counter++;
-
+       connector_bad_edid(connector, edid, 1);
 out:
        kfree(edid);
        return NULL;
index e0d428f9d1cb3f65273918b3b2c346c128a15b50..83dbae0fabcf1d581e4bdb3bda3d064cc7fce5ea 100644 (file)
@@ -392,15 +392,10 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
                if (plane->type != DRM_PLANE_TYPE_PRIMARY)
                        drm_plane_force_disable(plane);
 
-               if (plane->rotation_property) {
+               if (plane->rotation_property)
                        drm_mode_plane_set_obj_prop(plane,
                                                    plane->rotation_property,
                                                    DRM_ROTATE_0);
-               } else if (dev->mode_config.rotation_property) {
-                       drm_mode_plane_set_obj_prop(plane,
-                                                   dev->mode_config.rotation_property,
-                                                   DRM_ROTATE_0);
-               }
        }
 
        for (i = 0; i < fb_helper->crtc_count; i++) {
index 9798d400d8174750522b1704be66364fe9425318..af8683e0dd5480b0088e4ce5895592b5a9d584cf 100644 (file)
@@ -1289,7 +1289,8 @@ static void tda998x_audio_shutdown(struct device *dev, void *data)
        mutex_unlock(&priv->audio_mutex);
 }
 
-int tda998x_audio_digital_mute(struct device *dev, void *data, bool enable)
+static int
+tda998x_audio_digital_mute(struct device *dev, void *data, bool enable)
 {
        struct tda998x_priv *priv = dev_get_drvdata(dev);
 
index f30db8f2425e43e8b23f6b6912de400ce2fd0a6c..3c2293bd24bf216e3a5929af2f4591d41abb5518 100644 (file)
@@ -1459,8 +1459,7 @@ static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)
        if ((drm_debug & DRM_UT_KMS) == 0)
                return;
 
-       if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
-             DP_DWN_STRM_PORT_PRESENT))
+       if (!drm_dp_is_branch(intel_dp->dpcd))
                return;
 
        len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_HW_REV, &rev, 1);
@@ -1478,8 +1477,7 @@ static void intel_dp_print_sw_revision(struct intel_dp *intel_dp)
        if ((drm_debug & DRM_UT_KMS) == 0)
                return;
 
-       if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
-             DP_DWN_STRM_PORT_PRESENT))
+       if (!drm_dp_is_branch(intel_dp->dpcd))
                return;
 
        len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_SW_REV, &rev, 2);
@@ -3615,8 +3613,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
        if (!is_edp(intel_dp) && !intel_dp->sink_count)
                return false;
 
-       if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
-             DP_DWN_STRM_PORT_PRESENT))
+       if (!drm_dp_is_branch(intel_dp->dpcd))
                return true; /* native DP sink */
 
        if (intel_dp->dpcd[DP_DPCD_REV] == 0x10)
@@ -4134,7 +4131,7 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
                return connector_status_connected;
 
        /* if there's no downstream port, we're done */
-       if (!(dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT))
+       if (!drm_dp_is_branch(dpcd))
                return connector_status_connected;
 
        /* If we're HPD-aware, SINK_COUNT changes dynamically */
index 5127b75dbf40cbbac1955e5e4d8b3e4201133dd8..7250ffc6322fb70cc68e5c636f6fc6f087893023 100644 (file)
@@ -25,9 +25,6 @@ bool hang_debug = false;
 MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!)");
 module_param_named(hang_debug, hang_debug, bool, 0600);
 
-struct msm_gpu *a3xx_gpu_init(struct drm_device *dev);
-struct msm_gpu *a4xx_gpu_init(struct drm_device *dev);
-
 static const struct adreno_info gpulist[] = {
        {
                .rev   = ADRENO_REV(3, 0, 5, ANY_ID),
index a54f6e036b4ab740700cf79d7fcd53f8c084d2e9..07d99bdf7c99a0a49643687d9924eb614f2d9421 100644 (file)
@@ -311,4 +311,7 @@ static inline void adreno_gpu_write(struct adreno_gpu *gpu,
                gpu_write(&gpu->base, reg - 1, data);
 }
 
+struct msm_gpu *a3xx_gpu_init(struct drm_device *dev);
+struct msm_gpu *a4xx_gpu_init(struct drm_device *dev);
+
 #endif /* __ADRENO_GPU_H__ */
index 951c002b05df2701977eb3f8570aa004f1cddd28..cf50d3ec8d1b64787170df814179ce7a18faec3e 100644 (file)
@@ -75,15 +75,12 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
                !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP))
                return;
 
-       if (!dev->mode_config.rotation_property)
-               dev->mode_config.rotation_property =
-                       drm_mode_create_rotation_property(dev,
-                               DRM_ROTATE_0 | DRM_REFLECT_X | DRM_REFLECT_Y);
-
-       if (dev->mode_config.rotation_property)
-               drm_object_attach_property(&plane->base,
-                       dev->mode_config.rotation_property,
-                       DRM_ROTATE_0);
+       drm_plane_create_rotation_property(plane,
+                                          DRM_ROTATE_0,
+                                          DRM_ROTATE_0 |
+                                          DRM_ROTATE_180 |
+                                          DRM_REFLECT_X |
+                                          DRM_REFLECT_Y);
 }
 
 /* helper to install properties which are common to planes and crtcs */
@@ -289,6 +286,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
                        plane_enabled(old_state), plane_enabled(state));
 
        if (plane_enabled(state)) {
+               unsigned int rotation;
+
                format = to_mdp_format(msm_framebuffer_format(state->fb));
                if (MDP_FORMAT_IS_YUV(format) &&
                        !pipe_supports_yuv(mdp5_plane->caps)) {
@@ -309,8 +308,13 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
                        return -EINVAL;
                }
 
-               hflip = !!(state->rotation & DRM_REFLECT_X);
-               vflip = !!(state->rotation & DRM_REFLECT_Y);
+               rotation = drm_rotation_simplify(state->rotation,
+                                                DRM_ROTATE_0 |
+                                                DRM_REFLECT_X |
+                                                DRM_REFLECT_Y);
+               hflip = !!(rotation & DRM_REFLECT_X);
+               vflip = !!(rotation & DRM_REFLECT_Y);
+
                if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) ||
                        (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) {
                        dev_err(plane->dev->dev,
@@ -681,6 +685,7 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
        int pe_top[COMP_MAX], pe_bottom[COMP_MAX];
        uint32_t hdecm = 0, vdecm = 0;
        uint32_t pix_format;
+       unsigned int rotation;
        bool vflip, hflip;
        unsigned long flags;
        int ret;
@@ -743,8 +748,12 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
        config |= get_scale_config(format, src_h, crtc_h, false);
        DBG("scale config = %x", config);
 
-       hflip = !!(pstate->rotation & DRM_REFLECT_X);
-       vflip = !!(pstate->rotation & DRM_REFLECT_Y);
+       rotation = drm_rotation_simplify(pstate->rotation,
+                                        DRM_ROTATE_0 |
+                                        DRM_REFLECT_X |
+                                        DRM_REFLECT_Y);
+       hflip = !!(rotation & DRM_REFLECT_X);
+       vflip = !!(rotation & DRM_REFLECT_Y);
 
        spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
index 663f2b6ef0919309b9ac52ecc7b6d6ec154cf6ea..3c853733c99a327e86aa2458ac71ffa3f4e8164a 100644 (file)
@@ -18,6 +18,7 @@
 #ifdef CONFIG_DEBUG_FS
 #include "msm_drv.h"
 #include "msm_gpu.h"
+#include "msm_debugfs.h"
 
 static int msm_gpu_show(struct drm_device *dev, struct seq_file *m)
 {
index fd351924e1c5b573710819edf84b29cb21009171..13221cf9b3eb1f7bcae06b8e5acb3125ae827b10 100644 (file)
@@ -52,8 +52,6 @@ static inline bool drm_rotation_90_or_270(unsigned int rotation)
        return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
 }
 
-struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
-                                                      unsigned int supported_rotations);
 int drm_plane_create_rotation_property(struct drm_plane *plane,
                                       unsigned int rotation,
                                       unsigned int supported_rotations);
index 284c1b3aec109729a11302c900126acf70705029..bc860cfc67ca8d0bbb948d02fad02b14983abbed 100644 (file)
@@ -1155,11 +1155,6 @@ struct drm_mode_config {
         * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
         */
        struct drm_property *plane_type_property;
-       /**
-        * @rotation_property: Optional property for planes or CRTCs to specifiy
-        * rotation.
-        */
-       struct drm_property *rotation_property;
        /**
         * @prop_src_x: Default atomic plane property for the plane source
         * position in the connected &drm_framebuffer.
index 2a79882cb68e8551d3719a599b482787a018fdbb..55bbeb0ff594581a2448adcf7fb26b7eb883243a 100644 (file)
@@ -690,6 +690,12 @@ drm_dp_tps3_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
                dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED;
 }
 
+static inline bool
+drm_dp_is_branch(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
+{
+       return dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT;
+}
+
 /*
  * DisplayPort AUX channel
  */
index a44794e508df8cd3e72a8b3e37ad1a56a6107cd2..9ea2bde10ac1c8b45ac692de4a6027a9c96b48ef 100644 (file)
@@ -53,6 +53,7 @@ extern const struct fence_ops fence_array_ops;
 
 /**
  * fence_is_array - check if a fence is from the array subsclass
+ * @fence: fence to test
  *
  * Return true if it is a fence_array and false otherwise.
  */