diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-12-17 15:57:54 +0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-12-17 15:57:54 +0300 |
commit | 6c56e8adc0011b3bc01b6b2bab7e41d5ecb43c0f (patch) | |
tree | 3baa1c367f120d7fcc1c30dbb8a6aff5fa5dd672 /drivers/gpu/drm/mediatek | |
parent | d1eef1c619749b2a57e514a3fa67d9a516ffa919 (diff) | |
parent | 2156873f08c7893811f34177aa923ab1ea486591 (diff) | |
download | linux-6c56e8adc0011b3bc01b6b2bab7e41d5ecb43c0f.tar.xz |
Merge tag 'drm-misc-next-2019-12-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for v5.6:
UAPI Changes:
- Add support for DMA-BUF HEAPS.
Cross-subsystem Changes:
- mipi dsi definition updates, pulled into drm-intel as well.
- Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim.
- Remove support for dma-buf kmap/kunmap.
- Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well.
Core Changes:
- Small cleanups to ttm.
- Fix SCDC definition.
- Assorted cleanups to core.
- Add todo to remove load/unload hooks, and use generic fbdev emulation.
- Assorted documentation updates.
- Use blocking ww lock in ttm fault handler.
- Remove drm_fb_helper_fbdev_setup/teardown.
- Warning fixes with W=1 for atomic.
- Use drm_debug_enabled() instead of drm_debug flag testing in various drivers.
- Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted)
- Various kconfig indentation fixes in core and drivers.
- Fix freeing transactions in dp-mst correctly.
- Sean Paul is steping down as core maintainer. :-(
- Add lockdep annotations for atomic locks vs dma-resv.
- Prevent use-after-free for a bad job in drm_scheduler.
- Fill out all block sizes in the P01x and P210 definitions.
- Avoid division by zero in drm/rect, and fix bounds.
- Add drm/rect selftests.
- Add aspect ratio and alternate clocks for HDMI 4k modes.
- Add todo for drm_framebuffer_funcs and fb_create cleanup.
- Drop DRM_AUTH for prime import/export ioctls.
- Clear DP-MST payload id tables downstream when initializating.
- Fix for DSC throughput definition.
- Add extra FEC definitions.
- Fix fake offset in drm_gem_object_funs.mmap.
- Stop using encoder->bridge in core directly
- Handle bridge chaining slightly better.
- Add backlight support to drm/panel, and use it in many panel drivers.
- Increase max number of y420 modes from 128 to 256, as preparation to add the new modes.
Driver Changes:
- Small fixes all over.
- Fix documentation in vkms.
- Fix mmap_sem vs dma_resv in nouveau.
- Small cleanup in komeda.
- Add page flip support in gma500 for psb/cdv.
- Add ddc symlink in the connector sysfs directory for many drivers.
- Add support for analogic an6345, and fix small bugs in it.
- Add atomic modesetting support to ast.
- Fix radeon fault handler VMA race.
- Switch udl to use generic shmem helpers.
- Unconditional vblank handling for mcde.
- Miscellaneous fixes to mcde.
- Tweak debug output from komeda using debugfs.
- Add gamma and color transform support to komeda for DOU-IPS.
- Add support for sony acx424AKP panel.
- Various small cleanups to gma500.
- Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation.
- Add support for Logic PD Type 28 panel.
- Use drm_panel_* wrapper functions in exynos/tegra/msm.
- Add devicetree bindings for generic DSI panels.
- Don't include drm_pci.h directly in many drivers.
- Add support for begin/end_cpu_access in udmabuf.
- Stop using drm_get_pci_dev in gma500 and mga200.
- Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access.
- Add devfreq thermal support to panfrost.
- Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager.
- meson: Add support for OSD1 plane AFBC commit.
- Stop displaying garbage when toggling ast primary plane on/off.
- More cleanups and fixes to UDL.
- Add D32 suport to komeda.
- Remove globle copy of drm_dev in gma500.
- Add support for Boe Himax8279d MIPI-DSI LCD panel.
- Add support for ingenic JZ4770 panel.
- Small null pointer deference fix in ingenic.
- Remove support for the special tfp420 driver, as there is a generic way to do it.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/mediatek')
-rw-r--r-- | drivers/gpu/drm/mediatek/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_fb.c | 92 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_fb.h | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_plane.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_dsi.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_hdmi.c | 15 |
7 files changed, 25 insertions, 115 deletions
diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index 8067a4be8311..5044dfb8e3d6 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -7,7 +7,6 @@ mediatek-drm-y := mtk_disp_color.o \ mtk_drm_ddp.o \ mtk_drm_ddp_comp.o \ mtk_drm_drv.o \ - mtk_drm_fb.o \ mtk_drm_gem.o \ mtk_drm_plane.o \ mtk_dsi.o \ diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 84d14213d992..2b1c122066ea 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -16,8 +16,10 @@ #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_fourcc.h> #include <drm/drm_gem.h> #include <drm/drm_gem_cma_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_of.h> #include <drm/drm_probe_helper.h> #include <drm/drm_vblank.h> @@ -27,7 +29,6 @@ #include "mtk_drm_ddp.h" #include "mtk_drm_ddp_comp.h" #include "mtk_drm_drv.h" -#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" #define DRIVER_NAME "mediatek" @@ -115,6 +116,19 @@ static int mtk_atomic_commit(struct drm_device *drm, return 0; } +static struct drm_framebuffer * +mtk_drm_mode_fb_create(struct drm_device *dev, + struct drm_file *file, + const struct drm_mode_fb_cmd2 *cmd) +{ + const struct drm_format_info *info = drm_get_format_info(dev, cmd); + + if (info->num_planes != 1) + return ERR_PTR(-EINVAL); + + return drm_gem_fb_create(dev, file, cmd); +} + static const struct drm_mode_config_funcs mtk_drm_mode_config_funcs = { .fb_create = mtk_drm_mode_fb_create, .atomic_check = drm_atomic_helper_check, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c deleted file mode 100644 index 3f230a28a2dc..000000000000 --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2015 MediaTek Inc. - */ - -#include <linux/dma-buf.h> -#include <linux/dma-resv.h> - -#include <drm/drm_modeset_helper.h> -#include <drm/drm_fb_helper.h> -#include <drm/drm_fourcc.h> -#include <drm/drm_gem.h> -#include <drm/drm_gem_framebuffer_helper.h> - -#include "mtk_drm_drv.h" -#include "mtk_drm_fb.h" -#include "mtk_drm_gem.h" - -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { - .create_handle = drm_gem_fb_create_handle, - .destroy = drm_gem_fb_destroy, -}; - -static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev, - const struct drm_mode_fb_cmd2 *mode, - struct drm_gem_object *obj) -{ - const struct drm_format_info *info = drm_get_format_info(dev, mode); - struct drm_framebuffer *fb; - int ret; - - if (info->num_planes != 1) - return ERR_PTR(-EINVAL); - - fb = kzalloc(sizeof(*fb), GFP_KERNEL); - if (!fb) - return ERR_PTR(-ENOMEM); - - drm_helper_mode_fill_fb_struct(dev, fb, mode); - - fb->obj[0] = obj; - - ret = drm_framebuffer_init(dev, fb, &mtk_drm_fb_funcs); - if (ret) { - DRM_ERROR("failed to initialize framebuffer\n"); - kfree(fb); - return ERR_PTR(ret); - } - - return fb; -} - -struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, - struct drm_file *file, - const struct drm_mode_fb_cmd2 *cmd) -{ - const struct drm_format_info *info = drm_get_format_info(dev, cmd); - struct drm_framebuffer *fb; - struct drm_gem_object *gem; - unsigned int width = cmd->width; - unsigned int height = cmd->height; - unsigned int size, bpp; - int ret; - - if (info->num_planes != 1) - return ERR_PTR(-EINVAL); - - gem = drm_gem_object_lookup(file, cmd->handles[0]); - if (!gem) - return ERR_PTR(-ENOENT); - - bpp = info->cpp[0]; - size = (height - 1) * cmd->pitches[0] + width * bpp; - size += cmd->offsets[0]; - - if (gem->size < size) { - ret = -EINVAL; - goto unreference; - } - - fb = mtk_drm_framebuffer_init(dev, cmd, gem); - if (IS_ERR(fb)) { - ret = PTR_ERR(fb); - goto unreference; - } - - return fb; - -unreference: - drm_gem_object_put_unlocked(gem); - return ERR_PTR(ret); -} diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.h b/drivers/gpu/drm/mediatek/mtk_drm_fb.h deleted file mode 100644 index eb64d26001c6..000000000000 --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2015 MediaTek Inc. - */ - -#ifndef MTK_DRM_FB_H -#define MTK_DRM_FB_H - -struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, - struct drm_file *file, - const struct drm_mode_fb_cmd2 *cmd); - -#endif /* MTK_DRM_FB_H */ diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index 3b0cc91c7023..540ef2faa40a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -13,7 +13,6 @@ #include "mtk_drm_crtc.h" #include "mtk_drm_ddp_comp.h" #include "mtk_drm_drv.h" -#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" #include "mtk_drm_plane.h" diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index e9931bbbe846..3b5e016d16c4 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -821,7 +821,7 @@ static int mtk_dsi_connector_get_modes(struct drm_connector *connector) { struct mtk_dsi *dsi = connector_to_dsi(connector); - return drm_panel_get_modes(dsi->panel); + return drm_panel_get_modes(dsi->panel, connector); } static const struct drm_encoder_helper_funcs mtk_dsi_encoder_helper_funcs = { diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index c79b1f855d89..5e4a4dbda443 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1238,17 +1238,19 @@ static int mtk_hdmi_conn_mode_valid(struct drm_connector *conn, struct drm_display_mode *mode) { struct mtk_hdmi *hdmi = hdmi_ctx_from_conn(conn); + struct drm_bridge *next_bridge; dev_dbg(hdmi->dev, "xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", mode->hdisplay, mode->vdisplay, mode->vrefresh, !!(mode->flags & DRM_MODE_FLAG_INTERLACE), mode->clock * 1000); - if (hdmi->bridge.next) { + next_bridge = drm_bridge_get_next_bridge(&hdmi->bridge); + if (next_bridge) { struct drm_display_mode adjusted_mode; drm_mode_copy(&adjusted_mode, mode); - if (!drm_bridge_mode_fixup(hdmi->bridge.next, mode, - &adjusted_mode)) + if (!drm_bridge_chain_mode_fixup(next_bridge, mode, + &adjusted_mode)) return MODE_BAD; } @@ -1300,9 +1302,10 @@ static int mtk_hdmi_bridge_attach(struct drm_bridge *bridge) struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge); int ret; - ret = drm_connector_init(bridge->encoder->dev, &hdmi->conn, - &mtk_hdmi_connector_funcs, - DRM_MODE_CONNECTOR_HDMIA); + ret = drm_connector_init_with_ddc(bridge->encoder->dev, &hdmi->conn, + &mtk_hdmi_connector_funcs, + DRM_MODE_CONNECTOR_HDMIA, + hdmi->ddc_adpt); if (ret) { dev_err(hdmi->dev, "Failed to initialize connector: %d\n", ret); return ret; |