]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
Merge branch 'vmwgfx-next-5.9' of git://people.freedesktop.org/~sroland/linux into...
authorDave Airlie <airlied@redhat.com>
Wed, 12 Aug 2020 02:58:19 +0000 (12:58 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 12 Aug 2020 02:59:39 +0000 (12:59 +1000)
The drm_mode_config_reset patches are very important fixing a recently
introduced kernel crash, the others fix various older issues which are
a bit less serious in practice.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: "Roland Scheidegger (VMware)" <rscheidegger.oss@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200812005941.19465-1-rscheidegger.oss@gmail.com
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

index 4284c4bd444d6a96b27b598c82154b34a31c1da8..e67e2e8f6e6fa7299c7f6057a9955ea818c5c6a5 100644 (file)
@@ -3037,7 +3037,7 @@ static int vmw_cmd_dx_bind_streamoutput(struct vmw_private *dev_priv,
        res = vmw_dx_streamoutput_lookup(vmw_context_res_man(ctx_node->ctx),
                                         cmd->body.soid);
        if (IS_ERR(res)) {
-               DRM_ERROR("Cound not find streamoutput to bind.\n");
+               DRM_ERROR("Could not find streamoutput to bind.\n");
                return PTR_ERR(res);
        }
 
index bbce45d142aa274d297edec36c8643c9129a353e..312ed0881a99b63c106abe60ab5bf2daa43a8aa8 100644 (file)
@@ -186,7 +186,7 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
                /* TODO handle none page aligned offsets */
                /* TODO handle more dst & src != 0 */
                /* TODO handle more then one copy */
-               DRM_ERROR("Cant snoop dma request for cursor!\n");
+               DRM_ERROR("Can't snoop dma request for cursor!\n");
                DRM_ERROR("(%u, %u, %u) (%u, %u, %u) (%ux%ux%u) %u %u\n",
                          box->srcx, box->srcy, box->srcz,
                          box->x, box->y, box->z,
@@ -2575,7 +2575,7 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
                ++i;
        }
 
-       if (i != unit) {
+       if (&con->head == &dev_priv->dev->mode_config.connector_list) {
                DRM_ERROR("Could not find initial display unit.\n");
                ret = -EINVAL;
                goto out_unlock;
@@ -2599,13 +2599,13 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
                        break;
        }
 
-       if (mode->type & DRM_MODE_TYPE_PREFERRED)
-               *p_mode = mode;
-       else {
+       if (&mode->head == &con->modes) {
                WARN_ONCE(true, "Could not find initial preferred mode.\n");
                *p_mode = list_first_entry(&con->modes,
                                           struct drm_display_mode,
                                           head);
+       } else {
+               *p_mode = mode;
        }
 
  out_unlock:
index 16dafff5cab19f13d0023daae64a5be78eb251ac..c4017c7a24db698b6830bc7d2c931972947b9126 100644 (file)
@@ -81,7 +81,7 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
        struct vmw_legacy_display_unit *entry;
        struct drm_framebuffer *fb = NULL;
        struct drm_crtc *crtc = NULL;
-       int i = 0;
+       int i;
 
        /* If there is no display topology the host just assumes
         * that the guest will set the same layout as the host.
@@ -92,12 +92,11 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
                        crtc = &entry->base.crtc;
                        w = max(w, crtc->x + crtc->mode.hdisplay);
                        h = max(h, crtc->y + crtc->mode.vdisplay);
-                       i++;
                }
 
                if (crtc == NULL)
                        return 0;
-               fb = entry->base.crtc.primary->state->fb;
+               fb = crtc->primary->state->fb;
 
                return vmw_kms_write_svga(dev_priv, w, h, fb->pitches[0],
                                          fb->format->cpp[0] * 8,
@@ -388,8 +387,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
        ldu->base.is_implicit = true;
 
        /* Initialize primary plane */
-       vmw_du_plane_reset(primary);
-
        ret = drm_universal_plane_init(dev, &ldu->base.primary,
                                       0, &vmw_ldu_plane_funcs,
                                       vmw_primary_plane_formats,
@@ -403,8 +400,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
        drm_plane_helper_add(primary, &vmw_ldu_primary_plane_helper_funcs);
 
        /* Initialize cursor plane */
-       vmw_du_plane_reset(cursor);
-
        ret = drm_universal_plane_init(dev, &ldu->base.cursor,
                        0, &vmw_ldu_cursor_funcs,
                        vmw_cursor_plane_formats,
@@ -418,7 +413,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
 
        drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs);
 
-       vmw_du_connector_reset(connector);
        ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
                                 DRM_MODE_CONNECTOR_VIRTUAL);
        if (ret) {
@@ -446,7 +440,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
                goto err_free_encoder;
        }
 
-       vmw_du_crtc_reset(crtc);
        ret = drm_crtc_init_with_planes(dev, crtc, &ldu->base.primary,
                                        &ldu->base.cursor,
                                        &vmw_legacy_crtc_funcs, NULL);
@@ -521,6 +514,8 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv)
 
        dev_priv->active_display_unit = vmw_du_legacy;
 
+       drm_mode_config_reset(dev);
+
        DRM_INFO("Legacy Display Unit initialized\n");
 
        return 0;
index 32a22e4eddb1a334352e0c30c980881f86fe1990..4bf0f5ec4fc2d94663970d4cf8e010cf5c069933 100644 (file)
@@ -859,8 +859,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
        sou->base.is_implicit = false;
 
        /* Initialize primary plane */
-       vmw_du_plane_reset(primary);
-
        ret = drm_universal_plane_init(dev, &sou->base.primary,
                                       0, &vmw_sou_plane_funcs,
                                       vmw_primary_plane_formats,
@@ -875,8 +873,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
        drm_plane_enable_fb_damage_clips(primary);
 
        /* Initialize cursor plane */
-       vmw_du_plane_reset(cursor);
-
        ret = drm_universal_plane_init(dev, &sou->base.cursor,
                        0, &vmw_sou_cursor_funcs,
                        vmw_cursor_plane_formats,
@@ -890,7 +886,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
 
        drm_plane_helper_add(cursor, &vmw_sou_cursor_plane_helper_funcs);
 
-       vmw_du_connector_reset(connector);
        ret = drm_connector_init(dev, connector, &vmw_sou_connector_funcs,
                                 DRM_MODE_CONNECTOR_VIRTUAL);
        if (ret) {
@@ -918,8 +913,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
                goto err_free_encoder;
        }
 
-
-       vmw_du_crtc_reset(crtc);
        ret = drm_crtc_init_with_planes(dev, crtc, &sou->base.primary,
                                        &sou->base.cursor,
                                        &vmw_screen_object_crtc_funcs, NULL);
@@ -973,6 +966,8 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
 
        dev_priv->active_display_unit = vmw_du_screen_object;
 
+       drm_mode_config_reset(dev);
+
        DRM_INFO("Screen Objects Display Unit initialized\n");
 
        return 0;
index 16b3856296889e3f24be5eae8b7ec4eaa94a0040..cf3aafd00837c634b24dfebe12487852ced84431 100644 (file)
@@ -1738,8 +1738,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
        stdu->base.is_implicit = false;
 
        /* Initialize primary plane */
-       vmw_du_plane_reset(primary);
-
        ret = drm_universal_plane_init(dev, primary,
                                       0, &vmw_stdu_plane_funcs,
                                       vmw_primary_plane_formats,
@@ -1754,8 +1752,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
        drm_plane_enable_fb_damage_clips(primary);
 
        /* Initialize cursor plane */
-       vmw_du_plane_reset(cursor);
-
        ret = drm_universal_plane_init(dev, cursor,
                        0, &vmw_stdu_cursor_funcs,
                        vmw_cursor_plane_formats,
@@ -1769,8 +1765,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
 
        drm_plane_helper_add(cursor, &vmw_stdu_cursor_plane_helper_funcs);
 
-       vmw_du_connector_reset(connector);
-
        ret = drm_connector_init(dev, connector, &vmw_stdu_connector_funcs,
                                 DRM_MODE_CONNECTOR_VIRTUAL);
        if (ret) {
@@ -1798,7 +1792,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
                goto err_free_encoder;
        }
 
-       vmw_du_crtc_reset(crtc);
        ret = drm_crtc_init_with_planes(dev, crtc, &stdu->base.primary,
                                        &stdu->base.cursor,
                                        &vmw_stdu_crtc_funcs, NULL);
@@ -1894,6 +1887,8 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
                }
        }
 
+       drm_mode_config_reset(dev);
+
        DRM_INFO("Screen Target Display device initialized\n");
 
        return 0;
index 126f93c0b0b89b5898853ab9329902a9cec9af3b..3914bfee0533b578a176a2de9de51ceb33a2ea82 100644 (file)
@@ -1969,7 +1969,7 @@ static int vmw_surface_dirty_alloc(struct vmw_resource *res)
                num_mip = 1;
 
        num_subres = num_layers * num_mip;
-       dirty_size = sizeof(*dirty) + num_subres * sizeof(dirty->boxes[0]);
+       dirty_size = struct_size(dirty, boxes, num_subres);
        acc_size = ttm_round_pot(dirty_size);
        ret = ttm_mem_global_alloc(vmw_mem_glob(res->dev_priv),
                                   acc_size, &ctx);