* [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping
@ 2024-10-02 18:21 Ville Syrjala
2024-10-02 18:21 ` [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure Ville Syrjala
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Ville Syrjala @ 2024-10-02 18:21 UTC (permalink / raw)
To: dri-devel
Cc: intel-gfx, Abhinav Kumar, Alain Volmat, Alex Deucher,
Alexey Brodkin, amd-gfx, Andy Yan, Christian König,
Danilo Krummrich, Dmitry Baryshkov, freedreno, Hans de Goede,
Heiko Stübner, Inki Dae, Jyri Sarha, Karol Herbst,
linux-amlogic, linux-arm-msm, linux-arm-msm, linux-mediatek,
linux-renesas-soc, Liviu Dudau, Lyude Paul, Maíra Canal,
Marijn Suijten, nouveau, nouveau, Patrik Jakobsson, Rob Clark,
Russell King, Sandy Huang, Sean Paul, spice-devel, virtualization,
xen-devel, Xinhui Pan, Zack Rusin
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
An attempt to hide the drm_plane/crtc legacy state better.
This also highlights the fact that a lot of supposedly
atomic drivers are poking around in the legacy crtc state,
which is rather questionable. For planes we did force the
legacy state to NULL already to force drivers to behave.
But even then it seems capable of confusing people with
its high profile location directly under drm_plane.
This might end up as some kind of conflict
galore, but the alternative would involve trying
to wean the atomic drivers off one by one,
which would probably take forever. At least with
this the issue becomes visible and shouldn't be
forgotten as easily.
The cc list was getting way out of hand, so I had
to trim it a bit. Hopefully I didn't chop off too
many names...
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Alain Volmat <alain.volmat@foss.st.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@redhat.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: freedreno@lists.freedesktop.org
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jyri Sarha <jyri.sarha@iki.fi>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: linux-amlogic@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.orga
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: "Maíra Canal" <mairacanal@riseup.net>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: nouveau@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.orga
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: Sean Paul <sean@poorly.run>
Cc: spice-devel@lists.freedesktop.org
Cc: virtualization@lists.linux.dev
Cc: xen-devel@lists.xenproject.org
Cc: Xinhui Pan <Xinhui.Pan@amd.com>
Cc: Zack Rusin <zack.rusin@broadcom.com>
Ville Syrjälä (2):
drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure
drm: Move crtc->{x,y,mode,enabled} to legacy sub-structure
.../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 7 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 20 ++---
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 2 +-
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 35 ++++----
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 35 ++++----
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 37 ++++-----
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 35 ++++----
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++--
.../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +-
drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c | 4 +-
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +-
drivers/gpu/drm/arm/malidp_hw.c | 2 +-
drivers/gpu/drm/armada/armada_crtc.c | 12 ++-
drivers/gpu/drm/ast/ast_dp.c | 8 +-
drivers/gpu/drm/drm_atomic.c | 6 +-
drivers/gpu/drm/drm_atomic_helper.c | 8 +-
drivers/gpu/drm/drm_client_modeset.c | 10 +--
drivers/gpu/drm/drm_crtc.c | 31 +++----
drivers/gpu/drm/drm_crtc_helper.c | 80 ++++++++++---------
drivers/gpu/drm/drm_fb_helper.c | 12 +--
drivers/gpu/drm/drm_framebuffer.c | 4 +-
drivers/gpu/drm/drm_plane.c | 69 ++++++++--------
drivers/gpu/drm/drm_plane_helper.c | 6 +-
drivers/gpu/drm/drm_vblank.c | 2 +-
drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 +-
drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +-
drivers/gpu/drm/gma500/cdv_intel_dp.c | 6 +-
drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 3 +-
drivers/gpu/drm/gma500/cdv_intel_lvds.c | 6 +-
drivers/gpu/drm/gma500/gma_display.c | 22 ++---
drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +-
drivers/gpu/drm/gma500/psb_intel_display.c | 2 +-
drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 +-
drivers/gpu/drm/gma500/psb_intel_sdvo.c | 8 +-
drivers/gpu/drm/i2c/ch7006_drv.c | 7 +-
drivers/gpu/drm/i2c/sil164_drv.c | 2 +-
.../drm/i915/display/intel_modeset_setup.c | 4 +-
drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 31 ++++---
drivers/gpu/drm/mediatek/mtk_crtc.c | 6 +-
drivers/gpu/drm/meson/meson_overlay.c | 2 +-
drivers/gpu/drm/meson/meson_plane.c | 8 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 18 +++--
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 16 ++--
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 +-
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 25 +++---
drivers/gpu/drm/nouveau/dispnv04/cursor.c | 2 +-
drivers/gpu/drm/nouveau/dispnv04/dfp.c | 2 +-
drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 +-
.../gpu/drm/nouveau/dispnv04/tvmodesnv17.c | 4 +-
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 7 +-
drivers/gpu/drm/nouveau/nouveau_connector.c | 6 +-
drivers/gpu/drm/qxl/qxl_display.c | 6 +-
drivers/gpu/drm/radeon/atombios_crtc.c | 28 +++----
drivers/gpu/drm/radeon/cik.c | 12 +--
drivers/gpu/drm/radeon/evergreen.c | 16 ++--
drivers/gpu/drm/radeon/r100.c | 16 ++--
drivers/gpu/drm/radeon/r600_cs.c | 2 +-
drivers/gpu/drm/radeon/r600_dpm.c | 4 +-
drivers/gpu/drm/radeon/radeon_connectors.c | 7 +-
drivers/gpu/drm/radeon/radeon_cursor.c | 29 +++----
drivers/gpu/drm/radeon/radeon_device.c | 2 +-
drivers/gpu/drm/radeon/radeon_display.c | 26 +++---
drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 16 ++--
.../gpu/drm/radeon/radeon_legacy_encoders.c | 2 +-
drivers/gpu/drm/radeon/radeon_pm.c | 2 +-
drivers/gpu/drm/radeon/rs600.c | 10 +--
drivers/gpu/drm/radeon/rs690.c | 22 ++---
drivers/gpu/drm/radeon/rs780_dpm.c | 6 +-
drivers/gpu/drm/radeon/rv515.c | 30 +++----
drivers/gpu/drm/radeon/rv770.c | 2 +-
drivers/gpu/drm/radeon/si.c | 14 ++--
.../gpu/drm/renesas/rcar-du/rcar_du_crtc.c | 2 +-
.../gpu/drm/renesas/shmobile/shmob_drm_crtc.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +-
drivers/gpu/drm/sti/sti_crtc.c | 4 +-
drivers/gpu/drm/sti/sti_cursor.c | 2 +-
drivers/gpu/drm/sti/sti_gdp.c | 2 +-
drivers/gpu/drm/sti/sti_hqvdp.c | 2 +-
drivers/gpu/drm/sti/sti_tvout.c | 6 +-
drivers/gpu/drm/sti/sti_vid.c | 2 +-
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 10 +--
drivers/gpu/drm/tiny/arcpgu.c | 2 +-
drivers/gpu/drm/vboxvideo/vbox_mode.c | 2 +-
drivers/gpu/drm/vc4/vc4_dpi.c | 2 +-
drivers/gpu/drm/vc4/vc4_plane.c | 4 +-
drivers/gpu/drm/virtio/virtgpu_display.c | 4 +-
drivers/gpu/drm/vkms/vkms_composer.c | 4 +-
drivers/gpu/drm/vkms/vkms_crtc.c | 2 +-
drivers/gpu/drm/vkms/vkms_writeback.c | 4 +-
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 8 +-
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 18 +++--
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 9 ++-
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +-
drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 2 +-
drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +-
include/drm/drm_crtc.h | 75 ++++++++---------
include/drm/drm_plane.h | 52 ++++++------
100 files changed, 599 insertions(+), 547 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure 2024-10-02 18:21 [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjala @ 2024-10-02 18:21 ` Ville Syrjala 2024-10-03 11:12 ` Ville Syrjälä [not found] ` <20241002182200.15363-3-ville.syrjala@linux.intel.com> 2024-10-25 7:46 ` [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjälä 2 siblings, 1 reply; 13+ messages in thread From: Ville Syrjala @ 2024-10-02 18:21 UTC (permalink / raw) To: dri-devel Cc: intel-gfx, Alex Deucher, Christian König, Xinhui Pan, Patrik Jakobsson, Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten, Karol Herbst, Lyude Paul, Danilo Krummrich, Sandy Huang, Heiko Stübner, Andy Yan, amd-gfx, linux-arm-msm, freedreno, nouveau From: Ville Syrjälä <ville.syrjala@linux.intel.com> Hide the plane->fb/etc. footguns better by stashing them inside a "legacy" sub struct. Eventually maybe we could turn 'legacy' into a pointer that only exists on legacy drivers to completely prevent any abuse by atomic drivers... Side note: _dpu_plane_set_danger_state() looks completely broken. Cc: Alex Deucher <alexander.deucher@amd.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: Xinhui Pan <Xinhui.Pan@amd.com> Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Sean Paul <sean@poorly.run> Cc: Marijn Suijten <marijn.suijten@somainline.org> Cc: Karol Herbst <kherbst@redhat.com> Cc: Lyude Paul <lyude@redhat.com> Cc: Danilo Krummrich <dakr@redhat.com> Cc: Sandy Huang <hjc@rock-chips.com> Cc: "Heiko Stübner" <heiko@sntech.de> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: amd-gfx@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Link: https://www.youtube.com/watch?v=gtCCi2mSN80 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> --- .../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 +- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 12 ++-- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 12 ++-- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 12 ++-- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 12 ++-- drivers/gpu/drm/drm_atomic.c | 6 +- drivers/gpu/drm/drm_crtc.c | 22 +++---- drivers/gpu/drm/drm_crtc_helper.c | 20 +++--- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/gpu/drm/drm_framebuffer.c | 4 +- drivers/gpu/drm/drm_plane.c | 64 +++++++++---------- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 3 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 14 ++-- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 2 +- drivers/gpu/drm/i2c/ch7006_drv.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 16 ++--- drivers/gpu/drm/nouveau/dispnv04/dfp.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 +- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 16 ++--- drivers/gpu/drm/radeon/evergreen.c | 2 +- drivers/gpu/drm/radeon/r100.c | 6 +- drivers/gpu/drm/radeon/radeon_connectors.c | 3 +- drivers/gpu/drm/radeon/radeon_device.c | 2 +- drivers/gpu/drm/radeon/radeon_display.c | 4 +- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 14 ++-- drivers/gpu/drm/radeon/rs600.c | 2 +- drivers/gpu/drm/radeon/rv770.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- include/drm/drm_plane.h | 52 +++++++-------- 38 files changed, 173 insertions(+), 169 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 344e0a9ee08a..90973470b6da 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -94,7 +94,7 @@ static void amdgpu_connector_property_change_mode(struct drm_encoder *encoder) if (crtc && crtc->enabled) { drm_crtc_helper_set_mode(crtc, &crtc->mode, - crtc->x, crtc->y, crtc->primary->fb); + crtc->x, crtc->y, crtc->primary->legacy.fb); } } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index b119d27271c1..1b1448a58543 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -216,7 +216,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; /* schedule unpin of the old buffer */ - obj = crtc->primary->fb->obj[0]; + obj = crtc->primary->legacy.fb->obj[0]; /* take a reference to the old object */ work->old_abo = gem_to_amdgpu_bo(obj); @@ -280,7 +280,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, DRM_DEBUG_DRIVER("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n", amdgpu_crtc->crtc_id, amdgpu_crtc, work); /* update crtc fb */ - crtc->primary->fb = fb; + crtc->primary->legacy.fb = fb; spin_unlock_irqrestore(&crtc->dev->event_lock, flags); amdgpu_display_flip_work_func(&work->flip_work.work); return 0; @@ -1715,7 +1715,7 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct amdgpu_bo *robj; if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 70c1399f738d..db19854f04f2 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -235,7 +235,7 @@ static void dce_v10_0_page_flip(struct amdgpu_device *adev, int crtc_id, u64 crtc_base, bool async) { struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; u32 tmp; /* flip at hsync for async, default is vsync */ @@ -1861,7 +1861,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, bool bypass_lut = false; /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -1869,7 +1869,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; /* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers @@ -2074,7 +2074,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, /* set pageflip to happen anywhere in vblank interval */ WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { abo = gem_to_amdgpu_bo(fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r != 0)) @@ -2557,11 +2557,11 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc) int i; dce_v10_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { + if (crtc->primary->legacy.fb) { int r; struct amdgpu_bo *abo; - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r)) DRM_ERROR("failed to reserve abo before unpin\n"); diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index f154c24499c8..af889d0b6826 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -259,7 +259,7 @@ static void dce_v11_0_page_flip(struct amdgpu_device *adev, int crtc_id, u64 crtc_base, bool async) { struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; u32 tmp; /* flip immediate for async, default is vsync */ @@ -1911,7 +1911,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, bool bypass_lut = false; /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -1919,7 +1919,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; /* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers @@ -2124,7 +2124,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, /* set pageflip to happen anywhere in vblank interval */ WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { abo = gem_to_amdgpu_bo(fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r != 0)) @@ -2641,11 +2641,11 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc) int i; dce_v11_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { + if (crtc->primary->legacy.fb) { int r; struct amdgpu_bo *abo; - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r)) DRM_ERROR("failed to reserve abo before unpin\n"); diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index a7fcb135827f..d55be18957b3 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -195,7 +195,7 @@ static void dce_v6_0_page_flip(struct amdgpu_device *adev, int crtc_id, u64 crtc_base, bool async) { struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; /* flip at hsync for async, default is vsync */ WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ? @@ -1841,7 +1841,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, bool bypass_lut = false; /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -1849,7 +1849,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; /* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers @@ -2032,7 +2032,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, /* set pageflip to happen anywhere in vblank interval */ WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { abo = gem_to_amdgpu_bo(fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r != 0)) @@ -2472,11 +2472,11 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc) int i; dce_v6_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { + if (crtc->primary->legacy.fb) { int r; struct amdgpu_bo *abo; - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r)) DRM_ERROR("failed to reserve abo before unpin\n"); diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index 77ac3f114d24..7a24d5835107 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -186,7 +186,7 @@ static void dce_v8_0_page_flip(struct amdgpu_device *adev, int crtc_id, u64 crtc_base, bool async) { struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; /* flip at hsync for async, default is vsync */ WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ? @@ -1808,7 +1808,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, bool bypass_lut = false; /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -1816,7 +1816,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; /* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers @@ -2001,7 +2001,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, /* set pageflip to happen anywhere in vblank interval */ WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { abo = gem_to_amdgpu_bo(fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r != 0)) @@ -2476,11 +2476,11 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc) int i; dce_v8_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { + if (crtc->primary->legacy.fb) { int r; struct amdgpu_bo *abo; - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); r = amdgpu_bo_reserve(abo, true); if (unlikely(r)) DRM_ERROR("failed to reserve abo before unpin\n"); diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 0fc99da93afe..4cfabc8d20e5 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -530,9 +530,9 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, WARN_ON(!state->acquire_ctx); /* the legacy pointers should never be set */ - WARN_ON(plane->fb); - WARN_ON(plane->old_fb); - WARN_ON(plane->crtc); + WARN_ON(plane->legacy.fb); + WARN_ON(plane->legacy.old_fb); + WARN_ON(plane->legacy.crtc); plane_state = drm_atomic_get_existing_plane_state(state, plane); if (plane_state) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 3488ff067c69..db9e6253949f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -544,8 +544,8 @@ int drm_mode_getcrtc(struct drm_device *dev, drm_modeset_lock(&plane->mutex, NULL); if (plane->state && plane->state->fb) crtc_resp->fb_id = plane->state->fb->base.id; - else if (!plane->state && plane->fb) - crtc_resp->fb_id = plane->fb->base.id; + else if (!plane->state && plane->legacy.fb) + crtc_resp->fb_id = plane->legacy.fb->base.id; else crtc_resp->fb_id = 0; @@ -600,7 +600,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, drm_for_each_crtc(tmp, crtc->dev) { struct drm_plane *plane = tmp->primary; - plane->old_fb = plane->fb; + plane->legacy.old_fb = plane->legacy.fb; } fb = set->fb; @@ -609,18 +609,18 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, if (ret == 0) { struct drm_plane *plane = crtc->primary; - plane->crtc = fb ? crtc : NULL; - plane->fb = fb; + plane->legacy.crtc = fb ? crtc : NULL; + plane->legacy.fb = fb; } drm_for_each_crtc(tmp, crtc->dev) { struct drm_plane *plane = tmp->primary; - if (plane->fb) - drm_framebuffer_get(plane->fb); - if (plane->old_fb) - drm_framebuffer_put(plane->old_fb); - plane->old_fb = NULL; + if (plane->legacy.fb) + drm_framebuffer_get(plane->legacy.fb); + if (plane->legacy.old_fb) + drm_framebuffer_put(plane->legacy.old_fb); + plane->legacy.old_fb = NULL; } return ret; @@ -739,7 +739,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, if (plane->state) old_fb = plane->state->fb; else - old_fb = plane->fb; + old_fb = plane->legacy.fb; if (!old_fb) { drm_dbg_kms(dev, "CRTC doesn't have current FB\n"); diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 0955f1c385dd..1df4a05f7a01 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -204,7 +204,7 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev) (*crtc_funcs->disable)(crtc); else (*crtc_funcs->dpms)(crtc, DRM_MODE_DPMS_OFF); - crtc->primary->fb = NULL; + crtc->primary->legacy.fb = NULL; } } } @@ -635,17 +635,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, save_set.mode = &set->crtc->mode; save_set.x = set->crtc->x; save_set.y = set->crtc->y; - save_set.fb = set->crtc->primary->fb; + save_set.fb = set->crtc->primary->legacy.fb; /* We should be able to check here if the fb has the same properties * and then just flip_or_move it */ - if (set->crtc->primary->fb != set->fb) { + if (set->crtc->primary->legacy.fb != set->fb) { /* If we have no fb then treat it as a full mode set */ - if (set->crtc->primary->fb == NULL) { + if (set->crtc->primary->legacy.fb == NULL) { drm_dbg_kms(dev, "[CRTC:%d:%s] no fb, full mode set\n", set->crtc->base.id, set->crtc->name); mode_changed = true; - } else if (set->fb->format != set->crtc->primary->fb->format) { + } else if (set->fb->format != set->crtc->primary->legacy.fb->format) { mode_changed = true; } else fb_changed = true; @@ -768,13 +768,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, if (drm_helper_crtc_in_use(set->crtc)) { drm_dbg_kms(dev, "[CRTC:%d:%s] attempting to set mode from userspace: " DRM_MODE_FMT "\n", set->crtc->base.id, set->crtc->name, DRM_MODE_ARG(set->mode)); - set->crtc->primary->fb = set->fb; + set->crtc->primary->legacy.fb = set->fb; if (!drm_crtc_helper_set_mode(set->crtc, set->mode, set->x, set->y, save_set.fb)) { drm_err(dev, "[CRTC:%d:%s] failed to set mode\n", set->crtc->base.id, set->crtc->name); - set->crtc->primary->fb = save_set.fb; + set->crtc->primary->legacy.fb = save_set.fb; ret = -EINVAL; goto fail; } @@ -790,13 +790,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, } else if (fb_changed) { set->crtc->x = set->x; set->crtc->y = set->y; - set->crtc->primary->fb = set->fb; + set->crtc->primary->legacy.fb = set->fb; ret = crtc_funcs->mode_set_base(set->crtc, set->x, set->y, save_set.fb); if (ret != 0) { set->crtc->x = save_set.x; set->crtc->y = save_set.y; - set->crtc->primary->fb = save_set.fb; + set->crtc->primary->legacy.fb = save_set.fb; goto fail; } } @@ -997,7 +997,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev) continue; ret = drm_crtc_helper_set_mode(crtc, &crtc->mode, - crtc->x, crtc->y, crtc->primary->fb); + crtc->x, crtc->y, crtc->primary->legacy.fb); /* Restoring the old config should never fail! */ if (ret == false) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index d5e8994345bb..fd9d804e3672 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -189,7 +189,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info) continue; funcs = crtc->helper_private; - fb = crtc->primary->fb; + fb = crtc->primary->legacy.fb; if (!crtc->enabled) continue; diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 47e6e8577b62..ab7d4d4c0917 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -1081,7 +1081,7 @@ static void legacy_remove_fb(struct drm_framebuffer *fb) drm_modeset_lock_all(dev); /* remove from any CRTC */ drm_for_each_crtc(crtc, dev) { - if (crtc->primary->fb == fb) { + if (crtc->primary->legacy.fb == fb) { drm_dbg_kms(dev, "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n", crtc->base.id, crtc->name, fb->base.id); @@ -1093,7 +1093,7 @@ static void legacy_remove_fb(struct drm_framebuffer *fb) } drm_for_each_plane(plane, dev) { - if (plane->fb == fb) { + if (plane->legacy.fb == fb) { drm_dbg_kms(dev, "Disabling [PLANE:%d:%s] because [FB:%d] is removed\n", plane->base.id, plane->name, fb->base.id); diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index a28b22fdd7a4..4b077110238a 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -723,23 +723,23 @@ void drm_plane_force_disable(struct drm_plane *plane) { int ret; - if (!plane->fb) + if (!plane->legacy.fb) return; WARN_ON(drm_drv_uses_atomic_modeset(plane->dev)); - plane->old_fb = plane->fb; + plane->legacy.old_fb = plane->legacy.fb; ret = plane->funcs->disable_plane(plane, NULL); if (ret) { DRM_ERROR("failed to disable plane with busy fb\n"); - plane->old_fb = NULL; + plane->legacy.old_fb = NULL; return; } /* disconnect the plane from the fb and crtc: */ - drm_framebuffer_put(plane->old_fb); - plane->old_fb = NULL; - plane->fb = NULL; - plane->crtc = NULL; + drm_framebuffer_put(plane->legacy.old_fb); + plane->legacy.old_fb = NULL; + plane->legacy.fb = NULL; + plane->legacy.crtc = NULL; } EXPORT_SYMBOL(drm_plane_force_disable); @@ -840,15 +840,15 @@ int drm_mode_getplane(struct drm_device *dev, void *data, drm_modeset_lock(&plane->mutex, NULL); if (plane->state && plane->state->crtc && drm_lease_held(file_priv, plane->state->crtc->base.id)) plane_resp->crtc_id = plane->state->crtc->base.id; - else if (!plane->state && plane->crtc && drm_lease_held(file_priv, plane->crtc->base.id)) - plane_resp->crtc_id = plane->crtc->base.id; + else if (!plane->state && plane->legacy.crtc && drm_lease_held(file_priv, plane->legacy.crtc->base.id)) + plane_resp->crtc_id = plane->legacy.crtc->base.id; else plane_resp->crtc_id = 0; if (plane->state && plane->state->fb) plane_resp->fb_id = plane->state->fb->base.id; - else if (!plane->state && plane->fb) - plane_resp->fb_id = plane->fb->base.id; + else if (!plane->state && plane->legacy.fb) + plane_resp->fb_id = plane->legacy.fb->base.id; else plane_resp->fb_id = 0; drm_modeset_unlock(&plane->mutex); @@ -1004,13 +1004,13 @@ static int __setplane_internal(struct drm_plane *plane, /* No fb means shut it down */ if (!fb) { - plane->old_fb = plane->fb; + plane->legacy.old_fb = plane->legacy.fb; ret = plane->funcs->disable_plane(plane, ctx); if (!ret) { - plane->crtc = NULL; - plane->fb = NULL; + plane->legacy.crtc = NULL; + plane->legacy.fb = NULL; } else { - plane->old_fb = NULL; + plane->legacy.old_fb = NULL; } goto out; } @@ -1021,22 +1021,22 @@ static int __setplane_internal(struct drm_plane *plane, if (ret) goto out; - plane->old_fb = plane->fb; + plane->legacy.old_fb = plane->legacy.fb; ret = plane->funcs->update_plane(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h, ctx); if (!ret) { - plane->crtc = crtc; - plane->fb = fb; - drm_framebuffer_get(plane->fb); + plane->legacy.crtc = crtc; + plane->legacy.fb = fb; + drm_framebuffer_get(plane->legacy.fb); } else { - plane->old_fb = NULL; + plane->legacy.old_fb = NULL; } out: - if (plane->old_fb) - drm_framebuffer_put(plane->old_fb); - plane->old_fb = NULL; + if (plane->legacy.old_fb) + drm_framebuffer_put(plane->legacy.old_fb); + plane->legacy.old_fb = NULL; return ret; } @@ -1178,7 +1178,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, int ret = 0; BUG_ON(!plane); - WARN_ON(plane->crtc != crtc && plane->crtc != NULL); + WARN_ON(plane->legacy.crtc != crtc && plane->legacy.crtc != NULL); /* * Obtain fb we'll be using (either new or existing) and take an extra @@ -1204,7 +1204,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, if (plane->state) fb = plane->state->fb; else - fb = plane->fb; + fb = plane->legacy.fb; if (fb) drm_framebuffer_get(fb); @@ -1441,7 +1441,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, if (plane->state) old_fb = plane->state->fb; else - old_fb = plane->fb; + old_fb = plane->legacy.fb; if (old_fb == NULL) { /* The framebuffer is currently unbound, presumably @@ -1506,7 +1506,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, } } - plane->old_fb = plane->fb; + plane->legacy.old_fb = plane->legacy.fb; if (crtc->funcs->page_flip_target) ret = crtc->funcs->page_flip_target(crtc, fb, e, page_flip->flags, @@ -1519,10 +1519,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) drm_event_cancel_free(dev, &e->base); /* Keep the old fb, don't unref it. */ - plane->old_fb = NULL; + plane->legacy.old_fb = NULL; } else { if (!plane->state) { - plane->fb = fb; + plane->legacy.fb = fb; drm_framebuffer_get(fb); } } @@ -1531,9 +1531,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, if (fb) drm_framebuffer_put(fb); fb = NULL; - if (plane->old_fb) - drm_framebuffer_put(plane->old_fb); - plane->old_fb = NULL; + if (plane->legacy.old_fb) + drm_framebuffer_put(plane->legacy.old_fb); + plane->legacy.old_fb = NULL; if (ret == -EDEADLK) { ret = drm_modeset_backoff(&ctx); diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c index bbd0abdd8382..faef6f724446 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_display.c +++ b/drivers/gpu/drm/gma500/cdv_intel_display.c @@ -462,7 +462,7 @@ static bool cdv_intel_pipe_enabled(struct drm_device *dev, int pipe) crtc = dev_priv->pipe_to_crtc_mapping[pipe]; gma_crtc = to_gma_crtc(crtc); - if (crtc->primary->fb == NULL || !gma_crtc->active) + if (crtc->primary->legacy.fb == NULL || !gma_crtc->active) return false; return true; } diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c index cc2ed9b3fd2d..49851881e41e 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c @@ -1849,7 +1849,7 @@ cdv_intel_dp_set_property(struct drm_connector *connector, struct drm_crtc *crtc = encoder->base.crtc; drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->legacy.fb); } return 0; diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c index 2d95e0471291..16968c94bfd3 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c @@ -191,7 +191,8 @@ static int cdv_hdmi_set_property(struct drm_connector *connector, crtc->saved_mode.vdisplay != 0) { if (centre) { if (!drm_crtc_helper_set_mode(encoder->crtc, &crtc->saved_mode, - encoder->crtc->x, encoder->crtc->y, encoder->crtc->primary->fb)) + encoder->crtc->x, encoder->crtc->y, + encoder->crtc->primary->legacy.fb)) return -1; } else { const struct drm_encoder_helper_funcs *helpers diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c index f3a4517bdf27..b607355b85dd 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c @@ -375,7 +375,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector, &crtc->saved_mode, encoder->crtc->x, encoder->crtc->y, - encoder->crtc->primary->fb)) + encoder->crtc->primary->legacy.fb)) return -1; } } else if (!strcmp(property->name, "backlight") && encoder) { diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index f65e90d890f4..f2f8a95c8d39 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c @@ -61,7 +61,7 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y, struct drm_device *dev = crtc->dev; struct drm_psb_private *dev_priv = to_drm_psb_private(dev); struct gma_crtc *gma_crtc = to_gma_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct psb_gem_object *pobj; int pipe = gma_crtc->pipe; const struct psb_offset *map = &dev_priv->regmap[pipe]; @@ -490,8 +490,8 @@ void gma_crtc_disable(struct drm_crtc *crtc) crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { - pobj = to_psb_gem_object(crtc->primary->fb->obj[0]); + if (crtc->primary->legacy.fb) { + pobj = to_psb_gem_object(crtc->primary->legacy.fb->obj[0]); psb_gem_unpin(pobj); } } @@ -515,8 +515,8 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, struct drm_modeset_acquire_ctx *ctx) { struct gma_crtc *gma_crtc = to_gma_crtc(crtc); - struct drm_framebuffer *current_fb = crtc->primary->fb; - struct drm_framebuffer *old_fb = crtc->primary->old_fb; + struct drm_framebuffer *current_fb = crtc->primary->legacy.fb; + struct drm_framebuffer *old_fb = crtc->primary->legacy.old_fb; const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; struct drm_device *dev = crtc->dev; unsigned long flags; @@ -526,7 +526,7 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, return -EINVAL; /* Using mode_set_base requires the new fb to be set already. */ - crtc->primary->fb = fb; + crtc->primary->legacy.fb = fb; if (event) { spin_lock_irqsave(&dev->event_lock, flags); @@ -552,7 +552,7 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, /* Restore previous fb in case of failure. */ if (ret) - crtc->primary->fb = current_fb; + crtc->primary->legacy.fb = current_fb; return ret; } diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c index de8ccfe9890f..2c23b86a1ace 100644 --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c @@ -595,7 +595,7 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc, struct drm_device *dev = crtc->dev; struct drm_psb_private *dev_priv = to_drm_psb_private(dev); struct gma_crtc *gma_crtc = to_gma_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; int pipe = gma_crtc->pipe; const struct psb_offset *map = &dev_priv->regmap[pipe]; unsigned long start, offset; diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c index ff46e88c4768..03da68427318 100644 --- a/drivers/gpu/drm/gma500/psb_intel_display.c +++ b/drivers/gpu/drm/gma500/psb_intel_display.c @@ -112,7 +112,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc, const struct gma_limit_t *limit; /* No scan out no play */ - if (crtc->primary->fb == NULL) { + if (crtc->primary->legacy.fb == NULL) { crtc_funcs->mode_set_base(crtc, x, y, old_fb); return 0; } diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c index 138f153d38ba..1e80bc865843 100644 --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c @@ -570,7 +570,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector, &crtc->saved_mode, encoder->crtc->x, encoder->crtc->y, - encoder->crtc->primary->fb)) + encoder->crtc->primary->legacy.fb)) goto set_prop_error; } } else if (!strcmp(property->name, "backlight")) { diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c index 8dafff963ca8..9fab87f17dc9 100644 --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c @@ -1727,7 +1727,7 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, if (psb_intel_sdvo->base.base.crtc) { struct drm_crtc *crtc = psb_intel_sdvo->base.base.crtc; drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x, - crtc->y, crtc->primary->fb); + crtc->y, crtc->primary->legacy.fb); } return 0; diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index 131512a5f3bd..058cb389b8ec 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c @@ -364,7 +364,7 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, if (crtc) drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->legacy.fb); } return 0; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 9bcae53c4f45..9bd800a42253 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -122,11 +122,11 @@ static void _dpu_plane_set_danger_state(struct dpu_kms *kms, bool enable) struct drm_plane *plane; drm_for_each_plane(plane, kms->dev) { - if (plane->fb && plane->state) { + if (plane->legacy.fb && plane->state) { dpu_plane_danger_signal_ctrl(plane, enable); DPU_DEBUG("plane:%d img:%dx%d ", - plane->base.id, plane->fb->width, - plane->fb->height); + plane->base.id, plane->legacy.fb->width, + plane->legacy.fb->height); DPU_DEBUG("src[%d,%d,%d,%d] dst[%d,%d,%d,%d]\n", plane->state->src_x >> 16, plane->state->src_y >> 16, diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index 67146f1e8482..4cbc3976b180 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -239,7 +239,7 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) struct drm_device *dev = crtc->dev; struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index]; - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; /* Calculate our timings */ int horizDisplay = (mode->crtc_hdisplay >> 3) - 1; @@ -465,7 +465,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode) struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index]; struct nv04_crtc_reg *savep = &nv04_display(dev)->saved_reg.crtc_reg[nv_crtc->index]; - const struct drm_framebuffer *fb = crtc->primary->fb; + const struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct drm_encoder *encoder; bool lvds_output = false, tmds_output = false, tv_output = false, off_chip_digital = false; @@ -610,7 +610,7 @@ static int nv_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb) { struct nv04_display *disp = nv04_display(crtc->dev); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct nouveau_bo *nvbo = nouveau_gem_object(fb->obj[0]); struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); int ret; @@ -826,7 +826,7 @@ nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, * mark the lut values as dirty by setting depth==0, and it'll be * uploaded on the first mode_set_base() */ - if (!nv_crtc->base.primary->fb) { + if (!nv_crtc->base.primary->legacy.fb) { nv_crtc->lut.depth = 0; return 0; } @@ -852,7 +852,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, NV_DEBUG(drm, "index %d\n", nv_crtc->index); /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { NV_DEBUG(drm, "No FB bound\n"); return 0; } @@ -863,7 +863,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, if (atomic) { drm_fb = passed_fb; } else { - drm_fb = crtc->primary->fb; + drm_fb = crtc->primary->legacy.fb; } nvbo = nouveau_gem_object(drm_fb->obj[0]); @@ -1157,7 +1157,7 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, const int swap_interval = (flags & DRM_MODE_PAGE_FLIP_ASYNC) ? 0 : 1; struct drm_device *dev = crtc->dev; struct nouveau_drm *drm = nouveau_drm(dev); - struct drm_framebuffer *old_fb = crtc->primary->fb; + struct drm_framebuffer *old_fb = crtc->primary->legacy.fb; struct nouveau_bo *old_bo = nouveau_gem_object(old_fb->obj[0]); struct nouveau_bo *new_bo = nouveau_gem_object(fb->obj[0]); struct nv04_page_flip_state *s; @@ -1237,7 +1237,7 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, mutex_unlock(&cli->mutex); /* Update the crtc struct and cleanup */ - crtc->primary->fb = fb; + crtc->primary->legacy.fb = fb; nouveau_bo_fence(old_bo, fence, false); ttm_bo_unreserve(&old_bo->bo); diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouveau/dispnv04/dfp.c index 504c421aa176..be49c7180622 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c @@ -291,7 +291,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder, struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct drm_display_mode *output_mode = &nv_encoder->mode; struct drm_connector *connector = &nv_connector->base; - const struct drm_framebuffer *fb = encoder->crtc->primary->fb; + const struct drm_framebuffer *fb = encoder->crtc->primary->legacy.fb; uint32_t mode_ratio, panel_ratio; NV_DEBUG(drm, "Output mode on CRTC %d:\n", nv_crtc->index); diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index f71199a39bc4..45097913794c 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -76,7 +76,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool suspend) /* Un-pin FB and cursors so they'll be evicted to system memory. */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct nouveau_bo *nvbo; if (!fb || !fb->obj[0]) @@ -128,7 +128,7 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime) /* Re-pin FB/cursors. */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct nouveau_bo *nvbo; if (!fb || !fb->obj[0]) diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c index 3ecb101d23e9..4bc8039e6ee0 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c @@ -756,7 +756,7 @@ static int nv17_tv_set_property(struct drm_encoder *encoder, if (crtc) drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->legacy.fb); } return 0; diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 9b3a3a9d60e2..36e4663186c8 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c @@ -1150,7 +1150,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, bool bypass_lut = false; /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -1158,7 +1158,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; /* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers @@ -1437,7 +1437,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, /* set pageflip to happen anywhere in vblank interval */ WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { rbo = gem_to_radeon_bo(fb->obj[0]); r = radeon_bo_reserve(rbo, false); if (unlikely(r != 0)) @@ -1470,7 +1470,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, bool bypass_lut = false; /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -1478,7 +1478,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; obj = target_fb->obj[0]; rbo = gem_to_radeon_bo(obj); @@ -1645,7 +1645,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, /* set pageflip to happen only at start of vblank interval (front porch) */ WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { rbo = gem_to_radeon_bo(fb->obj[0]); r = radeon_bo_reserve(rbo, false); if (unlikely(r != 0)) @@ -2150,11 +2150,11 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) int i; atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { + if (crtc->primary->legacy.fb) { int r; struct radeon_bo *rbo; - rbo = gem_to_radeon_bo(crtc->primary->fb->obj[0]); + rbo = gem_to_radeon_bo(crtc->primary->legacy.fb->obj[0]); r = radeon_bo_reserve(rbo, false); if (unlikely(r)) DRM_ERROR("failed to reserve rbo before unpin\n"); diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index bc4ab71613a5..2cbcf7cfdc3c 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -1417,7 +1417,7 @@ void evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async) { struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; /* flip at hsync for async, default is vsync */ WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 80703417d8a1..1aa3126ab6d9 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c @@ -165,7 +165,7 @@ void r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool { struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; uint32_t crtc_pitch, pitch_pixels; - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; int i; @@ -3244,7 +3244,7 @@ void r100_bandwidth_update(struct radeon_device *rdev) if (rdev->mode_info.crtcs[0]->base.enabled) { const struct drm_framebuffer *fb = - rdev->mode_info.crtcs[0]->base.primary->fb; + rdev->mode_info.crtcs[0]->base.primary->legacy.fb; mode1 = &rdev->mode_info.crtcs[0]->base.mode; pixel_bytes1 = fb->format->cpp[0]; @@ -3252,7 +3252,7 @@ void r100_bandwidth_update(struct radeon_device *rdev) if (!(rdev->flags & RADEON_SINGLE_CRTC)) { if (rdev->mode_info.crtcs[1]->base.enabled) { const struct drm_framebuffer *fb = - rdev->mode_info.crtcs[1]->base.primary->fb; + rdev->mode_info.crtcs[1]->base.primary->legacy.fb; mode2 = &rdev->mode_info.crtcs[1]->base.mode; pixel_bytes2 = fb->format->cpp[0]; diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 528a8f3677c2..dbe0f75cfea7 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c @@ -92,7 +92,8 @@ static void radeon_property_change_mode(struct drm_encoder *encoder) if (crtc && crtc->enabled) { drm_crtc_helper_set_mode(crtc, &crtc->mode, - crtc->x, crtc->y, crtc->primary->fb); + crtc->x, crtc->y, + crtc->primary->legacy.fb); } } diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 554b236c2328..edea6d3638e5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1572,7 +1572,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct radeon_bo *robj; if (radeon_crtc->cursor_bo) { diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8f5f8abcb1b4..55f80424f514 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -506,7 +506,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc, work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; /* schedule unpin of the old buffer */ - obj = crtc->primary->fb->obj[0]; + obj = crtc->primary->legacy.fb->obj[0]; /* take a reference to the old object */ drm_gem_object_get(obj); @@ -595,7 +595,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc, radeon_crtc->flip_work = work; /* update crtc fb */ - crtc->primary->fb = fb; + crtc->primary->legacy.fb = fb; spin_unlock_irqrestore(&crtc->dev->event_lock, flags); diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 825b351ff53c..6b37b301ea1f 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c @@ -390,7 +390,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, DRM_DEBUG_KMS("\n"); /* no fb bound */ - if (!atomic && !crtc->primary->fb) { + if (!atomic && !crtc->primary->legacy.fb) { DRM_DEBUG_KMS("No FB bound\n"); return 0; } @@ -398,7 +398,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, if (atomic) target_fb = fb; else - target_fb = crtc->primary->fb; + target_fb = crtc->primary->legacy.fb; switch (target_fb->format->cpp[0] * 8) { case 8: @@ -445,7 +445,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, * We don't shutdown the display controller because new buffer * will end up in same spot. */ - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { struct radeon_bo *old_rbo; unsigned long nsize, osize; @@ -555,7 +555,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, crtc_offset); WREG32(RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch); - if (!atomic && fb && fb != crtc->primary->fb) { + if (!atomic && fb && fb != crtc->primary->legacy.fb) { rbo = gem_to_radeon_bo(fb->obj[0]); r = radeon_bo_reserve(rbo, false); if (unlikely(r != 0)) @@ -575,7 +575,7 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod struct drm_device *dev = crtc->dev; struct radeon_device *rdev = dev->dev_private; struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); - const struct drm_framebuffer *fb = crtc->primary->fb; + const struct drm_framebuffer *fb = crtc->primary->legacy.fb; struct drm_encoder *encoder; int format; int hsync_start; @@ -1088,11 +1088,11 @@ static void radeon_crtc_commit(struct drm_crtc *crtc) static void radeon_crtc_disable(struct drm_crtc *crtc) { radeon_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); - if (crtc->primary->fb) { + if (crtc->primary->legacy.fb) { int r; struct radeon_bo *rbo; - rbo = gem_to_radeon_bo(crtc->primary->fb->obj[0]); + rbo = gem_to_radeon_bo(crtc->primary->legacy.fb->obj[0]); r = radeon_bo_reserve(rbo, false); if (unlikely(r)) DRM_ERROR("failed to reserve rbo before unpin\n"); diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 88c8e91ea651..335df822b330 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c @@ -119,7 +119,7 @@ void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc) void rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async) { struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); int i; diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 7d4b0bf59109..4f3f19500adf 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c @@ -800,7 +800,7 @@ u32 rv770_get_xclk(struct radeon_device *rdev) void rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async) { struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); int i; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index f161f40d8ce4..14fce5c33e03 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1097,7 +1097,7 @@ static int vop_plane_atomic_async_check(struct drm_plane *plane, crtc_state = drm_atomic_get_existing_crtc_state(state, new_plane_state->crtc); else /* Special case for asynchronous cursor updates. */ - crtc_state = plane->crtc->state; + crtc_state = plane->legacy.crtc->state; return drm_atomic_helper_check_plane_state(plane->state, crtc_state, min_scale, max_scale, diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index dd718c62ac31..a2d91ee4b40c 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -663,31 +663,33 @@ struct drm_plane { /** @modifier_count: Size of the array pointed at by @modifier_count. */ unsigned int modifier_count; - /** - * @crtc: - * - * Currently bound CRTC, only meaningful for non-atomic drivers. For - * atomic drivers this is forced to be NULL, atomic drivers should - * instead check &drm_plane_state.crtc. - */ - struct drm_crtc *crtc; - - /** - * @fb: - * - * Currently bound framebuffer, only meaningful for non-atomic drivers. - * For atomic drivers this is forced to be NULL, atomic drivers should - * instead check &drm_plane_state.fb. - */ - struct drm_framebuffer *fb; - - /** - * @old_fb: - * - * Temporary tracking of the old fb while a modeset is ongoing. Only - * used by non-atomic drivers, forced to be NULL for atomic drivers. - */ - struct drm_framebuffer *old_fb; + struct { + /** + * @crtc: + * + * Currently bound CRTC, only meaningful for non-atomic drivers. For + * atomic drivers this is forced to be NULL, atomic drivers should + * instead check &drm_plane_state.crtc. + */ + struct drm_crtc *crtc; + + /** + * @fb: + * + * Currently bound framebuffer, only meaningful for non-atomic drivers. + * For atomic drivers this is forced to be NULL, atomic drivers should + * instead check &drm_plane_state.fb. + */ + struct drm_framebuffer *fb; + + /** + * @old_fb: + * + * Temporary tracking of the old fb while a modeset is ongoing. Only + * used by non-atomic drivers, forced to be NULL for atomic drivers. + */ + struct drm_framebuffer *old_fb; + } legacy; /** @funcs: plane control functions */ const struct drm_plane_funcs *funcs; -- 2.45.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure 2024-10-02 18:21 ` [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure Ville Syrjala @ 2024-10-03 11:12 ` Ville Syrjälä 2024-10-25 9:57 ` Jani Nikula 0 siblings, 1 reply; 13+ messages in thread From: Ville Syrjälä @ 2024-10-03 11:12 UTC (permalink / raw) To: dri-devel Cc: intel-gfx, Alex Deucher, Christian König, Xinhui Pan, Patrik Jakobsson, Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten, Karol Herbst, Lyude Paul, Danilo Krummrich, Sandy Huang, Heiko Stübner, Andy Yan, amd-gfx, linux-arm-msm, freedreno, nouveau On Wed, Oct 02, 2024 at 09:21:59PM +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Hide the plane->fb/etc. footguns better by stashing them inside > a "legacy" sub struct. > > Eventually maybe we could turn 'legacy' into a pointer > that only exists on legacy drivers to completely prevent > any abuse by atomic drivers... Hmm. I should probably make it a pointer from the start, to avoid having to go through the same churn yet again. > > Side note: _dpu_plane_set_danger_state() looks completely > broken. > > Cc: Alex Deucher <alexander.deucher@amd.com> > Cc: "Christian König" <christian.koenig@amd.com> > Cc: Xinhui Pan <Xinhui.Pan@amd.com> > Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> > Cc: Rob Clark <robdclark@gmail.com> > Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > Cc: Sean Paul <sean@poorly.run> > Cc: Marijn Suijten <marijn.suijten@somainline.org> > Cc: Karol Herbst <kherbst@redhat.com> > Cc: Lyude Paul <lyude@redhat.com> > Cc: Danilo Krummrich <dakr@redhat.com> > Cc: Sandy Huang <hjc@rock-chips.com> > Cc: "Heiko Stübner" <heiko@sntech.de> > Cc: Andy Yan <andy.yan@rock-chips.com> > Cc: amd-gfx@lists.freedesktop.org > Cc: linux-arm-msm@vger.kernel.org > Cc: freedreno@lists.freedesktop.org > Cc: nouveau@lists.freedesktop.org > Link: https://www.youtube.com/watch?v=gtCCi2mSN80 > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > .../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 +- > drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 12 ++-- > drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 12 ++-- > drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 12 ++-- > drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 12 ++-- > drivers/gpu/drm/drm_atomic.c | 6 +- > drivers/gpu/drm/drm_crtc.c | 22 +++---- > drivers/gpu/drm/drm_crtc_helper.c | 20 +++--- > drivers/gpu/drm/drm_fb_helper.c | 2 +- > drivers/gpu/drm/drm_framebuffer.c | 4 +- > drivers/gpu/drm/drm_plane.c | 64 +++++++++---------- > drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- > drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +- > drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 3 +- > drivers/gpu/drm/gma500/cdv_intel_lvds.c | 2 +- > drivers/gpu/drm/gma500/gma_display.c | 14 ++-- > drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- > drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- > drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- > drivers/gpu/drm/gma500/psb_intel_sdvo.c | 2 +- > drivers/gpu/drm/i2c/ch7006_drv.c | 2 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +- > drivers/gpu/drm/nouveau/dispnv04/crtc.c | 16 ++--- > drivers/gpu/drm/nouveau/dispnv04/dfp.c | 2 +- > drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 +- > drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 2 +- > drivers/gpu/drm/radeon/atombios_crtc.c | 16 ++--- > drivers/gpu/drm/radeon/evergreen.c | 2 +- > drivers/gpu/drm/radeon/r100.c | 6 +- > drivers/gpu/drm/radeon/radeon_connectors.c | 3 +- > drivers/gpu/drm/radeon/radeon_device.c | 2 +- > drivers/gpu/drm/radeon/radeon_display.c | 4 +- > drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 14 ++-- > drivers/gpu/drm/radeon/rs600.c | 2 +- > drivers/gpu/drm/radeon/rv770.c | 2 +- > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- > include/drm/drm_plane.h | 52 +++++++-------- > 38 files changed, 173 insertions(+), 169 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > index 344e0a9ee08a..90973470b6da 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > @@ -94,7 +94,7 @@ static void amdgpu_connector_property_change_mode(struct drm_encoder *encoder) > > if (crtc && crtc->enabled) { > drm_crtc_helper_set_mode(crtc, &crtc->mode, > - crtc->x, crtc->y, crtc->primary->fb); > + crtc->x, crtc->y, crtc->primary->legacy.fb); > } > } > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > index b119d27271c1..1b1448a58543 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c > @@ -216,7 +216,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, > work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; > > /* schedule unpin of the old buffer */ > - obj = crtc->primary->fb->obj[0]; > + obj = crtc->primary->legacy.fb->obj[0]; > > /* take a reference to the old object */ > work->old_abo = gem_to_amdgpu_bo(obj); > @@ -280,7 +280,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, > DRM_DEBUG_DRIVER("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n", > amdgpu_crtc->crtc_id, amdgpu_crtc, work); > /* update crtc fb */ > - crtc->primary->fb = fb; > + crtc->primary->legacy.fb = fb; > spin_unlock_irqrestore(&crtc->dev->event_lock, flags); > amdgpu_display_flip_work_func(&work->flip_work.work); > return 0; > @@ -1715,7 +1715,7 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev) > /* unpin the front buffers and cursors */ > list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { > struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct amdgpu_bo *robj; > > if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { > diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c > index 70c1399f738d..db19854f04f2 100644 > --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c > @@ -235,7 +235,7 @@ static void dce_v10_0_page_flip(struct amdgpu_device *adev, > int crtc_id, u64 crtc_base, bool async) > { > struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; > + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; > u32 tmp; > > /* flip at hsync for async, default is vsync */ > @@ -1861,7 +1861,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, > bool bypass_lut = false; > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -1869,7 +1869,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > /* If atomic, assume fb object is pinned & idle & fenced and > * just update base pointers > @@ -2074,7 +2074,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, > /* set pageflip to happen anywhere in vblank interval */ > WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > abo = gem_to_amdgpu_bo(fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r != 0)) > @@ -2557,11 +2557,11 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc) > int i; > > dce_v10_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); > - if (crtc->primary->fb) { > + if (crtc->primary->legacy.fb) { > int r; > struct amdgpu_bo *abo; > > - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); > + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r)) > DRM_ERROR("failed to reserve abo before unpin\n"); > diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c > index f154c24499c8..af889d0b6826 100644 > --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c > @@ -259,7 +259,7 @@ static void dce_v11_0_page_flip(struct amdgpu_device *adev, > int crtc_id, u64 crtc_base, bool async) > { > struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; > + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; > u32 tmp; > > /* flip immediate for async, default is vsync */ > @@ -1911,7 +1911,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, > bool bypass_lut = false; > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -1919,7 +1919,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > /* If atomic, assume fb object is pinned & idle & fenced and > * just update base pointers > @@ -2124,7 +2124,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, > /* set pageflip to happen anywhere in vblank interval */ > WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > abo = gem_to_amdgpu_bo(fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r != 0)) > @@ -2641,11 +2641,11 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc) > int i; > > dce_v11_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); > - if (crtc->primary->fb) { > + if (crtc->primary->legacy.fb) { > int r; > struct amdgpu_bo *abo; > > - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); > + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r)) > DRM_ERROR("failed to reserve abo before unpin\n"); > diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > index a7fcb135827f..d55be18957b3 100644 > --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c > @@ -195,7 +195,7 @@ static void dce_v6_0_page_flip(struct amdgpu_device *adev, > int crtc_id, u64 crtc_base, bool async) > { > struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; > + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; > > /* flip at hsync for async, default is vsync */ > WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ? > @@ -1841,7 +1841,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, > bool bypass_lut = false; > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -1849,7 +1849,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > /* If atomic, assume fb object is pinned & idle & fenced and > * just update base pointers > @@ -2032,7 +2032,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, > /* set pageflip to happen anywhere in vblank interval */ > WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > abo = gem_to_amdgpu_bo(fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r != 0)) > @@ -2472,11 +2472,11 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc) > int i; > > dce_v6_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); > - if (crtc->primary->fb) { > + if (crtc->primary->legacy.fb) { > int r; > struct amdgpu_bo *abo; > > - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); > + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r)) > DRM_ERROR("failed to reserve abo before unpin\n"); > diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c > index 77ac3f114d24..7a24d5835107 100644 > --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c > @@ -186,7 +186,7 @@ static void dce_v8_0_page_flip(struct amdgpu_device *adev, > int crtc_id, u64 crtc_base, bool async) > { > struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb; > + struct drm_framebuffer *fb = amdgpu_crtc->base.primary->legacy.fb; > > /* flip at hsync for async, default is vsync */ > WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ? > @@ -1808,7 +1808,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, > bool bypass_lut = false; > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -1816,7 +1816,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > /* If atomic, assume fb object is pinned & idle & fenced and > * just update base pointers > @@ -2001,7 +2001,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, > /* set pageflip to happen anywhere in vblank interval */ > WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > abo = gem_to_amdgpu_bo(fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r != 0)) > @@ -2476,11 +2476,11 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc) > int i; > > dce_v8_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); > - if (crtc->primary->fb) { > + if (crtc->primary->legacy.fb) { > int r; > struct amdgpu_bo *abo; > > - abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); > + abo = gem_to_amdgpu_bo(crtc->primary->legacy.fb->obj[0]); > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r)) > DRM_ERROR("failed to reserve abo before unpin\n"); > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 0fc99da93afe..4cfabc8d20e5 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -530,9 +530,9 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, > WARN_ON(!state->acquire_ctx); > > /* the legacy pointers should never be set */ > - WARN_ON(plane->fb); > - WARN_ON(plane->old_fb); > - WARN_ON(plane->crtc); > + WARN_ON(plane->legacy.fb); > + WARN_ON(plane->legacy.old_fb); > + WARN_ON(plane->legacy.crtc); > > plane_state = drm_atomic_get_existing_plane_state(state, plane); > if (plane_state) > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 3488ff067c69..db9e6253949f 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -544,8 +544,8 @@ int drm_mode_getcrtc(struct drm_device *dev, > drm_modeset_lock(&plane->mutex, NULL); > if (plane->state && plane->state->fb) > crtc_resp->fb_id = plane->state->fb->base.id; > - else if (!plane->state && plane->fb) > - crtc_resp->fb_id = plane->fb->base.id; > + else if (!plane->state && plane->legacy.fb) > + crtc_resp->fb_id = plane->legacy.fb->base.id; > else > crtc_resp->fb_id = 0; > > @@ -600,7 +600,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, > drm_for_each_crtc(tmp, crtc->dev) { > struct drm_plane *plane = tmp->primary; > > - plane->old_fb = plane->fb; > + plane->legacy.old_fb = plane->legacy.fb; > } > > fb = set->fb; > @@ -609,18 +609,18 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, > if (ret == 0) { > struct drm_plane *plane = crtc->primary; > > - plane->crtc = fb ? crtc : NULL; > - plane->fb = fb; > + plane->legacy.crtc = fb ? crtc : NULL; > + plane->legacy.fb = fb; > } > > drm_for_each_crtc(tmp, crtc->dev) { > struct drm_plane *plane = tmp->primary; > > - if (plane->fb) > - drm_framebuffer_get(plane->fb); > - if (plane->old_fb) > - drm_framebuffer_put(plane->old_fb); > - plane->old_fb = NULL; > + if (plane->legacy.fb) > + drm_framebuffer_get(plane->legacy.fb); > + if (plane->legacy.old_fb) > + drm_framebuffer_put(plane->legacy.old_fb); > + plane->legacy.old_fb = NULL; > } > > return ret; > @@ -739,7 +739,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, > if (plane->state) > old_fb = plane->state->fb; > else > - old_fb = plane->fb; > + old_fb = plane->legacy.fb; > > if (!old_fb) { > drm_dbg_kms(dev, "CRTC doesn't have current FB\n"); > diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c > index 0955f1c385dd..1df4a05f7a01 100644 > --- a/drivers/gpu/drm/drm_crtc_helper.c > +++ b/drivers/gpu/drm/drm_crtc_helper.c > @@ -204,7 +204,7 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev) > (*crtc_funcs->disable)(crtc); > else > (*crtc_funcs->dpms)(crtc, DRM_MODE_DPMS_OFF); > - crtc->primary->fb = NULL; > + crtc->primary->legacy.fb = NULL; > } > } > } > @@ -635,17 +635,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, > save_set.mode = &set->crtc->mode; > save_set.x = set->crtc->x; > save_set.y = set->crtc->y; > - save_set.fb = set->crtc->primary->fb; > + save_set.fb = set->crtc->primary->legacy.fb; > > /* We should be able to check here if the fb has the same properties > * and then just flip_or_move it */ > - if (set->crtc->primary->fb != set->fb) { > + if (set->crtc->primary->legacy.fb != set->fb) { > /* If we have no fb then treat it as a full mode set */ > - if (set->crtc->primary->fb == NULL) { > + if (set->crtc->primary->legacy.fb == NULL) { > drm_dbg_kms(dev, "[CRTC:%d:%s] no fb, full mode set\n", > set->crtc->base.id, set->crtc->name); > mode_changed = true; > - } else if (set->fb->format != set->crtc->primary->fb->format) { > + } else if (set->fb->format != set->crtc->primary->legacy.fb->format) { > mode_changed = true; > } else > fb_changed = true; > @@ -768,13 +768,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, > if (drm_helper_crtc_in_use(set->crtc)) { > drm_dbg_kms(dev, "[CRTC:%d:%s] attempting to set mode from userspace: " DRM_MODE_FMT "\n", > set->crtc->base.id, set->crtc->name, DRM_MODE_ARG(set->mode)); > - set->crtc->primary->fb = set->fb; > + set->crtc->primary->legacy.fb = set->fb; > if (!drm_crtc_helper_set_mode(set->crtc, set->mode, > set->x, set->y, > save_set.fb)) { > drm_err(dev, "[CRTC:%d:%s] failed to set mode\n", > set->crtc->base.id, set->crtc->name); > - set->crtc->primary->fb = save_set.fb; > + set->crtc->primary->legacy.fb = save_set.fb; > ret = -EINVAL; > goto fail; > } > @@ -790,13 +790,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, > } else if (fb_changed) { > set->crtc->x = set->x; > set->crtc->y = set->y; > - set->crtc->primary->fb = set->fb; > + set->crtc->primary->legacy.fb = set->fb; > ret = crtc_funcs->mode_set_base(set->crtc, > set->x, set->y, save_set.fb); > if (ret != 0) { > set->crtc->x = save_set.x; > set->crtc->y = save_set.y; > - set->crtc->primary->fb = save_set.fb; > + set->crtc->primary->legacy.fb = save_set.fb; > goto fail; > } > } > @@ -997,7 +997,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev) > continue; > > ret = drm_crtc_helper_set_mode(crtc, &crtc->mode, > - crtc->x, crtc->y, crtc->primary->fb); > + crtc->x, crtc->y, crtc->primary->legacy.fb); > > /* Restoring the old config should never fail! */ > if (ret == false) > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index d5e8994345bb..fd9d804e3672 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -189,7 +189,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info) > continue; > > funcs = crtc->helper_private; > - fb = crtc->primary->fb; > + fb = crtc->primary->legacy.fb; > > if (!crtc->enabled) > continue; > diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c > index 47e6e8577b62..ab7d4d4c0917 100644 > --- a/drivers/gpu/drm/drm_framebuffer.c > +++ b/drivers/gpu/drm/drm_framebuffer.c > @@ -1081,7 +1081,7 @@ static void legacy_remove_fb(struct drm_framebuffer *fb) > drm_modeset_lock_all(dev); > /* remove from any CRTC */ > drm_for_each_crtc(crtc, dev) { > - if (crtc->primary->fb == fb) { > + if (crtc->primary->legacy.fb == fb) { > drm_dbg_kms(dev, > "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n", > crtc->base.id, crtc->name, fb->base.id); > @@ -1093,7 +1093,7 @@ static void legacy_remove_fb(struct drm_framebuffer *fb) > } > > drm_for_each_plane(plane, dev) { > - if (plane->fb == fb) { > + if (plane->legacy.fb == fb) { > drm_dbg_kms(dev, > "Disabling [PLANE:%d:%s] because [FB:%d] is removed\n", > plane->base.id, plane->name, fb->base.id); > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c > index a28b22fdd7a4..4b077110238a 100644 > --- a/drivers/gpu/drm/drm_plane.c > +++ b/drivers/gpu/drm/drm_plane.c > @@ -723,23 +723,23 @@ void drm_plane_force_disable(struct drm_plane *plane) > { > int ret; > > - if (!plane->fb) > + if (!plane->legacy.fb) > return; > > WARN_ON(drm_drv_uses_atomic_modeset(plane->dev)); > > - plane->old_fb = plane->fb; > + plane->legacy.old_fb = plane->legacy.fb; > ret = plane->funcs->disable_plane(plane, NULL); > if (ret) { > DRM_ERROR("failed to disable plane with busy fb\n"); > - plane->old_fb = NULL; > + plane->legacy.old_fb = NULL; > return; > } > /* disconnect the plane from the fb and crtc: */ > - drm_framebuffer_put(plane->old_fb); > - plane->old_fb = NULL; > - plane->fb = NULL; > - plane->crtc = NULL; > + drm_framebuffer_put(plane->legacy.old_fb); > + plane->legacy.old_fb = NULL; > + plane->legacy.fb = NULL; > + plane->legacy.crtc = NULL; > } > EXPORT_SYMBOL(drm_plane_force_disable); > > @@ -840,15 +840,15 @@ int drm_mode_getplane(struct drm_device *dev, void *data, > drm_modeset_lock(&plane->mutex, NULL); > if (plane->state && plane->state->crtc && drm_lease_held(file_priv, plane->state->crtc->base.id)) > plane_resp->crtc_id = plane->state->crtc->base.id; > - else if (!plane->state && plane->crtc && drm_lease_held(file_priv, plane->crtc->base.id)) > - plane_resp->crtc_id = plane->crtc->base.id; > + else if (!plane->state && plane->legacy.crtc && drm_lease_held(file_priv, plane->legacy.crtc->base.id)) > + plane_resp->crtc_id = plane->legacy.crtc->base.id; > else > plane_resp->crtc_id = 0; > > if (plane->state && plane->state->fb) > plane_resp->fb_id = plane->state->fb->base.id; > - else if (!plane->state && plane->fb) > - plane_resp->fb_id = plane->fb->base.id; > + else if (!plane->state && plane->legacy.fb) > + plane_resp->fb_id = plane->legacy.fb->base.id; > else > plane_resp->fb_id = 0; > drm_modeset_unlock(&plane->mutex); > @@ -1004,13 +1004,13 @@ static int __setplane_internal(struct drm_plane *plane, > > /* No fb means shut it down */ > if (!fb) { > - plane->old_fb = plane->fb; > + plane->legacy.old_fb = plane->legacy.fb; > ret = plane->funcs->disable_plane(plane, ctx); > if (!ret) { > - plane->crtc = NULL; > - plane->fb = NULL; > + plane->legacy.crtc = NULL; > + plane->legacy.fb = NULL; > } else { > - plane->old_fb = NULL; > + plane->legacy.old_fb = NULL; > } > goto out; > } > @@ -1021,22 +1021,22 @@ static int __setplane_internal(struct drm_plane *plane, > if (ret) > goto out; > > - plane->old_fb = plane->fb; > + plane->legacy.old_fb = plane->legacy.fb; > ret = plane->funcs->update_plane(plane, crtc, fb, > crtc_x, crtc_y, crtc_w, crtc_h, > src_x, src_y, src_w, src_h, ctx); > if (!ret) { > - plane->crtc = crtc; > - plane->fb = fb; > - drm_framebuffer_get(plane->fb); > + plane->legacy.crtc = crtc; > + plane->legacy.fb = fb; > + drm_framebuffer_get(plane->legacy.fb); > } else { > - plane->old_fb = NULL; > + plane->legacy.old_fb = NULL; > } > > out: > - if (plane->old_fb) > - drm_framebuffer_put(plane->old_fb); > - plane->old_fb = NULL; > + if (plane->legacy.old_fb) > + drm_framebuffer_put(plane->legacy.old_fb); > + plane->legacy.old_fb = NULL; > > return ret; > } > @@ -1178,7 +1178,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, > int ret = 0; > > BUG_ON(!plane); > - WARN_ON(plane->crtc != crtc && plane->crtc != NULL); > + WARN_ON(plane->legacy.crtc != crtc && plane->legacy.crtc != NULL); > > /* > * Obtain fb we'll be using (either new or existing) and take an extra > @@ -1204,7 +1204,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, > if (plane->state) > fb = plane->state->fb; > else > - fb = plane->fb; > + fb = plane->legacy.fb; > > if (fb) > drm_framebuffer_get(fb); > @@ -1441,7 +1441,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, > if (plane->state) > old_fb = plane->state->fb; > else > - old_fb = plane->fb; > + old_fb = plane->legacy.fb; > > if (old_fb == NULL) { > /* The framebuffer is currently unbound, presumably > @@ -1506,7 +1506,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, > } > } > > - plane->old_fb = plane->fb; > + plane->legacy.old_fb = plane->legacy.fb; > if (crtc->funcs->page_flip_target) > ret = crtc->funcs->page_flip_target(crtc, fb, e, > page_flip->flags, > @@ -1519,10 +1519,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, > if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) > drm_event_cancel_free(dev, &e->base); > /* Keep the old fb, don't unref it. */ > - plane->old_fb = NULL; > + plane->legacy.old_fb = NULL; > } else { > if (!plane->state) { > - plane->fb = fb; > + plane->legacy.fb = fb; > drm_framebuffer_get(fb); > } > } > @@ -1531,9 +1531,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, > if (fb) > drm_framebuffer_put(fb); > fb = NULL; > - if (plane->old_fb) > - drm_framebuffer_put(plane->old_fb); > - plane->old_fb = NULL; > + if (plane->legacy.old_fb) > + drm_framebuffer_put(plane->legacy.old_fb); > + plane->legacy.old_fb = NULL; > > if (ret == -EDEADLK) { > ret = drm_modeset_backoff(&ctx); > diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c > index bbd0abdd8382..faef6f724446 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_display.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_display.c > @@ -462,7 +462,7 @@ static bool cdv_intel_pipe_enabled(struct drm_device *dev, int pipe) > crtc = dev_priv->pipe_to_crtc_mapping[pipe]; > gma_crtc = to_gma_crtc(crtc); > > - if (crtc->primary->fb == NULL || !gma_crtc->active) > + if (crtc->primary->legacy.fb == NULL || !gma_crtc->active) > return false; > return true; > } > diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c > index cc2ed9b3fd2d..49851881e41e 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c > @@ -1849,7 +1849,7 @@ cdv_intel_dp_set_property(struct drm_connector *connector, > struct drm_crtc *crtc = encoder->base.crtc; > drm_crtc_helper_set_mode(crtc, &crtc->mode, > crtc->x, crtc->y, > - crtc->primary->fb); > + crtc->primary->legacy.fb); > } > > return 0; > diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c > index 2d95e0471291..16968c94bfd3 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c > @@ -191,7 +191,8 @@ static int cdv_hdmi_set_property(struct drm_connector *connector, > crtc->saved_mode.vdisplay != 0) { > if (centre) { > if (!drm_crtc_helper_set_mode(encoder->crtc, &crtc->saved_mode, > - encoder->crtc->x, encoder->crtc->y, encoder->crtc->primary->fb)) > + encoder->crtc->x, encoder->crtc->y, > + encoder->crtc->primary->legacy.fb)) > return -1; > } else { > const struct drm_encoder_helper_funcs *helpers > diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c > index f3a4517bdf27..b607355b85dd 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c > @@ -375,7 +375,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector, > &crtc->saved_mode, > encoder->crtc->x, > encoder->crtc->y, > - encoder->crtc->primary->fb)) > + encoder->crtc->primary->legacy.fb)) > return -1; > } > } else if (!strcmp(property->name, "backlight") && encoder) { > diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c > index f65e90d890f4..f2f8a95c8d39 100644 > --- a/drivers/gpu/drm/gma500/gma_display.c > +++ b/drivers/gpu/drm/gma500/gma_display.c > @@ -61,7 +61,7 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y, > struct drm_device *dev = crtc->dev; > struct drm_psb_private *dev_priv = to_drm_psb_private(dev); > struct gma_crtc *gma_crtc = to_gma_crtc(crtc); > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct psb_gem_object *pobj; > int pipe = gma_crtc->pipe; > const struct psb_offset *map = &dev_priv->regmap[pipe]; > @@ -490,8 +490,8 @@ void gma_crtc_disable(struct drm_crtc *crtc) > > crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); > > - if (crtc->primary->fb) { > - pobj = to_psb_gem_object(crtc->primary->fb->obj[0]); > + if (crtc->primary->legacy.fb) { > + pobj = to_psb_gem_object(crtc->primary->legacy.fb->obj[0]); > psb_gem_unpin(pobj); > } > } > @@ -515,8 +515,8 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, > struct drm_modeset_acquire_ctx *ctx) > { > struct gma_crtc *gma_crtc = to_gma_crtc(crtc); > - struct drm_framebuffer *current_fb = crtc->primary->fb; > - struct drm_framebuffer *old_fb = crtc->primary->old_fb; > + struct drm_framebuffer *current_fb = crtc->primary->legacy.fb; > + struct drm_framebuffer *old_fb = crtc->primary->legacy.old_fb; > const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; > struct drm_device *dev = crtc->dev; > unsigned long flags; > @@ -526,7 +526,7 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, > return -EINVAL; > > /* Using mode_set_base requires the new fb to be set already. */ > - crtc->primary->fb = fb; > + crtc->primary->legacy.fb = fb; > > if (event) { > spin_lock_irqsave(&dev->event_lock, flags); > @@ -552,7 +552,7 @@ int gma_crtc_page_flip(struct drm_crtc *crtc, > > /* Restore previous fb in case of failure. */ > if (ret) > - crtc->primary->fb = current_fb; > + crtc->primary->legacy.fb = current_fb; > > return ret; > } > diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c > index de8ccfe9890f..2c23b86a1ace 100644 > --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c > +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c > @@ -595,7 +595,7 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc, > struct drm_device *dev = crtc->dev; > struct drm_psb_private *dev_priv = to_drm_psb_private(dev); > struct gma_crtc *gma_crtc = to_gma_crtc(crtc); > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > int pipe = gma_crtc->pipe; > const struct psb_offset *map = &dev_priv->regmap[pipe]; > unsigned long start, offset; > diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c > index ff46e88c4768..03da68427318 100644 > --- a/drivers/gpu/drm/gma500/psb_intel_display.c > +++ b/drivers/gpu/drm/gma500/psb_intel_display.c > @@ -112,7 +112,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc, > const struct gma_limit_t *limit; > > /* No scan out no play */ > - if (crtc->primary->fb == NULL) { > + if (crtc->primary->legacy.fb == NULL) { > crtc_funcs->mode_set_base(crtc, x, y, old_fb); > return 0; > } > diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c > index 138f153d38ba..1e80bc865843 100644 > --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c > +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c > @@ -570,7 +570,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector, > &crtc->saved_mode, > encoder->crtc->x, > encoder->crtc->y, > - encoder->crtc->primary->fb)) > + encoder->crtc->primary->legacy.fb)) > goto set_prop_error; > } > } else if (!strcmp(property->name, "backlight")) { > diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c > index 8dafff963ca8..9fab87f17dc9 100644 > --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c > +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c > @@ -1727,7 +1727,7 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, > if (psb_intel_sdvo->base.base.crtc) { > struct drm_crtc *crtc = psb_intel_sdvo->base.base.crtc; > drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x, > - crtc->y, crtc->primary->fb); > + crtc->y, crtc->primary->legacy.fb); > } > > return 0; > diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c > index 131512a5f3bd..058cb389b8ec 100644 > --- a/drivers/gpu/drm/i2c/ch7006_drv.c > +++ b/drivers/gpu/drm/i2c/ch7006_drv.c > @@ -364,7 +364,7 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, > if (crtc) > drm_crtc_helper_set_mode(crtc, &crtc->mode, > crtc->x, crtc->y, > - crtc->primary->fb); > + crtc->primary->legacy.fb); > } > > return 0; > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > index 9bcae53c4f45..9bd800a42253 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > @@ -122,11 +122,11 @@ static void _dpu_plane_set_danger_state(struct dpu_kms *kms, bool enable) > struct drm_plane *plane; > > drm_for_each_plane(plane, kms->dev) { > - if (plane->fb && plane->state) { > + if (plane->legacy.fb && plane->state) { > dpu_plane_danger_signal_ctrl(plane, enable); > DPU_DEBUG("plane:%d img:%dx%d ", > - plane->base.id, plane->fb->width, > - plane->fb->height); > + plane->base.id, plane->legacy.fb->width, > + plane->legacy.fb->height); > DPU_DEBUG("src[%d,%d,%d,%d] dst[%d,%d,%d,%d]\n", > plane->state->src_x >> 16, > plane->state->src_y >> 16, > diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c > index 67146f1e8482..4cbc3976b180 100644 > --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c > +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c > @@ -239,7 +239,7 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) > struct drm_device *dev = crtc->dev; > struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); > struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index]; > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > > /* Calculate our timings */ > int horizDisplay = (mode->crtc_hdisplay >> 3) - 1; > @@ -465,7 +465,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode) > struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); > struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index]; > struct nv04_crtc_reg *savep = &nv04_display(dev)->saved_reg.crtc_reg[nv_crtc->index]; > - const struct drm_framebuffer *fb = crtc->primary->fb; > + const struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct drm_encoder *encoder; > bool lvds_output = false, tmds_output = false, tv_output = false, > off_chip_digital = false; > @@ -610,7 +610,7 @@ static int > nv_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb) > { > struct nv04_display *disp = nv04_display(crtc->dev); > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct nouveau_bo *nvbo = nouveau_gem_object(fb->obj[0]); > struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); > int ret; > @@ -826,7 +826,7 @@ nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, > * mark the lut values as dirty by setting depth==0, and it'll be > * uploaded on the first mode_set_base() > */ > - if (!nv_crtc->base.primary->fb) { > + if (!nv_crtc->base.primary->legacy.fb) { > nv_crtc->lut.depth = 0; > return 0; > } > @@ -852,7 +852,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, > NV_DEBUG(drm, "index %d\n", nv_crtc->index); > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > NV_DEBUG(drm, "No FB bound\n"); > return 0; > } > @@ -863,7 +863,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, > if (atomic) { > drm_fb = passed_fb; > } else { > - drm_fb = crtc->primary->fb; > + drm_fb = crtc->primary->legacy.fb; > } > > nvbo = nouveau_gem_object(drm_fb->obj[0]); > @@ -1157,7 +1157,7 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, > const int swap_interval = (flags & DRM_MODE_PAGE_FLIP_ASYNC) ? 0 : 1; > struct drm_device *dev = crtc->dev; > struct nouveau_drm *drm = nouveau_drm(dev); > - struct drm_framebuffer *old_fb = crtc->primary->fb; > + struct drm_framebuffer *old_fb = crtc->primary->legacy.fb; > struct nouveau_bo *old_bo = nouveau_gem_object(old_fb->obj[0]); > struct nouveau_bo *new_bo = nouveau_gem_object(fb->obj[0]); > struct nv04_page_flip_state *s; > @@ -1237,7 +1237,7 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, > mutex_unlock(&cli->mutex); > > /* Update the crtc struct and cleanup */ > - crtc->primary->fb = fb; > + crtc->primary->legacy.fb = fb; > > nouveau_bo_fence(old_bo, fence, false); > ttm_bo_unreserve(&old_bo->bo); > diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouveau/dispnv04/dfp.c > index 504c421aa176..be49c7180622 100644 > --- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c > +++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c > @@ -291,7 +291,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder, > struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); > struct drm_display_mode *output_mode = &nv_encoder->mode; > struct drm_connector *connector = &nv_connector->base; > - const struct drm_framebuffer *fb = encoder->crtc->primary->fb; > + const struct drm_framebuffer *fb = encoder->crtc->primary->legacy.fb; > uint32_t mode_ratio, panel_ratio; > > NV_DEBUG(drm, "Output mode on CRTC %d:\n", nv_crtc->index); > diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c > index f71199a39bc4..45097913794c 100644 > --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c > +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c > @@ -76,7 +76,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool suspend) > > /* Un-pin FB and cursors so they'll be evicted to system memory. */ > list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct nouveau_bo *nvbo; > > if (!fb || !fb->obj[0]) > @@ -128,7 +128,7 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime) > > /* Re-pin FB/cursors. */ > list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct nouveau_bo *nvbo; > > if (!fb || !fb->obj[0]) > diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c > index 3ecb101d23e9..4bc8039e6ee0 100644 > --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c > +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c > @@ -756,7 +756,7 @@ static int nv17_tv_set_property(struct drm_encoder *encoder, > if (crtc) > drm_crtc_helper_set_mode(crtc, &crtc->mode, > crtc->x, crtc->y, > - crtc->primary->fb); > + crtc->primary->legacy.fb); > } > > return 0; > diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c > index 9b3a3a9d60e2..36e4663186c8 100644 > --- a/drivers/gpu/drm/radeon/atombios_crtc.c > +++ b/drivers/gpu/drm/radeon/atombios_crtc.c > @@ -1150,7 +1150,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, > bool bypass_lut = false; > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -1158,7 +1158,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > /* If atomic, assume fb object is pinned & idle & fenced and > * just update base pointers > @@ -1437,7 +1437,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, > /* set pageflip to happen anywhere in vblank interval */ > WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > rbo = gem_to_radeon_bo(fb->obj[0]); > r = radeon_bo_reserve(rbo, false); > if (unlikely(r != 0)) > @@ -1470,7 +1470,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, > bool bypass_lut = false; > > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -1478,7 +1478,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > obj = target_fb->obj[0]; > rbo = gem_to_radeon_bo(obj); > @@ -1645,7 +1645,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, > /* set pageflip to happen only at start of vblank interval (front porch) */ > WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > rbo = gem_to_radeon_bo(fb->obj[0]); > r = radeon_bo_reserve(rbo, false); > if (unlikely(r != 0)) > @@ -2150,11 +2150,11 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) > int i; > > atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); > - if (crtc->primary->fb) { > + if (crtc->primary->legacy.fb) { > int r; > struct radeon_bo *rbo; > > - rbo = gem_to_radeon_bo(crtc->primary->fb->obj[0]); > + rbo = gem_to_radeon_bo(crtc->primary->legacy.fb->obj[0]); > r = radeon_bo_reserve(rbo, false); > if (unlikely(r)) > DRM_ERROR("failed to reserve rbo before unpin\n"); > diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c > index bc4ab71613a5..2cbcf7cfdc3c 100644 > --- a/drivers/gpu/drm/radeon/evergreen.c > +++ b/drivers/gpu/drm/radeon/evergreen.c > @@ -1417,7 +1417,7 @@ void evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, > bool async) > { > struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; > + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; > > /* flip at hsync for async, default is vsync */ > WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, > diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c > index 80703417d8a1..1aa3126ab6d9 100644 > --- a/drivers/gpu/drm/radeon/r100.c > +++ b/drivers/gpu/drm/radeon/r100.c > @@ -165,7 +165,7 @@ void r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool > { > struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; > uint32_t crtc_pitch, pitch_pixels; > - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; > + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; > u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; > int i; > > @@ -3244,7 +3244,7 @@ void r100_bandwidth_update(struct radeon_device *rdev) > > if (rdev->mode_info.crtcs[0]->base.enabled) { > const struct drm_framebuffer *fb = > - rdev->mode_info.crtcs[0]->base.primary->fb; > + rdev->mode_info.crtcs[0]->base.primary->legacy.fb; > > mode1 = &rdev->mode_info.crtcs[0]->base.mode; > pixel_bytes1 = fb->format->cpp[0]; > @@ -3252,7 +3252,7 @@ void r100_bandwidth_update(struct radeon_device *rdev) > if (!(rdev->flags & RADEON_SINGLE_CRTC)) { > if (rdev->mode_info.crtcs[1]->base.enabled) { > const struct drm_framebuffer *fb = > - rdev->mode_info.crtcs[1]->base.primary->fb; > + rdev->mode_info.crtcs[1]->base.primary->legacy.fb; > > mode2 = &rdev->mode_info.crtcs[1]->base.mode; > pixel_bytes2 = fb->format->cpp[0]; > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c > index 528a8f3677c2..dbe0f75cfea7 100644 > --- a/drivers/gpu/drm/radeon/radeon_connectors.c > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c > @@ -92,7 +92,8 @@ static void radeon_property_change_mode(struct drm_encoder *encoder) > > if (crtc && crtc->enabled) { > drm_crtc_helper_set_mode(crtc, &crtc->mode, > - crtc->x, crtc->y, crtc->primary->fb); > + crtc->x, crtc->y, > + crtc->primary->legacy.fb); > } > } > > diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c > index 554b236c2328..edea6d3638e5 100644 > --- a/drivers/gpu/drm/radeon/radeon_device.c > +++ b/drivers/gpu/drm/radeon/radeon_device.c > @@ -1572,7 +1572,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, > /* unpin the front buffers and cursors */ > list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { > struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); > - struct drm_framebuffer *fb = crtc->primary->fb; > + struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct radeon_bo *robj; > > if (radeon_crtc->cursor_bo) { > diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c > index 8f5f8abcb1b4..55f80424f514 100644 > --- a/drivers/gpu/drm/radeon/radeon_display.c > +++ b/drivers/gpu/drm/radeon/radeon_display.c > @@ -506,7 +506,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc, > work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; > > /* schedule unpin of the old buffer */ > - obj = crtc->primary->fb->obj[0]; > + obj = crtc->primary->legacy.fb->obj[0]; > > /* take a reference to the old object */ > drm_gem_object_get(obj); > @@ -595,7 +595,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc, > radeon_crtc->flip_work = work; > > /* update crtc fb */ > - crtc->primary->fb = fb; > + crtc->primary->legacy.fb = fb; > > spin_unlock_irqrestore(&crtc->dev->event_lock, flags); > > diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c > index 825b351ff53c..6b37b301ea1f 100644 > --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c > +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c > @@ -390,7 +390,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, > > DRM_DEBUG_KMS("\n"); > /* no fb bound */ > - if (!atomic && !crtc->primary->fb) { > + if (!atomic && !crtc->primary->legacy.fb) { > DRM_DEBUG_KMS("No FB bound\n"); > return 0; > } > @@ -398,7 +398,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, > if (atomic) > target_fb = fb; > else > - target_fb = crtc->primary->fb; > + target_fb = crtc->primary->legacy.fb; > > switch (target_fb->format->cpp[0] * 8) { > case 8: > @@ -445,7 +445,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, > * We don't shutdown the display controller because new buffer > * will end up in same spot. > */ > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > struct radeon_bo *old_rbo; > unsigned long nsize, osize; > > @@ -555,7 +555,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, > WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, crtc_offset); > WREG32(RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch); > > - if (!atomic && fb && fb != crtc->primary->fb) { > + if (!atomic && fb && fb != crtc->primary->legacy.fb) { > rbo = gem_to_radeon_bo(fb->obj[0]); > r = radeon_bo_reserve(rbo, false); > if (unlikely(r != 0)) > @@ -575,7 +575,7 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod > struct drm_device *dev = crtc->dev; > struct radeon_device *rdev = dev->dev_private; > struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); > - const struct drm_framebuffer *fb = crtc->primary->fb; > + const struct drm_framebuffer *fb = crtc->primary->legacy.fb; > struct drm_encoder *encoder; > int format; > int hsync_start; > @@ -1088,11 +1088,11 @@ static void radeon_crtc_commit(struct drm_crtc *crtc) > static void radeon_crtc_disable(struct drm_crtc *crtc) > { > radeon_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); > - if (crtc->primary->fb) { > + if (crtc->primary->legacy.fb) { > int r; > struct radeon_bo *rbo; > > - rbo = gem_to_radeon_bo(crtc->primary->fb->obj[0]); > + rbo = gem_to_radeon_bo(crtc->primary->legacy.fb->obj[0]); > r = radeon_bo_reserve(rbo, false); > if (unlikely(r)) > DRM_ERROR("failed to reserve rbo before unpin\n"); > diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c > index 88c8e91ea651..335df822b330 100644 > --- a/drivers/gpu/drm/radeon/rs600.c > +++ b/drivers/gpu/drm/radeon/rs600.c > @@ -119,7 +119,7 @@ void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc) > void rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async) > { > struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; > + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; > u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); > int i; > > diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c > index 7d4b0bf59109..4f3f19500adf 100644 > --- a/drivers/gpu/drm/radeon/rv770.c > +++ b/drivers/gpu/drm/radeon/rv770.c > @@ -800,7 +800,7 @@ u32 rv770_get_xclk(struct radeon_device *rdev) > void rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async) > { > struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; > - struct drm_framebuffer *fb = radeon_crtc->base.primary->fb; > + struct drm_framebuffer *fb = radeon_crtc->base.primary->legacy.fb; > u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); > int i; > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index f161f40d8ce4..14fce5c33e03 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -1097,7 +1097,7 @@ static int vop_plane_atomic_async_check(struct drm_plane *plane, > crtc_state = drm_atomic_get_existing_crtc_state(state, > new_plane_state->crtc); > else /* Special case for asynchronous cursor updates. */ > - crtc_state = plane->crtc->state; > + crtc_state = plane->legacy.crtc->state; > > return drm_atomic_helper_check_plane_state(plane->state, crtc_state, > min_scale, max_scale, > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > index dd718c62ac31..a2d91ee4b40c 100644 > --- a/include/drm/drm_plane.h > +++ b/include/drm/drm_plane.h > @@ -663,31 +663,33 @@ struct drm_plane { > /** @modifier_count: Size of the array pointed at by @modifier_count. */ > unsigned int modifier_count; > > - /** > - * @crtc: > - * > - * Currently bound CRTC, only meaningful for non-atomic drivers. For > - * atomic drivers this is forced to be NULL, atomic drivers should > - * instead check &drm_plane_state.crtc. > - */ > - struct drm_crtc *crtc; > - > - /** > - * @fb: > - * > - * Currently bound framebuffer, only meaningful for non-atomic drivers. > - * For atomic drivers this is forced to be NULL, atomic drivers should > - * instead check &drm_plane_state.fb. > - */ > - struct drm_framebuffer *fb; > - > - /** > - * @old_fb: > - * > - * Temporary tracking of the old fb while a modeset is ongoing. Only > - * used by non-atomic drivers, forced to be NULL for atomic drivers. > - */ > - struct drm_framebuffer *old_fb; > + struct { > + /** > + * @crtc: > + * > + * Currently bound CRTC, only meaningful for non-atomic drivers. For > + * atomic drivers this is forced to be NULL, atomic drivers should > + * instead check &drm_plane_state.crtc. > + */ > + struct drm_crtc *crtc; > + > + /** > + * @fb: > + * > + * Currently bound framebuffer, only meaningful for non-atomic drivers. > + * For atomic drivers this is forced to be NULL, atomic drivers should > + * instead check &drm_plane_state.fb. > + */ > + struct drm_framebuffer *fb; > + > + /** > + * @old_fb: > + * > + * Temporary tracking of the old fb while a modeset is ongoing. Only > + * used by non-atomic drivers, forced to be NULL for atomic drivers. > + */ > + struct drm_framebuffer *old_fb; > + } legacy; > > /** @funcs: plane control functions */ > const struct drm_plane_funcs *funcs; > -- > 2.45.2 -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure 2024-10-03 11:12 ` Ville Syrjälä @ 2024-10-25 9:57 ` Jani Nikula 2024-10-25 10:15 ` Ville Syrjälä 0 siblings, 1 reply; 13+ messages in thread From: Jani Nikula @ 2024-10-25 9:57 UTC (permalink / raw) To: Ville Syrjälä, dri-devel Cc: intel-gfx, Alex Deucher, Christian König, Xinhui Pan, Patrik Jakobsson, Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten, Karol Herbst, Lyude Paul, Danilo Krummrich, Sandy Huang, Heiko Stübner, Andy Yan, amd-gfx, linux-arm-msm, freedreno, nouveau On Thu, 03 Oct 2024, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > On Wed, Oct 02, 2024 at 09:21:59PM +0300, Ville Syrjala wrote: >> From: Ville Syrjälä <ville.syrjala@linux.intel.com> >> >> Hide the plane->fb/etc. footguns better by stashing them inside >> a "legacy" sub struct. >> >> Eventually maybe we could turn 'legacy' into a pointer >> that only exists on legacy drivers to completely prevent >> any abuse by atomic drivers... > > Hmm. I should probably make it a pointer from the start, > to avoid having to go through the same churn yet again. [snip] >> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h >> index dd718c62ac31..a2d91ee4b40c 100644 >> --- a/include/drm/drm_plane.h >> +++ b/include/drm/drm_plane.h >> @@ -663,31 +663,33 @@ struct drm_plane { >> /** @modifier_count: Size of the array pointed at by @modifier_count. */ >> unsigned int modifier_count; >> >> - /** >> - * @crtc: >> - * >> - * Currently bound CRTC, only meaningful for non-atomic drivers. For >> - * atomic drivers this is forced to be NULL, atomic drivers should >> - * instead check &drm_plane_state.crtc. >> - */ >> - struct drm_crtc *crtc; >> - >> - /** >> - * @fb: >> - * >> - * Currently bound framebuffer, only meaningful for non-atomic drivers. >> - * For atomic drivers this is forced to be NULL, atomic drivers should >> - * instead check &drm_plane_state.fb. >> - */ >> - struct drm_framebuffer *fb; >> - >> - /** >> - * @old_fb: >> - * >> - * Temporary tracking of the old fb while a modeset is ongoing. Only >> - * used by non-atomic drivers, forced to be NULL for atomic drivers. >> - */ >> - struct drm_framebuffer *old_fb; >> + struct { Do you mean something along the lines of: struct __plane_legacy_or_something { >> + /** >> + * @crtc: >> + * >> + * Currently bound CRTC, only meaningful for non-atomic drivers. For >> + * atomic drivers this is forced to be NULL, atomic drivers should >> + * instead check &drm_plane_state.crtc. >> + */ >> + struct drm_crtc *crtc; >> + >> + /** >> + * @fb: >> + * >> + * Currently bound framebuffer, only meaningful for non-atomic drivers. >> + * For atomic drivers this is forced to be NULL, atomic drivers should >> + * instead check &drm_plane_state.fb. >> + */ >> + struct drm_framebuffer *fb; >> + >> + /** >> + * @old_fb: >> + * >> + * Temporary tracking of the old fb while a modeset is ongoing. Only >> + * used by non-atomic drivers, forced to be NULL for atomic drivers. >> + */ >> + struct drm_framebuffer *old_fb; >> + } legacy; and } __legacy; struct __plane_legacy_or_something *legacy; and initially unconditionally: p->legacy = &p->__legacy; but later, once atomic drivers have been fixed: if (!drm_core_check_feature(dev, DRIVER_COMPUTE_ATOMIC)) p->legacy = &p->__legacy; It would make the last update really simple. BR, Jani. >> >> /** @funcs: plane control functions */ >> const struct drm_plane_funcs *funcs; >> -- >> 2.45.2 -- Jani Nikula, Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure 2024-10-25 9:57 ` Jani Nikula @ 2024-10-25 10:15 ` Ville Syrjälä 0 siblings, 0 replies; 13+ messages in thread From: Ville Syrjälä @ 2024-10-25 10:15 UTC (permalink / raw) To: Jani Nikula Cc: dri-devel, intel-gfx, Alex Deucher, Christian König, Xinhui Pan, Patrik Jakobsson, Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten, Karol Herbst, Lyude Paul, Danilo Krummrich, Sandy Huang, Heiko Stübner, Andy Yan, amd-gfx, linux-arm-msm, freedreno, nouveau On Fri, Oct 25, 2024 at 12:57:50PM +0300, Jani Nikula wrote: > On Thu, 03 Oct 2024, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Wed, Oct 02, 2024 at 09:21:59PM +0300, Ville Syrjala wrote: > >> From: Ville Syrjälä <ville.syrjala@linux.intel.com> > >> > >> Hide the plane->fb/etc. footguns better by stashing them inside > >> a "legacy" sub struct. > >> > >> Eventually maybe we could turn 'legacy' into a pointer > >> that only exists on legacy drivers to completely prevent > >> any abuse by atomic drivers... > > > > Hmm. I should probably make it a pointer from the start, > > to avoid having to go through the same churn yet again. > > [snip] > > >> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > >> index dd718c62ac31..a2d91ee4b40c 100644 > >> --- a/include/drm/drm_plane.h > >> +++ b/include/drm/drm_plane.h > >> @@ -663,31 +663,33 @@ struct drm_plane { > >> /** @modifier_count: Size of the array pointed at by @modifier_count. */ > >> unsigned int modifier_count; > >> > >> - /** > >> - * @crtc: > >> - * > >> - * Currently bound CRTC, only meaningful for non-atomic drivers. For > >> - * atomic drivers this is forced to be NULL, atomic drivers should > >> - * instead check &drm_plane_state.crtc. > >> - */ > >> - struct drm_crtc *crtc; > >> - > >> - /** > >> - * @fb: > >> - * > >> - * Currently bound framebuffer, only meaningful for non-atomic drivers. > >> - * For atomic drivers this is forced to be NULL, atomic drivers should > >> - * instead check &drm_plane_state.fb. > >> - */ > >> - struct drm_framebuffer *fb; > >> - > >> - /** > >> - * @old_fb: > >> - * > >> - * Temporary tracking of the old fb while a modeset is ongoing. Only > >> - * used by non-atomic drivers, forced to be NULL for atomic drivers. > >> - */ > >> - struct drm_framebuffer *old_fb; > >> + struct { > > Do you mean something along the lines of: > > struct __plane_legacy_or_something { > > >> + /** > >> + * @crtc: > >> + * > >> + * Currently bound CRTC, only meaningful for non-atomic drivers. For > >> + * atomic drivers this is forced to be NULL, atomic drivers should > >> + * instead check &drm_plane_state.crtc. > >> + */ > >> + struct drm_crtc *crtc; > >> + > >> + /** > >> + * @fb: > >> + * > >> + * Currently bound framebuffer, only meaningful for non-atomic drivers. > >> + * For atomic drivers this is forced to be NULL, atomic drivers should > >> + * instead check &drm_plane_state.fb. > >> + */ > >> + struct drm_framebuffer *fb; > >> + > >> + /** > >> + * @old_fb: > >> + * > >> + * Temporary tracking of the old fb while a modeset is ongoing. Only > >> + * used by non-atomic drivers, forced to be NULL for atomic drivers. > >> + */ > >> + struct drm_framebuffer *old_fb; > >> + } legacy; > > and > > } __legacy; > > struct __plane_legacy_or_something *legacy; > > and initially unconditionally: > > p->legacy = &p->__legacy; > > but later, once atomic drivers have been fixed: > > if (!drm_core_check_feature(dev, DRIVER_COMPUTE_ATOMIC)) > p->legacy = &p->__legacy; > > It would make the last update really simple. Yeah, something like that. -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <20241002182200.15363-3-ville.syrjala@linux.intel.com>]
* Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure [not found] ` <20241002182200.15363-3-ville.syrjala@linux.intel.com> @ 2024-10-03 12:38 ` Louis Chauvet 2024-10-03 13:46 ` Ville Syrjälä 0 siblings, 1 reply; 13+ messages in thread From: Louis Chauvet @ 2024-10-03 12:38 UTC (permalink / raw) To: Ville Syrjala Cc: dri-devel, intel-gfx, Liviu Dudau, Russell King, Inki Dae, Patrik Jakobsson, Alain Volmat, Sandy Huang, Jyri Sarha, Alexey Brodkin, Hans de Goede, Maíra Canal, Zack Rusin, amd-gfx, linux-mediatek, linux-amlogic, linux-arm-msm, freedreno, nouveau, virtualization, spice-devel, linux-renesas-soc, xen-devel Le 02/10/24 - 21:22, Ville Syrjala a écrit : > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Atomic drivers shouldn't be using the legacy state stored > directly under drm_crtc. Move that junk into a 'legacy' sub > structure to highlight the offenders, of which there are > quite a few unfortunately. Hi, Do we need to do something particular in an atomic driver except using state content? I proposed some modifications for VKMS bellow. If you think this is good, I can send a patch to avoid being an offender :-) I just tested it, and it seems to work. > I'm hoping we could get all these fixed and then declare > the legacy state off limits for atomic drivers (which is > what did long ago for plane->fb/etc). And maybe eventually > turn crtc->legacy into a pointer and only allocate it on > legacy drivers. > > TODO: hwmode should probably go there too but it probably > needs a closer look, maybe other stuff too... [...] > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c > index 57a5769fc994..a7f8b1da6e85 100644 > --- a/drivers/gpu/drm/vkms/vkms_composer.c > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > @@ -187,7 +187,7 @@ static void blend(struct vkms_writeback_job *wb, > > const struct pixel_argb_u16 background_color = { .a = 0xffff }; > > - size_t crtc_y_limit = crtc_state->base.crtc->mode.vdisplay; > + size_t crtc_y_limit = crtc_state->base.crtc->legacy.mode.vdisplay; size_t crtc_y_limit = crtc_state->base.mode.vdisplay; > /* > * The planes are composed line-by-line to avoid heavy memory usage. It is a necessary > @@ -270,7 +270,7 @@ static int compose_active_planes(struct vkms_writeback_job *active_wb, > if (WARN_ON(check_format_funcs(crtc_state, active_wb))) > return -EINVAL; > > - line_width = crtc_state->base.crtc->mode.hdisplay; > + line_width = crtc_state->base.crtc->legacy.mode.hdisplay; line_width = crtc_state->base.mode.hdisplay; > stage_buffer.n_pixels = line_width; > output_buffer.n_pixels = line_width; > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c > index a40295c18b48..780681ea77e4 100644 > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *crtc) > struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); > struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > - drm_calc_timestamping_constants(crtc, &crtc->mode); > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode); drm_calc_timestamping_constants(crtc, &crtc->state->mode); > hrtimer_init(&out->vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); > out->vblank_hrtimer.function = &vkms_vblank_simulate; > diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c > index bc724cbd5e3a..27164cddb94d 100644 > --- a/drivers/gpu/drm/vkms/vkms_writeback.c > +++ b/drivers/gpu/drm/vkms/vkms_writeback.c > @@ -131,8 +131,8 @@ static void vkms_wb_atomic_commit(struct drm_connector *conn, > struct drm_connector_state *conn_state = wb_conn->base.state; > struct vkms_crtc_state *crtc_state = output->composer_state; > struct drm_framebuffer *fb = connector_state->writeback_job->fb; > - u16 crtc_height = crtc_state->base.crtc->mode.vdisplay; > - u16 crtc_width = crtc_state->base.crtc->mode.hdisplay; > + u16 crtc_height = crtc_state->base.crtc->legacy.mode.vdisplay; > + u16 crtc_width = crtc_state->base.crtc->legacy.mode.hdisplay; u16 crtc_height = crtc_state->base.mode.vdisplay; u16 crtc_width = crtc_state->base.mode.hdisplay; > struct vkms_writeback_job *active_wb; > struct vkms_frame_info *wb_frame_info; > u32 wb_format = fb->format->format; [...] -- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure 2024-10-03 12:38 ` [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} " Louis Chauvet @ 2024-10-03 13:46 ` Ville Syrjälä 2024-10-03 15:07 ` Louis Chauvet 0 siblings, 1 reply; 13+ messages in thread From: Ville Syrjälä @ 2024-10-03 13:46 UTC (permalink / raw) To: dri-devel, intel-gfx, Liviu Dudau, Russell King, Inki Dae, Patrik Jakobsson, Alain Volmat, Sandy Huang, Jyri Sarha, Alexey Brodkin, Hans de Goede, Maíra Canal, Zack Rusin, amd-gfx, linux-mediatek, linux-amlogic, linux-arm-msm, freedreno, nouveau, virtualization, spice-devel, linux-renesas-soc, xen-devel On Thu, Oct 03, 2024 at 02:38:35PM +0200, Louis Chauvet wrote: > Le 02/10/24 - 21:22, Ville Syrjala a écrit : > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Atomic drivers shouldn't be using the legacy state stored > > directly under drm_crtc. Move that junk into a 'legacy' sub > > structure to highlight the offenders, of which there are > > quite a few unfortunately. > > Hi, > > Do we need to do something particular in an atomic driver except using > state content? > > I proposed some modifications for VKMS bellow. If you think this is good, > I can send a patch to avoid being an offender :-) I just tested it, and it > seems to work. > > > I'm hoping we could get all these fixed and then declare > > the legacy state off limits for atomic drivers (which is > > what did long ago for plane->fb/etc). And maybe eventually > > turn crtc->legacy into a pointer and only allocate it on > > legacy drivers. > > > > TODO: hwmode should probably go there too but it probably > > needs a closer look, maybe other stuff too... > > [...] > > > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c > > index 57a5769fc994..a7f8b1da6e85 100644 > > --- a/drivers/gpu/drm/vkms/vkms_composer.c > > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > > @@ -187,7 +187,7 @@ static void blend(struct vkms_writeback_job *wb, > > > > const struct pixel_argb_u16 background_color = { .a = 0xffff }; > > > > - size_t crtc_y_limit = crtc_state->base.crtc->mode.vdisplay; > > + size_t crtc_y_limit = crtc_state->base.crtc->legacy.mode.vdisplay; > > size_t crtc_y_limit = crtc_state->base.mode.vdisplay; > > > /* > > * The planes are composed line-by-line to avoid heavy memory usage. It is a necessary > > @@ -270,7 +270,7 @@ static int compose_active_planes(struct vkms_writeback_job *active_wb, > > if (WARN_ON(check_format_funcs(crtc_state, active_wb))) > > return -EINVAL; > > > > - line_width = crtc_state->base.crtc->mode.hdisplay; > > + line_width = crtc_state->base.crtc->legacy.mode.hdisplay; > > line_width = crtc_state->base.mode.hdisplay; > > > stage_buffer.n_pixels = line_width; > > output_buffer.n_pixels = line_width; > > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c > > index a40295c18b48..780681ea77e4 100644 > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *crtc) > > struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); > > struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > > > - drm_calc_timestamping_constants(crtc, &crtc->mode); > > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode); > > drm_calc_timestamping_constants(crtc, &crtc->state->mode); This one doesn't look safe. You want to call that during your atomic commit already. The rest look reasonable. > > > hrtimer_init(&out->vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); > > out->vblank_hrtimer.function = &vkms_vblank_simulate; > > diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c > > index bc724cbd5e3a..27164cddb94d 100644 > > --- a/drivers/gpu/drm/vkms/vkms_writeback.c > > +++ b/drivers/gpu/drm/vkms/vkms_writeback.c > > @@ -131,8 +131,8 @@ static void vkms_wb_atomic_commit(struct drm_connector *conn, > > struct drm_connector_state *conn_state = wb_conn->base.state; > > struct vkms_crtc_state *crtc_state = output->composer_state; > > struct drm_framebuffer *fb = connector_state->writeback_job->fb; > > - u16 crtc_height = crtc_state->base.crtc->mode.vdisplay; > > - u16 crtc_width = crtc_state->base.crtc->mode.hdisplay; > > + u16 crtc_height = crtc_state->base.crtc->legacy.mode.vdisplay; > > + u16 crtc_width = crtc_state->base.crtc->legacy.mode.hdisplay; > > u16 crtc_height = crtc_state->base.mode.vdisplay; > u16 crtc_width = crtc_state->base.mode.hdisplay; > > > struct vkms_writeback_job *active_wb; > > struct vkms_frame_info *wb_frame_info; > > u32 wb_format = fb->format->format; > > [...] > > -- > Louis Chauvet, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure 2024-10-03 13:46 ` Ville Syrjälä @ 2024-10-03 15:07 ` Louis Chauvet 2024-10-03 15:29 ` Ville Syrjälä 0 siblings, 1 reply; 13+ messages in thread From: Louis Chauvet @ 2024-10-03 15:07 UTC (permalink / raw) To: Ville Syrjälä Cc: dri-devel, intel-gfx, Liviu Dudau, Russell King, Inki Dae, Patrik Jakobsson, Alain Volmat, Sandy Huang, Jyri Sarha, Alexey Brodkin, Hans de Goede, Maíra Canal, Zack Rusin, amd-gfx, linux-mediatek, linux-amlogic, linux-arm-msm, freedreno, nouveau, virtualization, spice-devel, linux-renesas-soc, xen-devel > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c > > > index a40295c18b48..780681ea77e4 100644 > > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *crtc) > > > struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); > > > struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > > > > > - drm_calc_timestamping_constants(crtc, &crtc->mode); > > > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode); > > > > drm_calc_timestamping_constants(crtc, &crtc->state->mode); > > This one doesn't look safe. You want to call that during your atomic > commit already. > This was already not safe with the previous implementation? Or it is only unsafe because now I use state->mode instead of legacy.mode? After inspecting the code, I think I don't need to call it as: In `vkms_atomic_commit_tail` (used in `@vkms_mode_config_helpers.atomic_commit_tail`), we call `drm_atomic_helper_commit_modeset_disables`, which call `drm_atomic_helper_calc_timestamping_constants` which call `drm_calc_timestamping_constants` for every CRTC. I tested kms_vblank, all of them are SUCCESS/SKIP, do you know other tests that can trigger bugs? -- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure 2024-10-03 15:07 ` Louis Chauvet @ 2024-10-03 15:29 ` Ville Syrjälä 2024-10-03 15:45 ` Louis Chauvet 0 siblings, 1 reply; 13+ messages in thread From: Ville Syrjälä @ 2024-10-03 15:29 UTC (permalink / raw) To: dri-devel, intel-gfx, Liviu Dudau, Russell King, Inki Dae, Patrik Jakobsson, Alain Volmat, Sandy Huang, Jyri Sarha, Alexey Brodkin, Hans de Goede, Maíra Canal, Zack Rusin, amd-gfx, linux-mediatek, linux-amlogic, linux-arm-msm, freedreno, nouveau, virtualization, spice-devel, linux-renesas-soc, xen-devel On Thu, Oct 03, 2024 at 05:07:35PM +0200, Louis Chauvet wrote: > > > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c > > > > index a40295c18b48..780681ea77e4 100644 > > > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > > > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *crtc) > > > > struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); > > > > struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > > > > > > > - drm_calc_timestamping_constants(crtc, &crtc->mode); > > > > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode); > > > > > > drm_calc_timestamping_constants(crtc, &crtc->state->mode); > > > > This one doesn't look safe. You want to call that during your atomic > > commit already. > > > > This was already not safe with the previous implementation? Or it is only > unsafe because now I use state->mode instead of legacy.mode? Yeah, if you want to look at obj->state then you need the corresponding lock. obj->state is also not necessarily the correct state you want because a parallel commit could have already swapped in a new state but the hardware is still on the old state. Basically 99.9% of code should never even look at obj->state, and instead should always use the for_each_new_<obj>_in_state() and drm_atomic_get_new_<obj>_state() stuff. Currently that is a pipe dream though because a lot of drivers haven't been fixed to do things properly. If we ever manage to fix everything then we could remove the stall hacks from drm_atomic_helper_swap_state() and allow a commit pipeline of arbitrary length. > > After inspecting the code, I think I don't need to call it as: > > In `vkms_atomic_commit_tail` (used in > `@vkms_mode_config_helpers.atomic_commit_tail`), we call > `drm_atomic_helper_commit_modeset_disables`, which call > `drm_atomic_helper_calc_timestamping_constants` which call > `drm_calc_timestamping_constants` for every CRTC. Slightly odd place for it, but I think that's just because it was originally part of drm_atomic_helper_update_legacy_modeset_state() and I didn't bother looking for a better home for it when I split it out. But seems like it should work fine as is. > > I tested kms_vblank, all of them are SUCCESS/SKIP, do you know other tests > that can trigger bugs? You would explicitly have to race commits against vblank_enable. Could of course sprinkle sleep()s around to widen the race window if you're really keen to hit it. -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure 2024-10-03 15:29 ` Ville Syrjälä @ 2024-10-03 15:45 ` Louis Chauvet 0 siblings, 0 replies; 13+ messages in thread From: Louis Chauvet @ 2024-10-03 15:45 UTC (permalink / raw) To: Ville Syrjälä Cc: dri-devel, intel-gfx, Liviu Dudau, Russell King, Inki Dae, Patrik Jakobsson, Alain Volmat, Sandy Huang, Jyri Sarha, Alexey Brodkin, Hans de Goede, Maíra Canal, Zack Rusin, amd-gfx, linux-mediatek, linux-amlogic, linux-arm-msm, freedreno, nouveau, virtualization, spice-devel, linux-renesas-soc, xen-devel Le 03/10/24 - 18:29, Ville Syrjälä a écrit : > On Thu, Oct 03, 2024 at 05:07:35PM +0200, Louis Chauvet wrote: > > > > > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c > > > > > index a40295c18b48..780681ea77e4 100644 > > > > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > > > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > > > > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *crtc) > > > > > struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); > > > > > struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > > > > > > > > > - drm_calc_timestamping_constants(crtc, &crtc->mode); > > > > > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode); > > > > > > > > drm_calc_timestamping_constants(crtc, &crtc->state->mode); > > > > > > This one doesn't look safe. You want to call that during your atomic > > > commit already. > > > > > > > This was already not safe with the previous implementation? Or it is only > > unsafe because now I use state->mode instead of legacy.mode? > > Yeah, if you want to look at obj->state then you need the corresponding > lock. > > obj->state is also not necessarily the correct state you want because > a parallel commit could have already swapped in a new state but the > hardware is still on the old state. > > Basically 99.9% of code should never even look at obj->state, and > instead should always use the for_each_new_<obj>_in_state() > and drm_atomic_get_new_<obj>_state() stuff. Currently that is a > pipe dream though because a lot of drivers haven't been fixed to > do things properly. If we ever manage to fix everything then we > could remove the stall hacks from drm_atomic_helper_swap_state() > and allow a commit pipeline of arbitrary length. > > > > > After inspecting the code, I think I don't need to call it as: > > > > In `vkms_atomic_commit_tail` (used in > > `@vkms_mode_config_helpers.atomic_commit_tail`), we call > > `drm_atomic_helper_commit_modeset_disables`, which call > > `drm_atomic_helper_calc_timestamping_constants` which call > > `drm_calc_timestamping_constants` for every CRTC. > > Slightly odd place for it, but I think that's just because it was > originally part of drm_atomic_helper_update_legacy_modeset_state() > and I didn't bother looking for a better home for it when I split > it out. But seems like it should work fine as is. I just send a patch for this! Thanks for your help! [1]:https://lore.kernel.org/all/20241003-remove-legacy-v1-1-0b7db1f1a1a6@bootlin.com/ > > > > I tested kms_vblank, all of them are SUCCESS/SKIP, do you know other tests > > that can trigger bugs? > > You would explicitly have to race commits against vblank_enable. > Could of course sprinkle sleep()s around to widen the race window > if you're really keen to hit it. > > -- > Ville Syrjälä > Intel -- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping 2024-10-02 18:21 [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjala 2024-10-02 18:21 ` [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure Ville Syrjala [not found] ` <20241002182200.15363-3-ville.syrjala@linux.intel.com> @ 2024-10-25 7:46 ` Ville Syrjälä 2024-10-25 9:54 ` Dmitry Baryshkov 2024-10-25 9:59 ` Jani Nikula 2 siblings, 2 replies; 13+ messages in thread From: Ville Syrjälä @ 2024-10-25 7:46 UTC (permalink / raw) To: dri-devel Cc: intel-gfx, Abhinav Kumar, Alain Volmat, Alex Deucher, Alexey Brodkin, amd-gfx, Andy Yan, Christian König, Danilo Krummrich, Dmitry Baryshkov, freedreno, Hans de Goede, Heiko Stübner, Inki Dae, Jyri Sarha, Karol Herbst, linux-amlogic, linux-arm-msm, linux-arm-msm, linux-mediatek, linux-renesas-soc, Liviu Dudau, Lyude Paul, Maíra Canal, Marijn Suijten, nouveau, nouveau, Patrik Jakobsson, Rob Clark, Russell King, Sandy Huang, Sean Paul, spice-devel, virtualization, xen-devel, Xinhui Pan, Zack Rusin On Wed, Oct 02, 2024 at 09:21:58PM +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > An attempt to hide the drm_plane/crtc legacy state better. > > This also highlights the fact that a lot of supposedly > atomic drivers are poking around in the legacy crtc state, > which is rather questionable. For planes we did force the > legacy state to NULL already to force drivers to behave. > But even then it seems capable of confusing people with > its high profile location directly under drm_plane. > > This might end up as some kind of conflict > galore, but the alternative would involve trying > to wean the atomic drivers off one by one, > which would probably take forever. At least with > this the issue becomes visible and shouldn't be > forgotten as easily. Ping, anyone have thoughts on this? I'd like to get something like this in at some point to make the legacy state (ab)users easily visible... > > The cc list was getting way out of hand, so I had > to trim it a bit. Hopefully I didn't chop off too > many names... > > Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> > Cc: Alain Volmat <alain.volmat@foss.st.com> > Cc: Alex Deucher <alexander.deucher@amd.com> > Cc: Alexey Brodkin <abrodkin@synopsys.com> > Cc: amd-gfx@lists.freedesktop.org > Cc: Andy Yan <andy.yan@rock-chips.com> > Cc: "Christian König" <christian.koenig@amd.com> > Cc: Danilo Krummrich <dakr@redhat.com> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > Cc: freedreno@lists.freedesktop.org > Cc: Hans de Goede <hdegoede@redhat.com> > Cc: "Heiko Stübner" <heiko@sntech.de> > Cc: Inki Dae <inki.dae@samsung.com> > Cc: Jyri Sarha <jyri.sarha@iki.fi> > Cc: Karol Herbst <kherbst@redhat.com> > Cc: linux-amlogic@lists.infradead.org > Cc: linux-arm-msm@vger.kernel.org > Cc: linux-arm-msm@vger.kernel.orga > Cc: linux-mediatek@lists.infradead.org > Cc: linux-renesas-soc@vger.kernel.org > Cc: Liviu Dudau <liviu.dudau@arm.com> > Cc: Lyude Paul <lyude@redhat.com> > Cc: "Maíra Canal" <mairacanal@riseup.net> > Cc: Marijn Suijten <marijn.suijten@somainline.org> > Cc: nouveau@lists.freedesktop.org > Cc: nouveau@lists.freedesktop.orga > Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> > Cc: Rob Clark <robdclark@gmail.com> > Cc: Russell King <linux@armlinux.org.uk> > Cc: Sandy Huang <hjc@rock-chips.com> > Cc: Sean Paul <sean@poorly.run> > Cc: spice-devel@lists.freedesktop.org > Cc: virtualization@lists.linux.dev > Cc: xen-devel@lists.xenproject.org > Cc: Xinhui Pan <Xinhui.Pan@amd.com> > Cc: Zack Rusin <zack.rusin@broadcom.com> > > Ville Syrjälä (2): > drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure > drm: Move crtc->{x,y,mode,enabled} to legacy sub-structure > > .../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 7 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 20 ++--- > drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 2 +- > drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 35 ++++---- > drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 35 ++++---- > drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 37 ++++----- > drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 35 ++++---- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++-- > .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +- > drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c | 4 +- > drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- > drivers/gpu/drm/arm/malidp_hw.c | 2 +- > drivers/gpu/drm/armada/armada_crtc.c | 12 ++- > drivers/gpu/drm/ast/ast_dp.c | 8 +- > drivers/gpu/drm/drm_atomic.c | 6 +- > drivers/gpu/drm/drm_atomic_helper.c | 8 +- > drivers/gpu/drm/drm_client_modeset.c | 10 +-- > drivers/gpu/drm/drm_crtc.c | 31 +++---- > drivers/gpu/drm/drm_crtc_helper.c | 80 ++++++++++--------- > drivers/gpu/drm/drm_fb_helper.c | 12 +-- > drivers/gpu/drm/drm_framebuffer.c | 4 +- > drivers/gpu/drm/drm_plane.c | 69 ++++++++-------- > drivers/gpu/drm/drm_plane_helper.c | 6 +- > drivers/gpu/drm/drm_vblank.c | 2 +- > drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 +- > drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- > drivers/gpu/drm/gma500/cdv_intel_dp.c | 6 +- > drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 3 +- > drivers/gpu/drm/gma500/cdv_intel_lvds.c | 6 +- > drivers/gpu/drm/gma500/gma_display.c | 22 ++--- > drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- > drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- > drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 +- > drivers/gpu/drm/gma500/psb_intel_sdvo.c | 8 +- > drivers/gpu/drm/i2c/ch7006_drv.c | 7 +- > drivers/gpu/drm/i2c/sil164_drv.c | 2 +- > .../drm/i915/display/intel_modeset_setup.c | 4 +- > drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 31 ++++--- > drivers/gpu/drm/mediatek/mtk_crtc.c | 6 +- > drivers/gpu/drm/meson/meson_overlay.c | 2 +- > drivers/gpu/drm/meson/meson_plane.c | 8 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 18 +++-- > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 16 ++-- > drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 +- > drivers/gpu/drm/nouveau/dispnv04/crtc.c | 25 +++--- > drivers/gpu/drm/nouveau/dispnv04/cursor.c | 2 +- > drivers/gpu/drm/nouveau/dispnv04/dfp.c | 2 +- > drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 +- > .../gpu/drm/nouveau/dispnv04/tvmodesnv17.c | 4 +- > drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 7 +- > drivers/gpu/drm/nouveau/nouveau_connector.c | 6 +- > drivers/gpu/drm/qxl/qxl_display.c | 6 +- > drivers/gpu/drm/radeon/atombios_crtc.c | 28 +++---- > drivers/gpu/drm/radeon/cik.c | 12 +-- > drivers/gpu/drm/radeon/evergreen.c | 16 ++-- > drivers/gpu/drm/radeon/r100.c | 16 ++-- > drivers/gpu/drm/radeon/r600_cs.c | 2 +- > drivers/gpu/drm/radeon/r600_dpm.c | 4 +- > drivers/gpu/drm/radeon/radeon_connectors.c | 7 +- > drivers/gpu/drm/radeon/radeon_cursor.c | 29 +++---- > drivers/gpu/drm/radeon/radeon_device.c | 2 +- > drivers/gpu/drm/radeon/radeon_display.c | 26 +++--- > drivers/gpu/drm/radeon/radeon_drv.c | 2 +- > drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 16 ++-- > .../gpu/drm/radeon/radeon_legacy_encoders.c | 2 +- > drivers/gpu/drm/radeon/radeon_pm.c | 2 +- > drivers/gpu/drm/radeon/rs600.c | 10 +-- > drivers/gpu/drm/radeon/rs690.c | 22 ++--- > drivers/gpu/drm/radeon/rs780_dpm.c | 6 +- > drivers/gpu/drm/radeon/rv515.c | 30 +++---- > drivers/gpu/drm/radeon/rv770.c | 2 +- > drivers/gpu/drm/radeon/si.c | 14 ++-- > .../gpu/drm/renesas/rcar-du/rcar_du_crtc.c | 2 +- > .../gpu/drm/renesas/shmobile/shmob_drm_crtc.c | 2 +- > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +- > drivers/gpu/drm/sti/sti_crtc.c | 4 +- > drivers/gpu/drm/sti/sti_cursor.c | 2 +- > drivers/gpu/drm/sti/sti_gdp.c | 2 +- > drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- > drivers/gpu/drm/sti/sti_tvout.c | 6 +- > drivers/gpu/drm/sti/sti_vid.c | 2 +- > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 10 +-- > drivers/gpu/drm/tiny/arcpgu.c | 2 +- > drivers/gpu/drm/vboxvideo/vbox_mode.c | 2 +- > drivers/gpu/drm/vc4/vc4_dpi.c | 2 +- > drivers/gpu/drm/vc4/vc4_plane.c | 4 +- > drivers/gpu/drm/virtio/virtgpu_display.c | 4 +- > drivers/gpu/drm/vkms/vkms_composer.c | 4 +- > drivers/gpu/drm/vkms/vkms_crtc.c | 2 +- > drivers/gpu/drm/vkms/vkms_writeback.c | 4 +- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 8 +- > drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 18 +++-- > drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 9 ++- > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +- > drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 2 +- > drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- > include/drm/drm_crtc.h | 75 ++++++++--------- > include/drm/drm_plane.h | 52 ++++++------ > 100 files changed, 599 insertions(+), 547 deletions(-) > > -- > 2.45.2 -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping 2024-10-25 7:46 ` [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjälä @ 2024-10-25 9:54 ` Dmitry Baryshkov 2024-10-25 9:59 ` Jani Nikula 1 sibling, 0 replies; 13+ messages in thread From: Dmitry Baryshkov @ 2024-10-25 9:54 UTC (permalink / raw) To: Ville Syrjälä Cc: dri-devel, intel-gfx, Abhinav Kumar, Alain Volmat, Alex Deucher, Alexey Brodkin, amd-gfx, Andy Yan, Christian König, Danilo Krummrich, freedreno, Hans de Goede, Heiko Stübner, Inki Dae, Jyri Sarha, Karol Herbst, linux-amlogic, linux-arm-msm, linux-arm-msm, linux-mediatek, linux-renesas-soc, Liviu Dudau, Lyude Paul, Maíra Canal, Marijn Suijten, nouveau, nouveau, Patrik Jakobsson, Rob Clark, Russell King, Sandy Huang, Sean Paul, spice-devel, virtualization, xen-devel, Xinhui Pan, Zack Rusin On Fri, 25 Oct 2024 at 10:46, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Wed, Oct 02, 2024 at 09:21:58PM +0300, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > An attempt to hide the drm_plane/crtc legacy state better. > > > > This also highlights the fact that a lot of supposedly > > atomic drivers are poking around in the legacy crtc state, > > which is rather questionable. For planes we did force the > > legacy state to NULL already to force drivers to behave. > > But even then it seems capable of confusing people with > > its high profile location directly under drm_plane. > > > > This might end up as some kind of conflict > > galore, but the alternative would involve trying > > to wean the atomic drivers off one by one, > > which would probably take forever. At least with > > this the issue becomes visible and shouldn't be > > forgotten as easily. > > Ping, anyone have thoughts on this? I'd like to get something > like this in at some point to make the legacy state (ab)users > easily visible... I think that's a good idea. I hope to find a time slot and check the (ab)using of legacy state in drm/msm driver. > > > > > The cc list was getting way out of hand, so I had > > to trim it a bit. Hopefully I didn't chop off too > > many names... -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping 2024-10-25 7:46 ` [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjälä 2024-10-25 9:54 ` Dmitry Baryshkov @ 2024-10-25 9:59 ` Jani Nikula 1 sibling, 0 replies; 13+ messages in thread From: Jani Nikula @ 2024-10-25 9:59 UTC (permalink / raw) To: Ville Syrjälä, dri-devel Cc: intel-gfx, Abhinav Kumar, Alain Volmat, Alex Deucher, Alexey Brodkin, amd-gfx, Andy Yan, Christian König, Danilo Krummrich, Dmitry Baryshkov, freedreno, Hans de Goede, Heiko Stübner, Inki Dae, Jyri Sarha, Karol Herbst, linux-amlogic, linux-arm-msm, linux-arm-msm, linux-mediatek, linux-renesas-soc, Liviu Dudau, Lyude Paul, Maíra Canal, Marijn Suijten, nouveau, nouveau, Patrik Jakobsson, Rob Clark, Russell King, Sandy Huang, Sean Paul, spice-devel, virtualization, xen-devel, Xinhui Pan, Zack Rusin On Fri, 25 Oct 2024, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > On Wed, Oct 02, 2024 at 09:21:58PM +0300, Ville Syrjala wrote: >> From: Ville Syrjälä <ville.syrjala@linux.intel.com> >> >> An attempt to hide the drm_plane/crtc legacy state better. >> >> This also highlights the fact that a lot of supposedly >> atomic drivers are poking around in the legacy crtc state, >> which is rather questionable. For planes we did force the >> legacy state to NULL already to force drivers to behave. >> But even then it seems capable of confusing people with >> its high profile location directly under drm_plane. >> >> This might end up as some kind of conflict >> galore, but the alternative would involve trying >> to wean the atomic drivers off one by one, >> which would probably take forever. At least with >> this the issue becomes visible and shouldn't be >> forgotten as easily. > > Ping, anyone have thoughts on this? I'd like to get something > like this in at some point to make the legacy state (ab)users > easily visible... On the approach, Acked-by: Jani Nikula <jani.nikula@intel.com> with or without converting legacy into a pointer, up to you. > >> >> The cc list was getting way out of hand, so I had >> to trim it a bit. Hopefully I didn't chop off too >> many names... >> >> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> >> Cc: Alain Volmat <alain.volmat@foss.st.com> >> Cc: Alex Deucher <alexander.deucher@amd.com> >> Cc: Alexey Brodkin <abrodkin@synopsys.com> >> Cc: amd-gfx@lists.freedesktop.org >> Cc: Andy Yan <andy.yan@rock-chips.com> >> Cc: "Christian König" <christian.koenig@amd.com> >> Cc: Danilo Krummrich <dakr@redhat.com> >> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> >> Cc: freedreno@lists.freedesktop.org >> Cc: Hans de Goede <hdegoede@redhat.com> >> Cc: "Heiko Stübner" <heiko@sntech.de> >> Cc: Inki Dae <inki.dae@samsung.com> >> Cc: Jyri Sarha <jyri.sarha@iki.fi> >> Cc: Karol Herbst <kherbst@redhat.com> >> Cc: linux-amlogic@lists.infradead.org >> Cc: linux-arm-msm@vger.kernel.org >> Cc: linux-arm-msm@vger.kernel.orga >> Cc: linux-mediatek@lists.infradead.org >> Cc: linux-renesas-soc@vger.kernel.org >> Cc: Liviu Dudau <liviu.dudau@arm.com> >> Cc: Lyude Paul <lyude@redhat.com> >> Cc: "Maíra Canal" <mairacanal@riseup.net> >> Cc: Marijn Suijten <marijn.suijten@somainline.org> >> Cc: nouveau@lists.freedesktop.org >> Cc: nouveau@lists.freedesktop.orga >> Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> >> Cc: Rob Clark <robdclark@gmail.com> >> Cc: Russell King <linux@armlinux.org.uk> >> Cc: Sandy Huang <hjc@rock-chips.com> >> Cc: Sean Paul <sean@poorly.run> >> Cc: spice-devel@lists.freedesktop.org >> Cc: virtualization@lists.linux.dev >> Cc: xen-devel@lists.xenproject.org >> Cc: Xinhui Pan <Xinhui.Pan@amd.com> >> Cc: Zack Rusin <zack.rusin@broadcom.com> >> >> Ville Syrjälä (2): >> drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure >> drm: Move crtc->{x,y,mode,enabled} to legacy sub-structure >> >> .../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 7 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 20 ++--- >> drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c | 2 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 2 +- >> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 35 ++++---- >> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 35 ++++---- >> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 37 ++++----- >> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 35 ++++---- >> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++-- >> .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +- >> drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c | 4 +- >> drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- >> drivers/gpu/drm/arm/malidp_hw.c | 2 +- >> drivers/gpu/drm/armada/armada_crtc.c | 12 ++- >> drivers/gpu/drm/ast/ast_dp.c | 8 +- >> drivers/gpu/drm/drm_atomic.c | 6 +- >> drivers/gpu/drm/drm_atomic_helper.c | 8 +- >> drivers/gpu/drm/drm_client_modeset.c | 10 +-- >> drivers/gpu/drm/drm_crtc.c | 31 +++---- >> drivers/gpu/drm/drm_crtc_helper.c | 80 ++++++++++--------- >> drivers/gpu/drm/drm_fb_helper.c | 12 +-- >> drivers/gpu/drm/drm_framebuffer.c | 4 +- >> drivers/gpu/drm/drm_plane.c | 69 ++++++++-------- >> drivers/gpu/drm/drm_plane_helper.c | 6 +- >> drivers/gpu/drm/drm_vblank.c | 2 +- >> drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 +- >> drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- >> drivers/gpu/drm/gma500/cdv_intel_dp.c | 6 +- >> drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 3 +- >> drivers/gpu/drm/gma500/cdv_intel_lvds.c | 6 +- >> drivers/gpu/drm/gma500/gma_display.c | 22 ++--- >> drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- >> drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- >> drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 +- >> drivers/gpu/drm/gma500/psb_intel_sdvo.c | 8 +- >> drivers/gpu/drm/i2c/ch7006_drv.c | 7 +- >> drivers/gpu/drm/i2c/sil164_drv.c | 2 +- >> .../drm/i915/display/intel_modeset_setup.c | 4 +- >> drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 31 ++++--- >> drivers/gpu/drm/mediatek/mtk_crtc.c | 6 +- >> drivers/gpu/drm/meson/meson_overlay.c | 2 +- >> drivers/gpu/drm/meson/meson_plane.c | 8 +- >> drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 18 +++-- >> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +- >> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 16 ++-- >> drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 +- >> drivers/gpu/drm/nouveau/dispnv04/crtc.c | 25 +++--- >> drivers/gpu/drm/nouveau/dispnv04/cursor.c | 2 +- >> drivers/gpu/drm/nouveau/dispnv04/dfp.c | 2 +- >> drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 +- >> .../gpu/drm/nouveau/dispnv04/tvmodesnv17.c | 4 +- >> drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 7 +- >> drivers/gpu/drm/nouveau/nouveau_connector.c | 6 +- >> drivers/gpu/drm/qxl/qxl_display.c | 6 +- >> drivers/gpu/drm/radeon/atombios_crtc.c | 28 +++---- >> drivers/gpu/drm/radeon/cik.c | 12 +-- >> drivers/gpu/drm/radeon/evergreen.c | 16 ++-- >> drivers/gpu/drm/radeon/r100.c | 16 ++-- >> drivers/gpu/drm/radeon/r600_cs.c | 2 +- >> drivers/gpu/drm/radeon/r600_dpm.c | 4 +- >> drivers/gpu/drm/radeon/radeon_connectors.c | 7 +- >> drivers/gpu/drm/radeon/radeon_cursor.c | 29 +++---- >> drivers/gpu/drm/radeon/radeon_device.c | 2 +- >> drivers/gpu/drm/radeon/radeon_display.c | 26 +++--- >> drivers/gpu/drm/radeon/radeon_drv.c | 2 +- >> drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 16 ++-- >> .../gpu/drm/radeon/radeon_legacy_encoders.c | 2 +- >> drivers/gpu/drm/radeon/radeon_pm.c | 2 +- >> drivers/gpu/drm/radeon/rs600.c | 10 +-- >> drivers/gpu/drm/radeon/rs690.c | 22 ++--- >> drivers/gpu/drm/radeon/rs780_dpm.c | 6 +- >> drivers/gpu/drm/radeon/rv515.c | 30 +++---- >> drivers/gpu/drm/radeon/rv770.c | 2 +- >> drivers/gpu/drm/radeon/si.c | 14 ++-- >> .../gpu/drm/renesas/rcar-du/rcar_du_crtc.c | 2 +- >> .../gpu/drm/renesas/shmobile/shmob_drm_crtc.c | 2 +- >> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +- >> drivers/gpu/drm/sti/sti_crtc.c | 4 +- >> drivers/gpu/drm/sti/sti_cursor.c | 2 +- >> drivers/gpu/drm/sti/sti_gdp.c | 2 +- >> drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- >> drivers/gpu/drm/sti/sti_tvout.c | 6 +- >> drivers/gpu/drm/sti/sti_vid.c | 2 +- >> drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 10 +-- >> drivers/gpu/drm/tiny/arcpgu.c | 2 +- >> drivers/gpu/drm/vboxvideo/vbox_mode.c | 2 +- >> drivers/gpu/drm/vc4/vc4_dpi.c | 2 +- >> drivers/gpu/drm/vc4/vc4_plane.c | 4 +- >> drivers/gpu/drm/virtio/virtgpu_display.c | 4 +- >> drivers/gpu/drm/vkms/vkms_composer.c | 4 +- >> drivers/gpu/drm/vkms/vkms_crtc.c | 2 +- >> drivers/gpu/drm/vkms/vkms_writeback.c | 4 +- >> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 8 +- >> drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 18 +++-- >> drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 9 ++- >> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +- >> drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 2 +- >> drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- >> include/drm/drm_crtc.h | 75 ++++++++--------- >> include/drm/drm_plane.h | 52 ++++++------ >> 100 files changed, 599 insertions(+), 547 deletions(-) >> >> -- >> 2.45.2 -- Jani Nikula, Intel ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-10-25 10:15 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 18:21 [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjala
2024-10-02 18:21 ` [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure Ville Syrjala
2024-10-03 11:12 ` Ville Syrjälä
2024-10-25 9:57 ` Jani Nikula
2024-10-25 10:15 ` Ville Syrjälä
[not found] ` <20241002182200.15363-3-ville.syrjala@linux.intel.com>
2024-10-03 12:38 ` [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} " Louis Chauvet
2024-10-03 13:46 ` Ville Syrjälä
2024-10-03 15:07 ` Louis Chauvet
2024-10-03 15:29 ` Ville Syrjälä
2024-10-03 15:45 ` Louis Chauvet
2024-10-25 7:46 ` [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjälä
2024-10-25 9:54 ` Dmitry Baryshkov
2024-10-25 9:59 ` Jani Nikula
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).