Using the managed function simplifies the error handling. After
unloading the driver, the PCI device should now get disabled as
well.
Signed-off-by: Tian Tao <tiantao6(a)hisilicon.com>
---
drivers/gpu/drm/drm_pci.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 6dba4b8..0616172 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -207,7 +207,7 @@ static int drm_get_pci_dev(struct …
[View More]pci_dev *pdev,
if (IS_ERR(dev))
return PTR_ERR(dev);
- ret = pci_enable_device(pdev);
+ ret = pcim_enable_device(pdev);
if (ret)
goto err_free;
@@ -234,7 +234,6 @@ static int drm_get_pci_dev(struct pci_dev *pdev,
err_agp:
drm_pci_agp_destroy(dev);
- pci_disable_device(pdev);
err_free:
drm_dev_put(dev);
return ret;
--
2.7.4
[View Less]
(was: drm/vram-helper: Lock GEM BOs while they are mapped)
GEM VRAM helpers used to pin the BO in their implementation of vmap, so
that they could not be relocated. In recent discussions, [1][2] it became
clear that this is incorrect for in-kernel use cases, such as fbdev
emulation; which should rather depend on the reservation lock to prevent
relocation.
This patchset addresses the issue by introducing the new interfaces
vmap_local and vunmap_local throughout dma-buf and GEM. It further adds
…
[View More]support to DRM's CMA, SHMEM and VRAM helpers and finally converts fbdev
emulation to the new interface.
Patches 1 and 2 prepare the ast cursor code for the later changes.
Patches 3 and 4 add the vmap_local infrastructure throughout dma-buf,
GEM and PRIME.
Patches 5 to 7 add implementations of vmap_local to DRM's various GEM
helper libraries. Due to the simple nature of these libraries, existing
vmap code can be reused easily. Several drivers are updateed as well to
use the new interfaces.
Patch 8 converts generic fbdev emulation to use vmap_local. Only DRM
drivers that use GEM helpers currently use fbdev emulation, so patches
5 to 7 covered all necessary instances.
I smoke-tested the patchset with ast (VRAM helpers), mgag200 (SHMEM) and
vc4 (CMA). I also tested with a version of radeon (raw TTM) that has been
converted to generic fbdev emulation.
v3:
* rewrite patchset around vmap_local
v2:
* make importers acquire resv locks by themselves
* document dma-buf vamp/vunmap ops
[1] https://patchwork.freedesktop.org/patch/400054/?series=83765&rev=1
[2] https://patchwork.freedesktop.org/patch/405407/?series=84401&rev=2
Thomas Zimmermann (8):
drm/ast: Don't pin cursor source BO explicitly during update
drm/ast: Only map cursor BOs during updates
dma-buf: Add vmap_local and vnumap_local operations
drm/gem: Create infrastructure for GEM vmap_local
drm/cma-helper: Provide a vmap function for short-term mappings
drm/shmem-helper: Provide a vmap function for short-term mappings
drm/vram-helper: Provide a vmap function for short-term mappings
drm/fb-helper: Move BO locking from DRM client to fbdev damage worker
drivers/dma-buf/dma-buf.c | 80 ++++++++++++++
drivers/gpu/drm/ast/ast_cursor.c | 70 +++++++-----
drivers/gpu/drm/ast/ast_drv.h | 2 -
drivers/gpu/drm/drm_client.c | 91 ++++++++++++++++
drivers/gpu/drm/drm_fb_helper.c | 41 +++----
drivers/gpu/drm/drm_gem.c | 28 +++++
drivers/gpu/drm/drm_gem_cma_helper.c | 35 ++++++
drivers/gpu/drm/drm_gem_shmem_helper.c | 71 ++++++++++++-
drivers/gpu/drm/drm_gem_vram_helper.c | 142 ++++++++++++++++---------
drivers/gpu/drm/drm_internal.h | 2 +
drivers/gpu/drm/drm_prime.c | 39 +++++++
drivers/gpu/drm/mgag200/mgag200_mode.c | 16 ++-
drivers/gpu/drm/tiny/cirrus.c | 10 +-
drivers/gpu/drm/tiny/gm12u320.c | 14 ++-
drivers/gpu/drm/udl/udl_modeset.c | 18 ++--
drivers/gpu/drm/vboxvideo/vbox_mode.c | 15 +--
drivers/gpu/drm/vc4/vc4_bo.c | 13 +++
drivers/gpu/drm/vc4/vc4_drv.h | 1 +
drivers/gpu/drm/virtio/virtgpu_prime.c | 2 +
include/drm/drm_client.h | 4 +
include/drm/drm_gem.h | 20 ++++
include/drm/drm_gem_cma_helper.h | 1 +
include/drm/drm_gem_shmem_helper.h | 2 +
include/drm/drm_gem_vram_helper.h | 2 +
include/drm/drm_prime.h | 2 +
include/linux/dma-buf.h | 34 ++++++
26 files changed, 635 insertions(+), 120 deletions(-)
--
2.29.2
[View Less]
Commit 25b4620ee822 ("drm/i915/dsi: Skip delays for v3 VBTs in vid-mode")
added an intel_dsi_msleep() helper which skips sleeping if the
MIPI-sequences have a version of 3 or newer and the panel is in vid-mode;
and it moved a bunch of msleep-s over to this new helper.
This was based on my reading of the big comment around line 730 which
starts with "Panel enable/disable sequences from the VBT spec.",
where the "v3 video mode seq" column does not have any wait t# entries.
Given that this code …
[View More]has been used on a lot of different devices without
issues until now, it seems that my interpretation of the spec here is
mostly correct.
But now I have encountered one device, an Acer Aspire Switch 10 E
SW3-016, where the panel will not light up unless we do actually honor the
panel_on_delay after exexuting the MIPI_SEQ_PANEL_ON sequence.
What seems to set this model apart is that it is lacking a
MIPI_SEQ_DEASSERT_RESET sequence, which is where the power-on
delay usually happens.
Fix the panel not lighting up on this model by using an unconditional
msleep(panel_on_delay) instead of intel_dsi_msleep() when there is
no MIPI_SEQ_DEASSERT_RESET sequence.
Fixes: 25b4620ee822 ("drm/i915/dsi: Skip delays for v3 VBTs in vid-mode")
Signed-off-by: Hans de Goede <hdegoede(a)redhat.com>
---
drivers/gpu/drm/i915/display/vlv_dsi.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c
index 194c239ab6b1..ef673277b36d 100644
--- a/drivers/gpu/drm/i915/display/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/display/vlv_dsi.c
@@ -816,10 +816,14 @@ static void intel_dsi_pre_enable(struct intel_atomic_state *state,
intel_dsi_prepare(encoder, pipe_config);
intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_POWER_ON);
- intel_dsi_msleep(intel_dsi, intel_dsi->panel_on_delay);
- /* Deassert reset */
- intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DEASSERT_RESET);
+ if (dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET]) {
+ intel_dsi_msleep(intel_dsi, intel_dsi->panel_on_delay);
+ /* Deassert reset */
+ intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DEASSERT_RESET);
+ } else {
+ msleep(intel_dsi->panel_on_delay);
+ }
if (IS_GEMINILAKE(dev_priv)) {
glk_cold_boot = glk_dsi_enable_io(encoder);
--
2.28.0
[View Less]
The drm_display_mode_to_videomode() does not populate DISPLAY_FLAGS_DE_LOW
or DISPLAY_FLAGS_PIXDATA_NEGEDGE flags in struct videomode. Therefore, no
matter what polarity the next bridge or display might require, these flags
are never set, and thus the LTDC GCR_DEPOL and GCR_PCPOL bits are never set,
and the LTDC behaves as if both DISPLAY_FLAGS_PIXDATA_POSEDGE and
DISPLAY_FLAGS_DE_HIGH were always set.
The fix for this problem is taken almost verbatim from MXSFB driver. In
case there is a …
[View More]bridge attached to the LTDC, the bridge might have extra
polarity requirements, so extract bus_flags from the bridge and use them
for LTDC configuration. Otherwise, extract bus_flags from the connector,
which is the display.
Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver")
Signed-off-by: Marek Vasut <marex(a)denx.de>
Cc: Alexandre Torgue <alexandre.torgue(a)st.com>
Cc: Antonio Borneo <antonio.borneo(a)st.com>
Cc: Benjamin Gaignard <benjamin.gaignard(a)st.com>
Cc: Maxime Coquelin <mcoquelin.stm32(a)gmail.com>
Cc: Philippe Cornu <philippe.cornu(a)st.com>
Cc: Sam Ravnborg <sam(a)ravnborg.org>
Cc: Vincent Abriou <vincent.abriou(a)st.com>
Cc: Yannick Fertre <yannick.fertre(a)st.com>
Cc: linux-arm-kernel(a)lists.infradead.org
Cc: linux-stm32(a)st-md-mailman.stormreply.com
To: dri-devel(a)lists.freedesktop.org
---
V2: Check if ldev->bridge->timings is non-NULL before accessing it
---
drivers/gpu/drm/stm/ltdc.c | 22 ++++++++++++++++++++--
drivers/gpu/drm/stm/ltdc.h | 2 ++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 1c9f18b4adfc..22c7e9fa5ab7 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -546,11 +546,17 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
struct drm_device *ddev = crtc->dev;
struct drm_display_mode *mode = &crtc->state->adjusted_mode;
struct videomode vm;
+ u32 bus_flags = 0;
u32 hsync, vsync, accum_hbp, accum_vbp, accum_act_w, accum_act_h;
u32 total_width, total_height;
u32 val;
int ret;
+ if (ldev->bridge && ldev->bridge->timings)
+ bus_flags = ldev->bridge->timings->input_bus_flags;
+ else if (ldev->connector)
+ bus_flags = ldev->connector->display_info.bus_flags;
+
if (!pm_runtime_active(ddev->dev)) {
ret = pm_runtime_get_sync(ddev->dev);
if (ret) {
@@ -586,10 +592,10 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
if (vm.flags & DISPLAY_FLAGS_VSYNC_HIGH)
val |= GCR_VSPOL;
- if (vm.flags & DISPLAY_FLAGS_DE_LOW)
+ if (bus_flags & DRM_BUS_FLAG_DE_LOW)
val |= GCR_DEPOL;
- if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+ if (bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
val |= GCR_PCPOL;
reg_update_bits(ldev->regs, LTDC_GCR,
@@ -1098,6 +1104,8 @@ static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
{
+ struct ltdc_device *ldev = ddev->dev_private;
+ struct drm_connector_list_iter iter;
struct drm_encoder *encoder;
int ret;
@@ -1119,6 +1127,16 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
return -EINVAL;
}
+ ldev->bridge = bridge;
+
+ /*
+ * Get hold of the connector. This is a bit of a hack, until the bridge
+ * API gives us bus flags and formats.
+ */
+ drm_connector_list_iter_begin(ddev, &iter);
+ ldev->connector = drm_connector_list_iter_next(&iter);
+ drm_connector_list_iter_end(&iter);
+
DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id);
return 0;
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index f153b908c70e..d0d2c81de29a 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -38,6 +38,8 @@ struct ltdc_device {
u32 irq_status;
struct fps_info plane_fpsi[LTDC_MAX_LAYER];
struct drm_atomic_state *suspend_state;
+ struct drm_bridge *bridge;
+ struct drm_connector *connector;
};
int ltdc_load(struct drm_device *ddev);
--
2.29.2
[View Less]