]> Git Repo - linux.git/commitdiff
Merge tag 'drm-misc-next-2021-10-06' of git://anongit.freedesktop.org/drm/drm-misc...
authorDave Airlie <[email protected]>
Mon, 11 Oct 2021 02:39:14 +0000 (12:39 +1000)
committerDave Airlie <[email protected]>
Mon, 11 Oct 2021 02:39:15 +0000 (12:39 +1000)
drm-misc-next for v5.16:

UAPI Changes:
- Allow empty drm leases for creating separate GEM namespaces.

Cross-subsystem Changes:
- Slightly rework dma_buf_poll.
- Add dma_resv_for_each_fence_unlocked to iterate, and use it inside
  the lockless dma-resv functions.

Core Changes:
- Allow devm_drm_of_get_bridge to build without CONFIG_OF for compile testing.
- Add more DP2 headers.
- fix CONFIG_FB dependency in fb_helper.
- Add DRM_FORMAT_R8 to drm_format_info, and helpers for RGB332 and RGB888.
- Fix crash on a 0 or invalid EDID.

Driver Changes:
- Apply and revert DRM_MODESET_LOCK_ALL_BEGIN.
- Add mode_valid to ti-sn65dsi86 bridge.
- Support multiple syncobjs in v3d.
- Add R8, RGB332 and RGB888 pixel formats to GUD.
- Use devm_add_action_or_reset in dw-hdmi-cec.

Signed-off-by: Dave Airlie <[email protected]>
# gpg: Signature made Wed 06 Oct 2021 20:48:12 AEST
# gpg:                using RSA key B97BD6A80CAC4981091AE547FE558C72A67013C3
# gpg: Good signature from "Maarten Lankhorst <[email protected]>" [expired]
# gpg:                 aka "Maarten Lankhorst <[email protected]>" [expired]
# gpg:                 aka "Maarten Lankhorst <[email protected]>" [expired]
# gpg: Note: This key has expired!
# Primary key fingerprint: B97B D6A8 0CAC 4981 091A  E547 FE55 8C72 A670 13C3
From: Maarten Lankhorst <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1  2 
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/vc4/vc4_hdmi.c

index 5d5c42ae388bd7282b4c3ec4ff9872e7250e3191,e8d70b6e6737dfff46d3ffafdeac2634574c46a9..19d4d8b544906f50f11d06fa209f5345998902ba
@@@ -515,15 -515,6 +515,15 @@@ static int amdgpu_bo_move(struct ttm_bu
                goto out;
        }
  
 +      if (bo->type == ttm_bo_type_device &&
 +          new_mem->mem_type == TTM_PL_VRAM &&
 +          old_mem->mem_type != TTM_PL_VRAM) {
 +              /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
 +               * accesses the BO after it's moved.
 +               */
 +              abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
 +      }
 +
        if (adev->mman.buffer_funcs_enabled) {
                if (((old_mem->mem_type == TTM_PL_SYSTEM &&
                      new_mem->mem_type == TTM_PL_VRAM) ||
                        return r;
        }
  
 -      if (bo->type == ttm_bo_type_device &&
 -          new_mem->mem_type == TTM_PL_VRAM &&
 -          old_mem->mem_type != TTM_PL_VRAM) {
 -              /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
 -               * accesses the BO after it's moved.
 -               */
 -              abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
 -      }
 -
  out:
        /* update statistics */
        atomic64_add(bo->base.size, &adev->num_bytes_moved);
@@@ -894,7 -894,7 +894,7 @@@ static int amdgpu_ttm_backend_bind(stru
                        DRM_ERROR("failed to pin userptr\n");
                        return r;
                }
-       } else if (ttm->page_flags & TTM_PAGE_FLAG_SG) {
+       } else if (ttm->page_flags & TTM_TT_FLAG_EXTERNAL) {
                if (!ttm->sg) {
                        struct dma_buf_attachment *attach;
                        struct sg_table *sgt;
@@@ -1119,6 -1119,8 +1119,8 @@@ static int amdgpu_ttm_tt_populate(struc
  {
        struct amdgpu_device *adev = amdgpu_ttm_adev(bdev);
        struct amdgpu_ttm_tt *gtt = (void *)ttm;
+       pgoff_t i;
+       int ret;
  
        /* user pages are bound by amdgpu_ttm_tt_pin_userptr() */
        if (gtt->userptr) {
                return 0;
        }
  
-       if (ttm->page_flags & TTM_PAGE_FLAG_SG)
+       if (ttm->page_flags & TTM_TT_FLAG_EXTERNAL)
                return 0;
  
-       return ttm_pool_alloc(&adev->mman.bdev.pool, ttm, ctx);
+       ret = ttm_pool_alloc(&adev->mman.bdev.pool, ttm, ctx);
+       if (ret)
+               return ret;
+       for (i = 0; i < ttm->num_pages; ++i)
+               ttm->pages[i]->mapping = bdev->dev_mapping;
+       return 0;
  }
  
  /*
@@@ -1145,6 -1154,7 +1154,7 @@@ static void amdgpu_ttm_tt_unpopulate(st
  {
        struct amdgpu_ttm_tt *gtt = (void *)ttm;
        struct amdgpu_device *adev;
+       pgoff_t i;
  
        amdgpu_ttm_backend_unbind(bdev, ttm);
  
                return;
        }
  
-       if (ttm->page_flags & TTM_PAGE_FLAG_SG)
+       if (ttm->page_flags & TTM_TT_FLAG_EXTERNAL)
                return;
  
+       for (i = 0; i < ttm->num_pages; ++i)
+               ttm->pages[i]->mapping = NULL;
        adev = amdgpu_ttm_adev(bdev);
        return ttm_pool_free(&adev->mman.bdev.pool, ttm);
  }
@@@ -1185,8 -1198,8 +1198,8 @@@ int amdgpu_ttm_tt_set_userptr(struct tt
                        return -ENOMEM;
        }
  
-       /* Set TTM_PAGE_FLAG_SG before populate but after create. */
-       bo->ttm->page_flags |= TTM_PAGE_FLAG_SG;
+       /* Set TTM_TT_FLAG_EXTERNAL before populate but after create. */
+       bo->ttm->page_flags |= TTM_TT_FLAG_EXTERNAL;
  
        gtt = (void *)bo->ttm;
        gtt->userptr = addr;
@@@ -2036,36 -2049,6 +2049,36 @@@ error_free
        return r;
  }
  
 +/**
 + * amdgpu_ttm_evict_resources - evict memory buffers
 + * @adev: amdgpu device object
 + * @mem_type: evicted BO's memory type
 + *
 + * Evicts all @mem_type buffers on the lru list of the memory type.
 + *
 + * Returns:
 + * 0 for success or a negative error code on failure.
 + */
 +int amdgpu_ttm_evict_resources(struct amdgpu_device *adev, int mem_type)
 +{
 +      struct ttm_resource_manager *man;
 +
 +      switch (mem_type) {
 +      case TTM_PL_VRAM:
 +      case TTM_PL_TT:
 +      case AMDGPU_PL_GWS:
 +      case AMDGPU_PL_GDS:
 +      case AMDGPU_PL_OA:
 +              man = ttm_manager_type(&adev->mman.bdev, mem_type);
 +              break;
 +      default:
 +              DRM_ERROR("Trying to evict invalid memory type\n");
 +              return -EINVAL;
 +      }
 +
 +      return ttm_resource_manager_evict_all(&adev->mman.bdev, man);
 +}
 +
  #if defined(CONFIG_DEBUG_FS)
  
  static int amdgpu_mm_vram_table_show(struct seq_file *m, void *unused)
index b4b4653fe301ed6866d61edb7b2ac4f057e8d153,01402a2c9358c39c1d96dd99233b469ad05cc85e..1bc675d727b61278838454e480034a81827f378d
@@@ -167,6 -167,8 +167,6 @@@ vc4_hdmi_connector_detect(struct drm_co
        struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
        bool connected = false;
  
 -      WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
 -
        if (vc4_hdmi->hpd_gpio &&
            gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) {
                connected = true;
                        }
                }
  
 -              pm_runtime_put(&vc4_hdmi->pdev->dev);
                return connector_status_connected;
        }
  
        cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
 -      pm_runtime_put(&vc4_hdmi->pdev->dev);
        return connector_status_disconnected;
  }
  
@@@ -432,7 -436,7 +432,7 @@@ static void vc4_hdmi_set_avi_infoframe(
        struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
        struct drm_connector *connector = &vc4_hdmi->connector;
        struct drm_connector_state *cstate = connector->state;
 -      struct drm_crtc *crtc = cstate->crtc;
 +      struct drm_crtc *crtc = encoder->crtc;
        const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
        union hdmi_infoframe frame;
        int ret;
@@@ -537,8 -541,11 +537,8 @@@ static bool vc4_hdmi_supports_scramblin
  
  static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder)
  {
 +      struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
        struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
 -      struct drm_connector *connector = &vc4_hdmi->connector;
 -      struct drm_connector_state *cstate = connector->state;
 -      struct drm_crtc *crtc = cstate->crtc;
 -      struct drm_display_mode *mode = &crtc->state->adjusted_mode;
  
        if (!vc4_hdmi_supports_scrambling(encoder, mode))
                return;
  static void vc4_hdmi_disable_scrambling(struct drm_encoder *encoder)
  {
        struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
 -      struct drm_connector *connector = &vc4_hdmi->connector;
 -      struct drm_connector_state *cstate = connector->state;
 +      struct drm_crtc *crtc = encoder->crtc;
  
        /*
 -       * At boot, connector->state will be NULL. Since we don't know the
 +       * At boot, encoder->crtc will be NULL. Since we don't know the
         * state of the scrambler and in order to avoid any
         * inconsistency, let's disable it all the time.
         */
 -      if (cstate && !vc4_hdmi_supports_scrambling(encoder, &cstate->crtc->mode))
 +      if (crtc && !vc4_hdmi_supports_scrambling(encoder, &crtc->mode))
                return;
  
 -      if (cstate && !vc4_hdmi_mode_needs_scrambling(&cstate->crtc->mode))
 +      if (crtc && !vc4_hdmi_mode_needs_scrambling(&crtc->mode))
                return;
  
        if (delayed_work_pending(&vc4_hdmi->scrambling_work))
@@@ -627,7 -635,6 +627,7 @@@ static void vc4_hdmi_encoder_post_crtc_
                vc4_hdmi->variant->phy_disable(vc4_hdmi);
  
        clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock);
 +      clk_disable_unprepare(vc4_hdmi->hsm_clock);
        clk_disable_unprepare(vc4_hdmi->pixel_clock);
  
        ret = pm_runtime_put(&vc4_hdmi->pdev->dev);
@@@ -891,7 -898,9 +891,7 @@@ static void vc4_hdmi_encoder_pre_crtc_c
                vc4_hdmi_encoder_get_connector_state(encoder, state);
        struct vc4_hdmi_connector_state *vc4_conn_state =
                conn_state_to_vc4_hdmi_conn_state(conn_state);
 -      struct drm_crtc_state *crtc_state =
 -              drm_atomic_get_new_crtc_state(state, conn_state->crtc);
 -      struct drm_display_mode *mode = &crtc_state->adjusted_mode;
 +      struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
        struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
        unsigned long bvb_rate, pixel_rate, hsm_rate;
        int ret;
                return;
        }
  
 +      ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
 +      if (ret) {
 +              DRM_ERROR("Failed to turn on HSM clock: %d\n", ret);
 +              clk_disable_unprepare(vc4_hdmi->pixel_clock);
 +              return;
 +      }
 +
        vc4_hdmi_cec_update_clk_div(vc4_hdmi);
  
        if (pixel_rate > 297000000)
        ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate);
        if (ret) {
                DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret);
 +              clk_disable_unprepare(vc4_hdmi->hsm_clock);
                clk_disable_unprepare(vc4_hdmi->pixel_clock);
                return;
        }
        ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
        if (ret) {
                DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret);
 +              clk_disable_unprepare(vc4_hdmi->hsm_clock);
                clk_disable_unprepare(vc4_hdmi->pixel_clock);
                return;
        }
  static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
                                             struct drm_atomic_state *state)
  {
 -      struct drm_connector_state *conn_state =
 -              vc4_hdmi_encoder_get_connector_state(encoder, state);
 -      struct drm_crtc_state *crtc_state =
 -              drm_atomic_get_new_crtc_state(state, conn_state->crtc);
 -      struct drm_display_mode *mode = &crtc_state->adjusted_mode;
 +      struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
        struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
        struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
  
  static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
                                              struct drm_atomic_state *state)
  {
 -      struct drm_connector_state *conn_state =
 -              vc4_hdmi_encoder_get_connector_state(encoder, state);
 -      struct drm_crtc_state *crtc_state =
 -              drm_atomic_get_new_crtc_state(state, conn_state->crtc);
 -      struct drm_display_mode *mode = &crtc_state->adjusted_mode;
 +      struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
        struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
        struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
        bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
@@@ -1196,8 -1204,8 +1196,8 @@@ static void vc4_hdmi_audio_set_mai_cloc
  
  static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate)
  {
 -      struct drm_connector *connector = &vc4_hdmi->connector;
 -      struct drm_crtc *crtc = connector->state->crtc;
 +      struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
 +      struct drm_crtc *crtc = encoder->crtc;
        const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
        u32 n, cts;
        u64 tmp;
@@@ -1230,13 -1238,13 +1230,13 @@@ static inline struct vc4_hdmi *dai_to_h
  static int vc4_hdmi_audio_startup(struct device *dev, void *data)
  {
        struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
 -      struct drm_connector *connector = &vc4_hdmi->connector;
 +      struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
  
        /*
         * If the HDMI encoder hasn't probed, or the encoder is
         * currently in DVI mode, treat the codec dai as missing.
         */
 -      if (!connector->state || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
 +      if (!encoder->crtc || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
                                VC4_HDMI_RAM_PACKET_ENABLE))
                return -ENODEV;
  
@@@ -1564,10 -1572,11 +1564,11 @@@ static int vc4_hdmi_audio_init(struct v
  static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
  {
        struct vc4_hdmi *vc4_hdmi = priv;
-       struct drm_device *dev = vc4_hdmi->connector.dev;
+       struct drm_connector *connector = &vc4_hdmi->connector;
+       struct drm_device *dev = connector->dev;
  
        if (dev && dev->registered)
-               drm_kms_helper_hotplug_event(dev);
+               drm_connector_helper_hpd_irq_event(connector);
  
        return IRQ_HANDLED;
  }
@@@ -2106,6 -2115,29 +2107,6 @@@ static int vc5_hdmi_init_resources(stru
        return 0;
  }
  
 -#ifdef CONFIG_PM
 -static int vc4_hdmi_runtime_suspend(struct device *dev)
 -{
 -      struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
 -
 -      clk_disable_unprepare(vc4_hdmi->hsm_clock);
 -
 -      return 0;
 -}
 -
 -static int vc4_hdmi_runtime_resume(struct device *dev)
 -{
 -      struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
 -      int ret;
 -
 -      ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
 -      if (ret)
 -              return ret;
 -
 -      return 0;
 -}
 -#endif
 -
  static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
  {
        const struct vc4_hdmi_variant *variant = of_device_get_match_data(dev);
@@@ -2360,11 -2392,18 +2361,11 @@@ static const struct of_device_id vc4_hd
        {}
  };
  
 -static const struct dev_pm_ops vc4_hdmi_pm_ops = {
 -      SET_RUNTIME_PM_OPS(vc4_hdmi_runtime_suspend,
 -                         vc4_hdmi_runtime_resume,
 -                         NULL)
 -};
 -
  struct platform_driver vc4_hdmi_driver = {
        .probe = vc4_hdmi_dev_probe,
        .remove = vc4_hdmi_dev_remove,
        .driver = {
                .name = "vc4_hdmi",
                .of_match_table = vc4_hdmi_dt_match,
 -              .pm = &vc4_hdmi_pm_ops,
        },
  };
This page took 0.091766 seconds and 4 git commands to generate.