[PATCH] drm/exynos: remove unnecessary function declaration
Removed exynos_drm_get_dma_device funtion declaration on top of exynos_drm_drv.c file. We can remove this declaration by moving the implementation of this function upwards. Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 44 - 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index a6ff3a5..27e423b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -37,8 +37,6 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 -static struct device *exynos_drm_get_dma_device(void); - int exynos_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) { @@ -301,6 +299,27 @@ static struct component_match *exynos_drm_match_add(struct device *dev) return match ?: ERR_PTR(-ENODEV); } +static struct device *exynos_drm_get_dma_device(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) { + struct exynos_drm_driver_info *info = &exynos_drm_drivers[i]; + struct device *dev; + + if (!info->driver || !(info->flags & DRM_DMA_DEVICE)) + continue; + + while ((dev = bus_find_device(&platform_bus_type, NULL, + &info->driver->driver, + (void *)platform_bus_type.match))) { + put_device(dev); + return dev; + } + } + return NULL; +} + static int exynos_drm_bind(struct device *dev) { struct exynos_drm_private *private; @@ -469,27 +488,6 @@ static int exynos_drm_platform_remove(struct platform_device *pdev) }, }; -static struct device *exynos_drm_get_dma_device(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) { - struct exynos_drm_driver_info *info = &exynos_drm_drivers[i]; - struct device *dev; - - if (!info->driver || !(info->flags & DRM_DMA_DEVICE)) - continue; - - while ((dev = bus_find_device(&platform_bus_type, NULL, - &info->driver->driver, - (void *)platform_bus_type.match))) { - put_device(dev); - return dev; - } - } - return NULL; -} - static void exynos_drm_unregister_devices(void) { int i; -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/exynos: remove unnecessary descrptions
Removed two descriptions to 'da_start' and 'da_space_size' from exynos_drm_private structure. These members don't exist anymore. Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index f8bae4cb..b41df55 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -191,11 +191,6 @@ struct drm_exynos_file_private { /* * Exynos drm private structure. * - * @da_start: start address to device address space. - * with iommu, device address space starts from this address - * otherwise default one. - * @da_space_size: size of device address space. - * if 0 then default value is used for it. * @pending: the crtcs that have pending updates to finish * @lock: protect access to @pending * @wait: wait an atomic commit to finish -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: RFC: page-flip with damage?
On Mon, Nov 27, 2017 at 09:03:22AM +0100, Thomas Hellstrom wrote: > On 09/26/2017 10:18 AM, Daniel Vetter wrote: > > On Sun, Sep 24, 2017 at 07:41:45PM +0200, Thomas Hellstrom wrote: > > > Hi, list! > > > > > > Page flips, while efficient on real hardware, aren't that efficient in > > > other > > > situations, like for virtual devices with local, or even worse, remote > > > desktops. > > > We might ending up forwarding or encoding a couple of full frames worth of > > > data instead of a small region at a cursor blink. > > > > > > Now there is this extension EGL_KHR_swap_buffers_with_damage, and > > > gnome-shell/wayland on KMS also has a damage region that it forwards all > > > the > > > way down to the function where page-flip is called. > > > > > > So I'd like to start looking at page-flips with damage, meaning that the > > > damage is an optional hint to the device about what part of the contents > > > is > > > actually updated. What would be the best way to implement this? I figure > > > this can be done within the atomic context with a region attached to the > > > plane state? Would we want to follow the EGL extension and forward an > > > array > > > of rects or for simplicity use a single bounding box? Both these options > > > would be a great win. > > So my rough plan for all this was: > > > > - Add damage to drm_crtc_state, in screen coordinates. I think this is the > >most natural place for this, since it's what PSR/manual upload DSI want. > >It should also fit well for udl and tinydrm. Virtual drivers like > >vmwgfx might need helpers to wrap this back to framebuffer rectangles, > >but that seems the odd case out - the framebuffer-based approach in the > >DIRTY_IOCTL forces most drivers to do a fancy lookup from fb to the > >crtc. > > > >Per-plane dirty rectangle seems to be an awkward in-betwen state, with > >all the confusion about whether it's pre/post scaled and how to best > >combine them. And then someone changes the background color of the crtc > >(or something like that), what happens then? I think pushing all that > >onto userspace is best, it can always ask for a complete flip if it's > >unclear whether it damaged the entire screen or not. > > Actually, after looking into this a bit in the context of remoting, I think > I will have to disagree. > > The most natural place for damage appears to be the drm_plane state, in > plane fb coordinates. > The reason for this is that devices with hardware planes will want to have > the coordinates in this way. Think cursor, Video overlay. Currently with > vmwgfx and atomic we need to send the cursor image down the device pipeline > on each cursor move which is pretty nasty. > Same thing holds for video overlay if we decide to move it to atomic. The > overlay engine wants to know what part of the source image > has changed. > Damage is triggered by a content change and the change lives in the > framebuffer, and this is easier on user-space as well. > > Now for software plane compositing, you might be hitting the problems you > describe above. > But if you're doing software plane compositing in your drm driver (which you > probably aren't), > you'd have enough information anyway to handle both the odd case of > background color change and any scaling if present (god forbid). The one thing I'm somewhat worried about with per-plane damage rects is correctly adding them up into an overall crtc rect for hw that needs it (that's edp and manual upload dsi). There's some fixed point math involved first to get from plane src to crtc dst coords, and then there's the fun of figuring out which properties affect the entire screen or entire plane (background, gamma tables, ...). But I guess we can do that in a helper and share that code with all drivers that need it. I think we have 2 different kinds of drivers which would benefit from this: - drivers that composite on the "display"/remotely (like vmwgfx, or maybe also spice): Want damage in plane source coordinates. I think we could also group udl and spi/i2c-connected screens into this, since you can do the same buffer upload dance. Those drivers also might benefit from a list of rectangles (assuming the rectangles aren't too small). At least e.g. udl has a hw cursor which is also composited remotely. - hw drivers where the selective upload happens after compositing, i.e. edp psr and dsi manual upload. Generally you get 1 rectangle, maybe 2 if they're well-seperated enough. Screen coordinates only, and for damage calculation we must take all compositing parameters into account. Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info
On some hardware the LCD panel is not mounted upright in the casing, but upside-down or rotated 90 degrees. In this case we want the console to automatically be rotated to compensate. The fbdev-driver may know about the need to rotate. Add a new fbcon_rotate_hint field to struct fb_info, which gets initialized to -1. If the fbdev-driver knows that some sort of rotation is necessary then it can set this field to a FB_ROTATE_* value to tell the fbcon console driver to rotate the console. Signed-off-by: Hans de Goede --- drivers/video/fbdev/core/fbcon.c | 18 -- drivers/video/fbdev/core/fbsysfs.c | 1 + include/linux/fb.h | 5 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 04612f938bab..fb317ed76b45 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -963,10 +963,13 @@ static const char *fbcon_startup(void) ops->cur_rotate = -1; ops->cur_blink_jiffies = HZ / 5; info->fbcon_par = ops; - if (initial_rotation != -1) - p->con_rotate = initial_rotation; - else + + p->con_rotate = initial_rotation; + if (p->con_rotate == -1) + p->con_rotate = info->fbcon_rotate_hint; + if (p->con_rotate == -1) p->con_rotate = fbcon_platform_get_rotate(info); + set_blitting_type(vc, info); if (info->fix.type != FB_TYPE_TEXT) { @@ -1103,10 +1106,13 @@ static void fbcon_init(struct vc_data *vc, int init) ops = info->fbcon_par; ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); - if (initial_rotation != -1) - p->con_rotate = initial_rotation; - else + + p->con_rotate = initial_rotation; + if (p->con_rotate == -1) + p->con_rotate = info->fbcon_rotate_hint; + if (p->con_rotate == -1) p->con_rotate = fbcon_platform_get_rotate(info); + set_blitting_type(vc, info); cols = vc->vc_cols; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 15755ce1d26c..e31a182b42bf 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -58,6 +58,7 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) info->par = p + fb_info_size; info->device = dev; + info->fbcon_rotate_hint = -1; #ifdef CONFIG_FB_BACKLIGHT mutex_init(&info->bl_curve_mutex); diff --git a/include/linux/fb.h b/include/linux/fb.h index bc24e48e396d..d1e5bed39140 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -465,6 +465,11 @@ struct fb_info { atomic_t count; int node; int flags; + /* +* -1 by default, set to a FB_ROTATE_* value by the driver, if it knows +* a lcd is not mounted upright and fbcon should rotate to compensate. +*/ + int fbcon_rotate_hint; struct mutex lock; /* Lock for open/release/ioctl funcs */ struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */ struct fb_var_screeninfo var; /* Current var */ -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm: Fix modifiers_property kernel-doc comment
This fixes the following make kerneldocs messages: ./include/drm/drm_mode_config.h:772: warning: No description found for parameter 'modifiers_property' ./include/drm/drm_mode_config.h:772: warning: Excess struct member 'modifiers' description in 'drm_mode_config' Signed-off-by: Hans de Goede --- include/drm/drm_mode_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 3716e6b8fed5..cb9ffbda36cc 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -759,7 +759,7 @@ struct drm_mode_config { bool allow_fb_modifiers; /** -* @modifiers: Plane property to list support modifier/format +* @modifiers_property: Plane property to list support modifier/format * combination. */ struct drm_property *modifiers_property; -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk
On some hardware the LCD panel is not mounted upright in the casing, but rotated by 90 degrees. In this case we want the console to automatically be rotated to compensate. The drm subsys has a quirk table for this, use the drm_get_panel_orientation_quirk function to get the panel orientation and set info->fbcon_rotate_hint based on this, so that the fbcon console on top of efifb gets automatically rotated to compensate for the panel orientation. Signed-off-by: Hans de Goede --- Changes in v7: -Fix compile error from v6 --- drivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/efifb.c | 21 - 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 5e58f5ec0a28..c4a90c497839 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -772,6 +772,7 @@ config FB_VESA config FB_EFI bool "EFI-based Framebuffer Support" depends on (FB = y) && !IA64 && EFI + select DRM_PANEL_ORIENTATION_QUIRKS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index d1bf9c2a78a7..46a4484e3da7 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -16,6 +16,8 @@ #include #include #include +#include /* For drm_get_panel_orientation_quirk */ +#include /* For DRM_MODE_PANEL_ORIENTATION_* */ static bool request_mem_succeeded = false; static bool nowc = false; @@ -157,7 +159,7 @@ static u64 bar_offset; static int efifb_probe(struct platform_device *dev) { struct fb_info *info; - int err; + int err, orientation; unsigned int size_vmode; unsigned int size_remap; unsigned int size_total; @@ -329,6 +331,23 @@ static int efifb_probe(struct platform_device *dev) info->fix = efifb_fix; info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE; + orientation = drm_get_panel_orientation_quirk(efifb_defined.xres, + efifb_defined.yres); + switch (orientation) { + default: + info->fbcon_rotate_hint = FB_ROTATE_UR; + break; + case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: + info->fbcon_rotate_hint = FB_ROTATE_UD; + break; + case DRM_MODE_PANEL_ORIENTATION_LEFT_UP: + info->fbcon_rotate_hint = FB_ROTATE_CCW; + break; + case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: + info->fbcon_rotate_hint = FB_ROTATE_CW; + break; + } + err = sysfs_create_groups(&dev->dev.kobj, efifb_groups); if (err) { pr_err("efifb: cannot add sysfs attrs\n"); -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 2/7] drm: Add panel orientation quirks, v6.
Some x86 clamshell design devices use portrait tablet screens and a display engine which cannot rotate in hardware, so the firmware just leaves things as is and we cannot figure out that the display is oriented non upright from the hardware. So at least on x86, we need a quirk table for this. This commit adds a DMI based quirk table which is initially populated with 5 such devices: Asus T100HA, GPD Pocket, GPD win, I.T.Works TW891 and the VIOS LTH17. This quirk table will be used by the drm code to let userspace know that the display is not mounted upright inside the devices case through a new panel orientation drm-connector property, as well as to tell fbcon to rotate the console so that it shows the right way up. Changes in v5: -Add a kernel-doc comment documenting drm_get_panel_orientation_quirk() -Remove board_* matches from the dmi-matches for the VIOS LTH17 laptop, keeping only the (identical) sys_vendor and product_name matches. This is necessary because an older version of the bios has board_vendor set to VOIS instead of VIOS Changes in v6: -Add reference to added kernel-docs in Documentation/gpu/drm-kms-helpers.rst Reviewed-by: Daniel Vetter Signed-off-by: Hans de Goede --- Documentation/gpu/drm-kms-helpers.rst | 3 + drivers/gpu/drm/Kconfig| 3 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel_orientation_quirks.c | 174 + include/drm/drm_utils.h| 18 +++ 5 files changed, 199 insertions(+) create mode 100644 drivers/gpu/drm/drm_panel_orientation_quirks.c create mode 100644 include/drm/drm_utils.h diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst index 13dd237418cc..3ea622876b67 100644 --- a/Documentation/gpu/drm-kms-helpers.rst +++ b/Documentation/gpu/drm-kms-helpers.rst @@ -163,6 +163,9 @@ Panel Helper Reference .. kernel-doc:: drivers/gpu/drm/drm_panel.c :export: +.. kernel-doc:: drivers/gpu/drm/drm_panel_orientation_quirks.c + :export: + Display Port Helper Functions Reference === diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4d9f21831741..9d005ac98c2b 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -26,6 +26,9 @@ config DRM_MIPI_DSI bool depends on DRM +config DRM_PANEL_ORIENTATION_QUIRKS + tristate + config DRM_DP_AUX_CHARDEV bool "DRM DP AUX Interface" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index e9500844333e..e5bf68b9c171 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -47,6 +47,7 @@ obj-$(CONFIG_DRM_DEBUG_MM_SELFTEST) += selftests/ obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o +obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o obj-$(CONFIG_DRM_ARM) += arm/ obj-$(CONFIG_DRM_TTM) += ttm/ obj-$(CONFIG_DRM_TDFX) += tdfx/ diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c new file mode 100644 index ..b8765e2ed1d6 --- /dev/null +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -0,0 +1,174 @@ +/* + * drm_panel_orientation_quirks.c -- Quirks for non-normal panel orientation + * + * Copyright (C) 2017 Hans de Goede + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#include +#include + +#ifdef CONFIG_DMI + +/* + * Some x86 clamshell design devices use portrait tablet screens and a display + * engine which cannot rotate in hardware, so we need to rotate the fbcon to + * compensate. Unfortunately these (cheap) devices also typically have quite + * generic DMI data, so we match on a combination of DMI data, screen resolution + * and a list of known BIOS dates to avoid false positives. + */ + +struct drm_dmi_panel_orientation_data { + int width; + int height; + const char * const *bios_dates; + int orientation; +}; + +static const struct drm_dmi_panel_orientation_data asus_t100ha = { + .width = 800, + .height = 1280, + .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP, +}; + +static const struct drm_dmi_panel_orientation_data gpd_pocket = { + .width = 1200, + .height = 1920, + .bios_dates = (const char * const []){ "05/26/2017", "06/28/2017", + "07/05/2017", "08/07/2017", NULL }, + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, +}; + +static const struct drm_dmi_panel_orientation_data gpd_win = { + .width = 720, + .height = 1280, + .bios_dates = (const char * const []){ + "10/25/2016", "11/18/2016", "12/23/2016", "12/26/2016", + "02/21/2017", "03/20/2017", "05/25/2017", NULL }, + .orientation = DRM_MODE_PANEL_ORI
[PATCH v7 5/7] drm/i915: Add "panel orientation" property to the panel connector, v6.
Ideally we could use the VBT for this, that would be simple, in intel_dsi_init() check dev_priv->vbt.dsi.config->rotation, set connector->display_info.panel_orientation accordingly and call drm_connector_init_panel_orientation_property(), done. Unfortunately vbt.dsi.config->rotation is always 0 even on tablets with an upside down LCD and where the GOP is properly rotating the EFI fb in hardware. So instead we end up reading the rotation from the primary plane. This commit only implements the panel orientation property for DSI panels on BYT / CHT hardware, as all known non normal oriented panels sofar are only found on this hardware. Changes in v2: -Read back the rotation applied by the GOP from the primary plane instead of relying on dev_priv->vbt.dsi.config->rotation, because it seems that the VBT rotation filed is always 0 even on devices where the GOP does apply a rotation Changes in v3: -Rewrite the code to read back the orientation from the primary plane to contain all of this in intel_dsi.c instead of poking a bunch of holes between all the different layers Changes in v6: -Move hardware readout to intel_dsi_init() Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_dsi.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index f09474b0c4d3..f67d321376e4 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c @@ -1666,6 +1666,27 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = { .atomic_duplicate_state = intel_digital_connector_duplicate_state, }; +static int intel_dsi_get_panel_orientation(struct intel_connector *connector) +{ + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + int orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; + enum i9xx_plane_id plane; + u32 val; + + if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { + if (connector->encoder->crtc_mask == BIT(PIPE_B)) + plane = PLANE_B; + else + plane = PLANE_A; + + val = I915_READ(DSPCNTR(plane)); + if (val & DISPPLANE_ROTATE_180) + orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + } + + return orientation; +} + static void intel_dsi_add_properties(struct intel_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); @@ -1681,6 +1702,13 @@ static void intel_dsi_add_properties(struct intel_connector *connector) allowed_scalers); connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT; + + connector->base.display_info.panel_orientation = + intel_dsi_get_panel_orientation(connector); + drm_connector_init_panel_orientation_property( + &connector->base, + connector->panel.fixed_mode->hdisplay, + connector->panel.fixed_mode->vdisplay); } } -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 3/7] drm: Add support for a panel-orientation connector property, v6
On some devices the LCD panel is mounted in the casing in such a way that the up/top side of the panel does not match with the top side of the device (e.g. it is mounted upside-down). This commit adds the necessary infra for lcd-panel drm_connector-s to have a "panel orientation" property to communicate how the panel is orientated vs the casing. Userspace can use this property to check for non-normal orientation and then adjust the displayed image accordingly by rotating it to compensate. Changes in v2: -Store panel_orientation in drm_display_info, so that drm_fb_helper.c can access it easily -Have a single drm_connector_init_panel_orientation_property rather then create and attach functions. The caller is expected to set drm_display_info.panel_orientation before calling this, then this will check for platform specific quirks overriding the panel_orientation and if the panel_orientation is set after this then it will attach the property. Changes in v6: -Use an enum (with kerneldoc) rather then #defines for DRM_MODE_PANEL_ORIENTATION_* Signed-off-by: Hans de Goede Reviewed-by: Daniel Vetter --- drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/drm_connector.c | 73 + include/drm/drm_connector.h | 40 ++ include/drm/drm_mode_config.h | 7 4 files changed, 121 insertions(+) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 9d005ac98c2b..0b166e626eb6 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -7,6 +7,7 @@ menuconfig DRM tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA + select DRM_PANEL_ORIENTATION_QUIRKS select HDMI select FB_CMDLINE select I2C diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 25f4b2e9a44f..624edeb5c50d 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "drm_crtc_internal.h" #include "drm_internal.h" @@ -212,6 +213,8 @@ int drm_connector_init(struct drm_device *dev, mutex_init(&connector->mutex); connector->edid_blob_ptr = NULL; connector->status = connector_status_unknown; + connector->display_info.panel_orientation = + DRM_MODE_PANEL_ORIENTATION_UNKNOWN; drm_connector_get_cmdline_mode(connector); @@ -668,6 +671,13 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" }, }; +static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = { + { DRM_MODE_PANEL_ORIENTATION_NORMAL,"Normal"}, + { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down" }, + { DRM_MODE_PANEL_ORIENTATION_LEFT_UP, "Left Side Up" }, + { DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, "Right Side Up" }, +}; + static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ @@ -776,6 +786,18 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, * * CRTC_ID: * Mode object ID of the &drm_crtc this connector should be connected to. + * + * Connectors for LCD panels may also have one standardized property: + * + * panel orientation: + * On some devices the LCD panel is mounted in the casing in such a way + * that the up/top side of the panel does not match with the top side of + * the device. Userspace can use this property to check for this. + * Note that input coordinates from touchscreens (input devices with + * INPUT_PROP_DIRECT) will still map 1:1 to the actual LCD panel + * coordinates, so if userspace rotates the picture to adjust for + * the orientation it must also apply the same transformation to the + * touchscreen input coordinates. */ int drm_connector_create_standard_properties(struct drm_device *dev) @@ -1251,6 +1273,57 @@ void drm_mode_connector_set_link_status_property(struct drm_connector *connector } EXPORT_SYMBOL(drm_mode_connector_set_link_status_property); +/** + * drm_connector_init_panel_orientation_property - + * initialize the connecters panel_orientation property + * @connector: connector for which to init the panel-orientation property. + * @width: width in pixels of the panel, used for panel quirk detection + * @height: height in pixels of the panel, used for panel quirk detection + * + * This function should only be called for built-in panels, after setting + * connector->display_info.panel_orientation first (if known). + * + * This function will check for platform specific (e.g. DMI based) quirks + * overriding display_info.panel_orientation first, then if panel_orientation + * is not DRM_MODE_PANEL_ORIENTATION_UNKNOW
[PATCH v7 7/7] fbcon: Remove dmi quirk table
This is now all handled in the drivers and communicated through fb_info.fbcon_rotate_hint. Signed-off-by: Hans de Goede --- drivers/video/fbdev/core/Makefile | 3 - drivers/video/fbdev/core/fbcon.c| 4 +- drivers/video/fbdev/core/fbcon.h| 6 -- drivers/video/fbdev/core/fbcon_dmi_quirks.c | 145 4 files changed, 2 insertions(+), 156 deletions(-) delete mode 100644 drivers/video/fbdev/core/fbcon_dmi_quirks.c diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index d34fd182ca68..37710316a680 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -15,9 +15,6 @@ ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y) fb-y += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ fbcon_ccw.o endif -ifeq ($(CONFIG_DMI),y) -fb-y += fbcon_dmi_quirks.o -endif endif fb-objs := $(fb-y) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index fb317ed76b45..157a40670a47 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -968,7 +968,7 @@ static const char *fbcon_startup(void) if (p->con_rotate == -1) p->con_rotate = info->fbcon_rotate_hint; if (p->con_rotate == -1) - p->con_rotate = fbcon_platform_get_rotate(info); + p->con_rotate = FB_ROTATE_UR; set_blitting_type(vc, info); @@ -,7 +,7 @@ static void fbcon_init(struct vc_data *vc, int init) if (p->con_rotate == -1) p->con_rotate = info->fbcon_rotate_hint; if (p->con_rotate == -1) - p->con_rotate = fbcon_platform_get_rotate(info); + p->con_rotate = FB_ROTATE_UR; set_blitting_type(vc, info); diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h index 18f3ac144237..3746828356ed 100644 --- a/drivers/video/fbdev/core/fbcon.h +++ b/drivers/video/fbdev/core/fbcon.h @@ -261,10 +261,4 @@ extern void fbcon_set_rotate(struct fbcon_ops *ops); #define fbcon_set_rotate(x) do {} while(0) #endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */ -#ifdef CONFIG_DMI -int fbcon_platform_get_rotate(struct fb_info *info); -#else -#define fbcon_platform_get_rotate(i) FB_ROTATE_UR -#endif /* CONFIG_DMI */ - #endif /* _VIDEO_FBCON_H */ diff --git a/drivers/video/fbdev/core/fbcon_dmi_quirks.c b/drivers/video/fbdev/core/fbcon_dmi_quirks.c deleted file mode 100644 index 6904e47d1e51.. --- a/drivers/video/fbdev/core/fbcon_dmi_quirks.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * fbcon_dmi_quirks.c -- DMI based quirk detection for fbcon - * - * Copyright (C) 2017 Hans de Goede - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include -#include -#include -#include "fbcon.h" - -/* - * Some x86 clamshell design devices use portrait tablet screens and a display - * engine which cannot rotate in hardware, so we need to rotate the fbcon to - * compensate. Unfortunately these (cheap) devices also typically have quite - * generic DMI data, so we match on a combination of DMI data, screen resolution - * and a list of known BIOS dates to avoid false positives. - */ - -struct fbcon_dmi_rotate_data { - int width; - int height; - const char * const *bios_dates; - int rotate; -}; - -static const struct fbcon_dmi_rotate_data rotate_data_asus_t100ha = { - .width = 800, - .height = 1280, - .rotate = FB_ROTATE_CCW, -}; - -static const struct fbcon_dmi_rotate_data rotate_data_gpd_pocket = { - .width = 1200, - .height = 1920, - .bios_dates = (const char * const []){ "05/26/2017", "06/28/2017", - "07/05/2017", "08/07/2017", NULL }, - .rotate = FB_ROTATE_CW, -}; - -static const struct fbcon_dmi_rotate_data rotate_data_gpd_win = { - .width = 720, - .height = 1280, - .bios_dates = (const char * const []){ - "10/25/2016", "11/18/2016", "12/23/2016", "12/26/2016", - "02/21/2017", "03/20/2017", "05/25/2017", NULL }, - .rotate = FB_ROTATE_CW, -}; - -static const struct fbcon_dmi_rotate_data rotate_data_itworks_tw891 = { - .width = 800, - .height = 1280, - .bios_dates = (const char * const []){ "10/16/2015", NULL }, - .rotate = FB_ROTATE_CW, -}; - -static const struct fbcon_dmi_rotate_data rotate_data_vios_lth17 = { - .width = 800, - .height = 1280, - .rotate = FB_ROTATE_CW, -}; - -static const struct dmi_system_id rotate_data[] = { - { /* Asus T100HA */ - .matches = { - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100H
[PATCH v7 0/7] drm/fbdev: Panel orientation connector property support
Here is v7 of my series to add a "panel orientation" property to the drm-connector for the LCD panel to let userspace know about LCD panels which are not mounted upright, as well as detecting upside-down panels without needing quirks (like we do for 90 degree rotated screens). Bartlomiej, can we please have your Acked-by for merging patches 1, 6 and 7 through the drm tree? New in v7: -Fix embarrassing build error in efifb due to me only rebuilding modules after cleanups from v6 New in v6: -Fix / reference kernel-doc comments -Don't export the DRM_MODE_PANEL_ORIENTATION_* defines in the UAPI -Move i915 dsi hardware rotation state read-out to intel_dsi_init() New in v5: -Add kernel-doc comment documenting drm_get_panel_orientation_quirk() -drm_fb_helper: Only use hardware (crtc primary plane) rotation for 180 degrees for now as 9-/270 degrees rotation requires special handling New in v4: -Fix drm_fb_helper code setting an invalid rotation value on the primary plane of disabled/unused crtcs (caught by Fi.CI) New in v3: -As requested by Daniel v3 moves the quirks over from the fbdev subsys to the drm subsys. I've done this by simpy starting with a copy of the quirk table and eventually removing the fbdev version. The 1st patch in this series is a small fbdev/fbcon patch, patches 2-5 are all drm patches and patches 6-7 are fbdev/fbcon patches again. As discussed previously the plan is to merge all 7 patches through the drm tree. Regards, Hans ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 01/13] fbdev: show fbdev number for debugging
Signed-off-by: Michał Mirosław --- drivers/video/fbdev/core/fbmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index f741ba8df01b..30a18d4c9de4 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1618,8 +1618,8 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a, (primary && gen_aper && gen_aper->count && gen_aper->ranges[0].base == VGA_FB_PHYS)) { - printk(KERN_INFO "fb: switching to %s from %s\n", - name, registered_fb[i]->fix.id); + printk(KERN_INFO "fb%d: switching to %s from %s\n", + i, name, registered_fb[i]->fix.id); ret = do_unregister_framebuffer(registered_fb[i]); if (ret) return ret; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane, v6.
Apply the "panel orientation" drm connector prop to the primary plane so that fbcon and fbdev using userspace programs display the right way up. Changes in v3: -Use a rotation member in struct drm_fb_helper_crtc and set that from drm_setup_crtcs instead of looping over all crtc's to find the right one later -Since we now no longer look at rotation quirks directly in the fbcon code, set fb_info.fbcon_rotate_hint when the panel is not mounted upright and we cannot use hardware rotation Changes in v4: -Make drm_fb_helper_init() init drm_fb_helper_crtc.rotation to DRM_MODE_ROTATE_0 for all crtcs, so that we do not end up setting the plane_state's rotation to an invalid value for disabled crtcs (caught by Fi.CI) Changes in v5: -Only use hardware (crtc primary plane) rotation for DRM_ROTATE_180, 90 / 270 degree rotation requires special handling which we lack atm -Add a TODO comment for 90 / 270 degree hardware rotation -Add some comments to better document the default case when mapping sw_rotations to fbcon_rotate_hints Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=94894 Reviewed-by: Daniel Vetter Signed-off-by: Hans de Goede --- drivers/gpu/drm/drm_fb_helper.c | 90 - include/drm/drm_fb_helper.h | 8 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 832739ff58bf..57d6bad379f8 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -41,6 +41,7 @@ #include #include +#include "drm_crtc_internal.h" #include "drm_crtc_helper_internal.h" static bool drm_fbdev_emulation = true; @@ -356,6 +357,7 @@ EXPORT_SYMBOL(drm_fb_helper_debug_leave); static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool active) { struct drm_device *dev = fb_helper->dev; + struct drm_plane_state *plane_state; struct drm_plane *plane; struct drm_atomic_state *state; int i, ret; @@ -374,8 +376,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ retry: plane_mask = 0; drm_for_each_plane(plane, dev) { - struct drm_plane_state *plane_state; - plane_state = drm_atomic_get_plane_state(state, plane); if (IS_ERR(plane_state)) { ret = PTR_ERR(plane_state); @@ -398,6 +398,11 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ for (i = 0; i < fb_helper->crtc_count; i++) { struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set; + struct drm_plane *primary = mode_set->crtc->primary; + + /* Cannot fail as we've already gotten the plane state above */ + plane_state = drm_atomic_get_new_plane_state(state, primary); + plane_state->rotation = fb_helper->crtc_info[i].rotation; ret = __drm_atomic_helper_set_config(mode_set, state); if (ret != 0) @@ -829,6 +834,7 @@ int drm_fb_helper_init(struct drm_device *dev, if (!fb_helper->crtc_info[i].mode_set.connectors) goto out_free; fb_helper->crtc_info[i].mode_set.num_connectors = 0; + fb_helper->crtc_info[i].rotation = DRM_MODE_ROTATE_0; } i = 0; @@ -2353,6 +2359,62 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, return best_score; } +/* + * This function checks if rotation is necessary because of panel orientation + * and if it is, if it is supported. + * If rotation is necessary and supported, its gets set in fb_crtc.rotation. + * If rotation is necessary but not supported, a DRM_MODE_ROTATE_* flag gets + * or-ed into fb_helper->sw_rotations. In drm_setup_crtcs_fb() we check if only + * one bit is set and then we set fb_info.fbcon_rotate_hint to make fbcon do + * the unsupported rotation. + */ +static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper, + struct drm_fb_helper_crtc *fb_crtc, + struct drm_connector *connector) +{ + struct drm_plane *plane = fb_crtc->mode_set.crtc->primary; + uint64_t valid_mask = 0; + int i, rotation; + + fb_crtc->rotation = DRM_MODE_ROTATE_0; + + switch (connector->display_info.panel_orientation) { + case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: + rotation = DRM_MODE_ROTATE_180; + break; + case DRM_MODE_PANEL_ORIENTATION_LEFT_UP: + rotation = DRM_MODE_ROTATE_90; + break; + case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: + rotation = DRM_MODE_ROTATE_270; + break; + default: + rotation = DRM_MODE_ROTATE_0; + } + + /* +* TODO: support 90 / 270 degree hardware rotation, +* depending on the hardware this m
[PATCH 02/13] fbdev: add remove_conflicting_pci_framebuffers()
Almost all drivers using remove_conflicting_framebuffers() wrap it with the same code. Extract common part from PCI drivers into separate remove_conflicting_pci_framebuffers(). Signed-off-by: Michał Mirosław --- drivers/video/fbdev/core/fbmem.c | 22 ++ include/drm/drm_fb_helper.h | 12 include/linux/fb.h | 2 ++ 3 files changed, 36 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 30a18d4c9de4..5ea980e5d3b7 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -1788,6 +1789,27 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, } EXPORT_SYMBOL(remove_conflicting_framebuffers); +int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const char *name) +{ + struct apertures_struct *ap; + bool primary = false; + + ap = alloc_apertures(1); + if (!ap) + return -ENOMEM; + + ap->ranges[0].base = pci_resource_start(pdev, res_id); + ap->ranges[0].size = pci_resource_len(pdev, res_id); +#ifdef CONFIG_X86 + primary = pdev->resource[PCI_ROM_RESOURCE].flags & + IORESOURCE_ROM_SHADOW; +#endif + remove_conflicting_framebuffers(ap, name, primary); + kfree(ap); + return 0; +} +EXPORT_SYMBOL(remove_conflicting_pci_framebuffers); + /** * register_framebuffer - registers a frame buffer device * @fb_info: frame buffer info structure diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 33fe95927742..ac3412290289 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -520,4 +520,16 @@ drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, #endif } +static inline int +drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev, + int resource_id, + const char *name) +{ +#if IS_REACHABLE(CONFIG_FB) + return remove_conflicting_pci_framebuffers(pdev, resource_id, name); +#else + return 0; +#endif +} + #endif diff --git a/include/linux/fb.h b/include/linux/fb.h index f4386b0ccf40..4196cb09e58e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -624,6 +624,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, extern int register_framebuffer(struct fb_info *fb_info); extern int unregister_framebuffer(struct fb_info *fb_info); extern int unlink_framebuffer(struct fb_info *fb_info); +extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, + const char *name); extern int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary); extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 03/13] drm/amdgpu: use simpler remove_conflicting_pci_framebuffers()
Signed-off-by: Michał Mirosław --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 23 +-- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index dd2f060d62a8..b726222b7dd4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -537,27 +537,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist); static struct drm_driver kms_driver; -static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - bool primary = false; - - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#endif - drm_fb_helper_remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary); - kfree(ap); - - return 0; -} - static int amdgpu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -580,7 +559,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, return ret; /* Get rid of things like offb */ - ret = amdgpu_kick_out_firmware_fb(pdev); + ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "amdgpudrmfb"); if (ret) return ret; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2] drm/i915: Avoid enum conversion warning
Fixes the following enum conversion warning: drivers/gpu/drm/i915/intel_ddi.c:1481:30: error: implicit conversion from enumeration type 'enum port' to different enumeration type 'enum intel_dpll_id' [-Werror,-Wenum-conversion] enum intel_dpll_id pll_id = port; ~~ ^~~~ Suggested-by: Daniel Vetter Signed-off-by: Nick Desaulniers --- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 933c18fd4258..3c346c8cbf78 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1477,8 +1477,8 @@ static void bxt_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); - enum port port = intel_ddi_get_encoder_port(encoder); - enum intel_dpll_id pll_id = port; + enum intel_dpll_id pll_id = + (enum intel_dpll_id)intel_ddi_get_encoder_port(encoder); pipe_config->port_clock = bxt_calc_pll_link(dev_priv, pll_id); -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 04/13] drm/bochs: use simpler remove_conflicting_pci_framebuffers()
Signed-off-by: Michał Mirosław --- drivers/gpu/drm/bochs/bochs_drv.c | 18 +- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index 7b20318483e4..c61b40c72b62 100644 --- a/drivers/gpu/drm/bochs/bochs_drv.c +++ b/drivers/gpu/drm/bochs/bochs_drv.c @@ -143,22 +143,6 @@ static const struct dev_pm_ops bochs_pm_ops = { /* -- */ /* pci interface */ -static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - drm_fb_helper_remove_conflicting_framebuffers(ap, "bochsdrmfb", false); - kfree(ap); - - return 0; -} - static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -171,7 +155,7 @@ static int bochs_pci_probe(struct pci_dev *pdev, return -ENOMEM; } - ret = bochs_kick_out_firmware_fb(pdev); + ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "bochsdrmfb"); if (ret) return ret; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Regression in TTM driver w/Linus' master
On 11/24/17 3:54 PM, Daniel Vetter wrote: On Thu, Nov 23, 2017 at 03:24:38PM +0100, Tobias Klausmann wrote: On 11/23/17 2:58 AM, Dave Airlie wrote: On 23 November 2017 at 11:17, Laura Abbott wrote: Hi, Fedora QA testing reported a panic when booting up VMs using qmeu vga drivers (https://paste.fedoraproject.org/paste/498yRWTCJv2LKIrmj4EliQ) [ 30.108507] [ cut here ] [ 30.108920] kernel BUG at ./include/linux/gfp.h:408! [ 30.109356] invalid opcode: [#1] SMP [ 30.109700] Modules linked in: fuse nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack devlink ip_set nfnetlink ebtable_nat ebtable_broute bridge ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables snd_hda_codec_generic kvm_intel kvm snd_hda_intel snd_hda_codec irqbypass ppdev snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm bochs_drm ttm joydev drm_kms_helper virtio_balloon snd_timer snd parport_pc drm soundcore parport i2c_piix4 nls_utf8 isofs squashfs zstd_decompress xxhash 8021q garp mrp stp llc virtio_net [ 30.115605] virtio_console virtio_scsi crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel serio_raw virtio_pci virtio_ring virtio ata_generic pata_acpi qemu_fw_cfg sunrpc scsi_transport_iscsi loop [ 30.117425] CPU: 0 PID: 1347 Comm: gnome-shell Not tainted 4.15.0-0.rc0.git6.1.fc28.x86_64 #1 [ 30.118141] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-2.fc27 04/01/2014 [ 30.118866] task: 923a77e03380 task.stack: a78182228000 [ 30.119366] RIP: 0010:__alloc_pages_nodemask+0x35e/0x430 [ 30.119810] RSP: :a7818222bba8 EFLAGS: 00010202 [ 30.120250] RAX: 0001 RBX: 014382c6 RCX: 0006 [ 30.120840] RDX: RSI: 0009 RDI: [ 30.121443] RBP: 923a760d6000 R08: R09: 0006 [ 30.122039] R10: 0040 R11: 0300 R12: 923a729273c0 [ 30.122629] R13: R14: R15: 923a7483d400 [ 30.123223] FS: 7fe48da7dac0() GS:923a7cc0() knlGS: [ 30.123896] CS: 0010 DS: ES: CR0: 80050033 [ 30.124373] CR2: 7fe457b73000 CR3: 78313000 CR4: 06f0 [ 30.124968] Call Trace: [ 30.125186] ttm_pool_populate+0x19b/0x400 [ttm] [ 30.125578] ttm_bo_vm_fault+0x325/0x570 [ttm] [ 30.125964] __do_fault+0x19/0x11e [ 30.126255] __handle_mm_fault+0xcd3/0x1260 [ 30.126609] handle_mm_fault+0x14c/0x310 [ 30.126947] __do_page_fault+0x28c/0x530 [ 30.127282] do_page_fault+0x32/0x270 [ 30.127593] async_page_fault+0x22/0x30 [ 30.127922] RIP: 0033:0x7fe48aae39a8 [ 30.128225] RSP: 002b:7ffc21c4d928 EFLAGS: 00010206 [ 30.128664] RAX: 7fe457b73000 RBX: 55cd4c1041a0 RCX: 7fe457b73040 [ 30.129259] RDX: 0030 RSI: RDI: 7fe457b73000 [ 30.129855] RBP: 0300 R08: 000c R09: 0001 [ 30.130457] R10: 0001 R11: 0246 R12: 55cd4c1041a0 [ 30.131054] R13: 55cd4bdfe990 R14: 55cd4c104110 R15: 0400 [ 30.131648] Code: 11 01 00 0f 84 a9 00 00 00 65 ff 0d 6d cc dd 44 e9 0f ff ff ff 40 80 cd 80 e9 99 fe ff ff 48 89 c7 e8 e7 f6 01 00 e9 b7 fe ff ff <0f> 0b 0f ff e9 40 fd ff ff 65 48 8b 04 25 80 d5 00 00 8b 40 4c [ 30.133245] RIP: __alloc_pages_nodemask+0x35e/0x430 RSP: a7818222bba8 [ 30.133836] ---[ end trace d4f1deb60784f40a ]--- This is based off of Linus' master branch at c8a0739b185d11d6e2ca7ad9f5835841d1cfc765 Configs are at https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/commit/?h=rawhide&id=0be14662c54f49b4e640868b9d67df18d39edff0 Looks like a TTM regression due to: 0284f1ead87463bc17cf5e81a24fc65c052486f3 drm/ttm: add transparent huge page support for cached allocations v2 If the driver requests dma32 pages, we can end up trying to alloc huge dma32 pages which triggers the oops. The bochs driver always requests dma32 here. I'll send a rough patch once I boot it. Dave. Hi Dave, fyi only: It looks like this is not the only regression in this cycle with ttm, novueau seems to suffer as well [1]. Adding ttm folks. Might be useful if we have an entry for ttm in MAINTAINERS ... -Daniel A bit more of investigation for the nouveau regression: This only show when Transparent Hugepages (CONFIG_TRANSPARENT_HUGEPAGE) are enable. Thanks Dave for pointing me to that! Greetings, Tobias Greetings, Tobias [1]: [ 404.918139] [ cut here ] [ 404.918147] kernel BUG at mm/shmem.c:4334! [ 404.918152] invalid opcode: [#2] PREEMPT SMP [ 404.918157] Modu
AW: [PATCH 1/5] drm/panel: Add support for the EDT ETM0700G0BDH6
Hi Fabio, (and all others) > Von: Fabio Estevam [mailto:feste...@gmail.com] > Gesendet: Freitag, 24. November 2017 15:22 > Betreff: Re: [PATCH 1/5] drm/panel: Add support for the EDT ETM0700G0BDH6 > > Hi Jan, > > On Thu, Nov 23, 2017 at 1:18 PM, Türk, Jan wrote: > > Hi Fabio, > > > > I've used git send-email and tested the patches by checkpatch.pl before > without any problems. > > So it might have been touched by the mail server, so can you send me your > checkpatch.pl log (directly)? > > Take a look at your patch here: https://patchwork.kernel.org/patch/10072765/ > > Click in the "patch" link and download it. You will notice that all tabs have > been > converted into spaces. > > checkpatch will warn about it. thanks for your feedback. Meanwhile I also did some investigation and found out that our SMTP modified the message in the redmond style. I'll resend the patches as soon as the issue has been solved. emtrion GmbH Kreativpark - Alter Schlachthof 45 76131 Karlsruhe GERMANY http://www.emtrion.de ___ Amtsgericht Mannheim HRB 110 300 Geschäftsführer: Dieter Baur, Ramona Maurer ___ ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [BUG] drm: vc4: refcount_t: increment on 0; use-after-free.
On Wed, Nov 22, 2017 at 11:57 PM, Daniel Vetter wrote: > On Wed, Nov 22, 2017 at 07:21:00PM +0100, Boris Brezillon wrote: >> On Wed, 22 Nov 2017 19:13:09 +0100 >> Daniel Vetter wrote: >> >> > On Wed, Nov 22, 2017 at 6:51 PM, Boris Brezillon >> > wrote: >> > > Hi Stefan, >> > > >> > > On Wed, 22 Nov 2017 17:43:35 +0100 (CET) >> > > Stefan Wahren wrote: >> > > >> > >> Hi Boris, >> > >> if i boot Raspberry Pi 3 (ARM64, defconfig, linux-next-20171122) with >> > >> sufficient CMA memory (32 MB), i'll get this warning during boot: >> > >> >> > >> [7.623510] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops >> > >> [vc4]) >> > >> [7.632453] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops >> > >> [vc4]) >> > >> [7.639707] vc4-drm soc:gpu: bound 3f40.hvs (ops vc4_hvs_ops >> > >> [vc4]) >> > >> [7.647364] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops >> > >> vc4_crtc_ops [vc4]) >> > >> [7.655451] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops >> > >> vc4_crtc_ops [vc4]) >> > >> [7.663415] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops >> > >> vc4_crtc_ops [vc4]) >> > >> [7.730580] vc4-drm soc:gpu: bound 3fc0.v3d (ops vc4_v3d_ops >> > >> [vc4]) >> > >> [7.743965] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on >> > >> minor 0 >> > >> [7.750841] [drm] Supports vblank timestamp caching Rev 2 >> > >> (21.10.2013). >> > >> [7.757620] [drm] Driver supports precise vblank timestamp query. >> > >> [7.811775] [ cut here ] >> > >> [7.811780] refcount_t: increment on 0; use-after-free. >> > >> [7.811881] WARNING: CPU: 2 PID: 2188 at lib/refcount.c:153 >> > >> refcount_inc+0x44/0x50 >> > >> [7.811884] Modules linked in: vc4(+) cfg80211 cec drm_kms_helper >> > >> smsc95xx usbnet drm rfkill brcmutil bcm2835_rng rng_core bcm2835_dma >> > >> crc32_ce i2c_bcm2835 pwm_bcm2835 ip_tables x_tables ipv6 >> > >> [7.811950] CPU: 2 PID: 2188 Comm: systemd-udevd Not tainted >> > >> 4.14.0-next-20171122 #1 >> > >> [7.811953] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT) >> > >> [7.811958] task: 800036b91c00 task.stack: 0d6f >> > >> [7.811967] pstate: 2005 (nzCv daif -PAN -UAO) >> > >> [7.811974] pc : refcount_inc+0x44/0x50 >> > >> [7.811981] lr : refcount_inc+0x44/0x50 >> > >> [7.811984] sp : 0d6f3300 >> > >> [7.811988] x29: 0d6f3300 x28: >> > >> [7.811996] x27: 0003 x26: 800037107800 >> > >> [7.812004] x25: 0001 x24: 800035afdc00 >> > >> [7.812012] x23: x22: 800035dfa600 >> > >> [7.812020] x21: 800035afd9b0 x20: 800035afd9a4 >> > >> [7.812027] x19: x18: >> > >> [7.812034] x17: 0001 x16: 0019 >> > >> [7.812042] x15: 0001 x14: fff0 >> > >> [7.812049] x13: 090ae840 x12: 08fa2d50 >> > >> [7.812057] x11: 08fa2000 x10: 090ad000 >> > >> [7.812064] x9 : x8 : 090b5c2f >> > >> [7.812072] x7 : x6 : 0015ee00 >> > >> [7.812079] x5 : x4 : >> > >> [7.812087] x3 : x2 : 800030047000 >> > >> [7.812094] x1 : 800036b91c00 x0 : 002b >> > >> [7.812102] Call trace: >> > >> [7.812109] refcount_inc+0x44/0x50 >> > >> [7.812226] vc4_bo_inc_usecnt+0x84/0x88 [vc4] >> > >> [7.812310] vc4_prepare_fb+0x40/0xf0 [vc4] >> > >> [7.812460] drm_atomic_helper_prepare_planes+0x54/0xf0 >> > >> [drm_kms_helper] >> > >> [7.812543] vc4_atomic_commit+0x88/0x130 [vc4] >> > >> [7.812868] drm_atomic_commit+0x48/0x68 [drm] >> > >> [7.813002] restore_fbdev_mode_atomic+0x1d8/0x1e8 [drm_kms_helper] >> > >> [7.813113] restore_fbdev_mode+0x28/0x160 [drm_kms_helper] >> > >> [7.813223] >> > >> drm_fb_helper_restore_fbdev_mode_unlocked.part.24+0x28/0x90 >> > >> [drm_kms_helper] >> > >> [7.813331] drm_fb_helper_set_par+0x54/0xa8 [drm_kms_helper] >> > >> [7.813346] fbcon_init+0x4e8/0x538 >> > >> [7.813357] visual_init+0xb4/0x108 >> > >> [7.813366] do_bind_con_driver+0x1b8/0x3a0 >> > >> [7.813373] do_take_over_console+0x150/0x1d0 >> > >> [7.813380] do_fbcon_takeover+0x6c/0xf0 >> > >> [7.813387] fbcon_event_notify+0x8fc/0x928 >> > >> [7.813399] notifier_call_chain+0x50/0x90 >> > >> [7.813406] __blocking_notifier_call_chain+0x4c/0x90 >> > >> [7.813413] blocking_notifier_call_chain+0x14/0x20 >> > >> [7.813420] fb_notifier_call_chain+0x1c/0x28 >> > >> [7.813426] register_framebuffer+0x1d0/0x2d8 >> > >> [7.813533] __drm_fb_helper_initial_config_and_unlock+0x1e8/0x350 >> > >> [drm_kms_helper] >> > >> [7.813639] drm_fb_helper_initial_config+0x40/0x58 [drm_kms_helper] >> > >> [7.813747] drm_fbdev_cma_init_with_funcs+0x88/0x158
Re: [PATCH] video/fbdev/stifb: Delete an error message for a failed memory allocation in stifb_init_fb()
Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 24 Nov 2017 22:22:06 +0100 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/video/fbdev/stifb.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c > index 6ded5c198998..fe217a2f7d21 100644 > --- a/drivers/video/fbdev/stifb.c > +++ b/drivers/video/fbdev/stifb.c > @@ -1126,10 +1126,8 @@ static int __init stifb_init_fb(struct sti_struct > *sti, int bpp_pref) int bpp, xres, yres; > > fb = kzalloc(sizeof(*fb), GFP_ATOMIC); > - if (!fb) { > - printk(KERN_ERR "stifb: Could not allocate stifb structure\n"); > + if (!fb) > return -ENODEV; > - } > > info = &fb->info; This should be -ENOMEM. Eike signature.asc Description: This is a digitally signed message part. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 11/13] drm/vc4: use simpler remove_conflicting_framebuffers(NULL)
Use remove_conflicting_framebuffers(NULL) instead of open-coding it. Signed-off-by: Michał Mirosław --- drivers/gpu/drm/vc4/vc4_drv.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index e3c29729da2e..b65cddb775bb 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -227,24 +227,6 @@ static void vc4_match_add_drivers(struct device *dev, } } -static void vc4_kick_out_firmware_fb(void) -{ - struct apertures_struct *ap; - - ap = alloc_apertures(1); - if (!ap) - return; - - /* Since VC4 is a UMA device, the simplefb node may have been -* located anywhere in memory. -*/ - ap->ranges[0].base = 0; - ap->ranges[0].size = ~0; - - drm_fb_helper_remove_conflicting_framebuffers(ap, "vc4drmfb", false); - kfree(ap); -} - static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -277,7 +259,7 @@ static int vc4_drm_bind(struct device *dev) if (ret) goto gem_destroy; - vc4_kick_out_firmware_fb(); + drm_fb_helper_remove_conflicting_framebuffers(NULL, "vc4drmfb", false); ret = drm_dev_register(drm, 0); if (ret < 0) -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: add clut mode support
On 2017-11-24 14:54, Philippe CORNU wrote: > Hi Peter, > > On 11/13/2017 11:40 AM, Philippe CORNU wrote: >> Hi Peter, >> >> On 11/12/2017 01:31 PM, Peter Rosin wrote: >>> On 2017-11-10 17:12, Philippe CORNU wrote: Hi Peter, On 11/07/2017 05:34 PM, Peter Rosin wrote: > On 2017-11-07 16:53, Philippe CORNU wrote: >> + Peter >> >> Hi Peter, >> >> CLUT support on STM32 has been removed thanks to your clean up patch > > Support is a bit strong for what I thought was a dead function, or > are you saying that it used to work before my series? Really sorry > if that is the case! As I wrote in the previous related thread (https://lists.freedesktop.org/archives/dri-devel/2017-June/145070.html), STM32 chipsets supports 8-bit CLUT mode but this driver version does not support it "yet"... So, no worry regarding your clean up, I gave you an "acked-by" for that : ) >>> >>> Ok, good. Thanks for clearing that up! >>> > > Anyway, the function I removed seemed to indicate that the hardware > could handle a separate clut for each layer, but your new version > does not. Why is that? Yes I confirm the clut support is available for each layer... but I thought the gamma_lut was only at the crtc level, not at layer level... Maybe I am wrong. Moreover, small test applications I used play only with clut at crtc level... Anyway, could you please help me to "find" a per-layer clut implementation because when I read "crtc->state->gamma_lut->data" it looks like gamma_lut is per crtc, not per plane...? or maybe I have to add extra properties for that... >>> >>> I wasn't clear enough. Yes, there is to my knowledge only one clut, >>> not one per plane. What I noticed was that the function I removed >>> seemed to touch clut registers for multiple layers, but your new >>> function appears to only touch registers for one layer. So, I >>> wondered if the "one and only" clut needed to be copied to the >>> registers for the other layers, or if the old dead code was simply >>> confused. Clearer? >>> >> >> The old code was a generic helper function (ie. for all layers) but used >> only for the 1st layer. So, we could say that "old dead code was simply >> confused" :-) >> >> When I put back the clut support in this patch, I decided to update only >> the 1st layer (because there is no API for handling it on other layers). >> I also decided to not re-use the former generic helper function as the >> update loop is pretty small. >> >> This patch offers the clut mode feature for fbdev (only one plane in >> fbdev) and for drm (single plane for many use cases, 2nd plane being >> used mostly for video...) >> >> If tomorrow the API offers clut support per plane, the update loop will >> be moved to the plane update function, means the generic helper function >> will not be require anymore too. > > From the explanations above, do you think the patch is "acceptable" or > should I change it somehow? > What is your opinion? Oops, sorry about forgetting to respond. Since I don't know how the hw behaves with respect to the clut registers for the other layers, I'm just not qualified to say if you should feed the one-and-only clut to all layers or if it is sufficient to only feed it to the first plane. I don't even know what the expected outcome is if you use clut modes on other planes? Since there is no API for setting up plane-specific cluts, the easy out seems to be to just reuse the one-and-only clut for all planes. Otherwise, there is no way at all to change the clut of the other planes. No? Other than that, when I added clut-support for atmel-hlcdc, I updated the hw registers as part of drm_plane_helper_funcs.atomic_update (as requested by Boris Brezillon) while you do it in drm_crtc_helper_funcs.atomic_flush. I don't know which is the better place to do it, but since the hw presumably(?) do have clut registers for each plane (as indicated by the code I removed), the plane-helper .atomic_update seems like a better fit (at least from here). And maybe it doesn't matter, but what do I know? For the record, I know very little about the subsystem. I'm probably wrong in oh so many ways... Cheers, Peter ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3] drm: bridge: synopsys/dw-hdmi: Enable cec clock
Hi, >> On 11/20/2017 06:00 PM, Hans Verkuil wrote: >>> I didn't see this merged for 4.15, is it too late to include this? >>> All other changes needed to get CEC to work on rk3288 and rk3399 are all >>> merged. >> >> Sorry for the late reply. I was out last week. >> >> Dave recently sent the second pull request for 4.15, so I think it would be >> hard to get it >> in the merge window now. We could target it for the 4.15-rcs since it is >> preventing the >> feature from working. Is it possible to rephrase the commit message a bit so >> that it's clear >> that we need it for CEC to work? > > While it is not my patch I would propose something like this: > > "Support the "cec" optional clock. The documentation already mentions "cec" > optional clock and it is used by several boards, but currently the driver > doesn't enable it, thus preventing cec from working on those boards. > > And even worse: a /dev/cecX device will appear for those boards, but it > won't be functioning without configuring this clock." > > I hadn't realized that last sentence until I started thinking about it, > but this patch is really needed. This change looks good to me. Archit, I can send this as a new version of the patch tomorrow if you need it. Regards, ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 08/13] drm/virtio: use simpler remove_conflicting_pci_framebuffers()
Signed-off-by: Michał Mirosław --- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 24 +++- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c index 7df8d0c9026a..115ed546ca4e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c +++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c @@ -28,26 +28,6 @@ #include "virtgpu_drv.h" -static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) -{ - struct apertures_struct *ap; - bool primary; - - ap = alloc_apertures(1); - if (!ap) - return; - - ap->ranges[0].base = pci_resource_start(pci_dev, 0); - ap->ranges[0].size = pci_resource_len(pci_dev, 0); - - primary = pci_dev->resource[PCI_ROM_RESOURCE].flags - & IORESOURCE_ROM_SHADOW; - - drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", primary); - - kfree(ap); -} - int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) { struct drm_device *dev; @@ -69,7 +49,9 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) pname); dev->pdev = pdev; if (vga) - virtio_pci_kick_out_firmware_fb(pdev); + drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, + 0, + "virtiodrmfb"); snprintf(unique, sizeof(unique), "pci:%s", pname); ret = drm_dev_set_unique(dev, unique); -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 12/13] drm/sun4i: use simpler remove_conflicting_framebuffers(NULL)
Use remove_conflicting_framebuffers(NULL) instead of duplicating it. Signed-off-by: Michał Mirosław --- drivers/gpu/drm/sun4i/sun4i_drv.c | 18 +- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 75c76cdd82bc..febc591e9c17 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -66,22 +66,6 @@ static struct drm_driver sun4i_drv_driver = { /* Frame Buffer Operations */ }; -static void sun4i_remove_framebuffers(void) -{ - struct apertures_struct *ap; - - ap = alloc_apertures(1); - if (!ap) - return; - - /* The framebuffer can be located anywhere in RAM */ - ap->ranges[0].base = 0; - ap->ranges[0].size = ~0; - - drm_fb_helper_remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); - kfree(ap); -} - static int sun4i_drv_bind(struct device *dev) { struct drm_device *drm; @@ -123,7 +107,7 @@ static int sun4i_drv_bind(struct device *dev) drm->irq_enabled = true; /* Remove early framebuffers (ie. simplefb) */ - sun4i_remove_framebuffers(); + drm_fb_helper_remove_conflicting_framebuffers(NULL, "sun4i-drm-fb", false); /* Create our framebuffer */ drv->fbdev = sun4i_framebuffer_init(drm); -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4] drm: bridge: synopsys/dw-hdmi: Enable cec clock
Support the "cec" optional clock. The documentation already mentions "cec" optional clock and it is used by several boards, but currently the driver doesn't enable it, thus preventing cec from working on those boards. And even worse: a /dev/cecX device will appear for those boards, but it won't be functioning without configuring this clock. Changes: v4: - Change commit message to stress the importance of this patch v3: - Drop useless braces v2: - Separate ENOENT errors from others - Propagate other errors (especially -EPROBE_DEFER) Signed-off-by: Pierre-Hugues Husson --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bf14214fa464..d82b9747a979 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -138,6 +138,7 @@ struct dw_hdmi { struct device *dev; struct clk *isfr_clk; struct clk *iahb_clk; + struct clk *cec_clk; struct dw_hdmi_i2c *i2c; struct hdmi_data_info hdmi_data; @@ -2382,6 +2383,26 @@ __dw_hdmi_probe(struct platform_device *pdev, goto err_isfr; } + hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec"); + if (PTR_ERR(hdmi->cec_clk) == -ENOENT) { + hdmi->cec_clk = NULL; + } else if (IS_ERR(hdmi->cec_clk)) { + ret = PTR_ERR(hdmi->cec_clk); + if (ret != -EPROBE_DEFER) + dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n", + ret); + + hdmi->cec_clk = NULL; + goto err_iahb; + } else { + ret = clk_prepare_enable(hdmi->cec_clk); + if (ret) { + dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n", + ret); + goto err_iahb; + } + } + /* Product and revision IDs */ hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8) | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0); @@ -2518,6 +2539,8 @@ __dw_hdmi_probe(struct platform_device *pdev, cec_notifier_put(hdmi->cec_notifier); clk_disable_unprepare(hdmi->iahb_clk); + if (hdmi->cec_clk) + clk_disable_unprepare(hdmi->cec_clk); err_isfr: clk_disable_unprepare(hdmi->isfr_clk); err_res: @@ -2541,6 +2564,8 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->isfr_clk); + if (hdmi->cec_clk) + clk_disable_unprepare(hdmi->cec_clk); if (hdmi->i2c) i2c_del_adapter(&hdmi->i2c->adap); -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/13] drm/tegra: kick out simplefb
On Fri, Nov 24, 2017 at 09:50:50PM +0100, Thierry Reding wrote: > On Fri, Nov 24, 2017 at 06:53:34PM +0100, Michał Mirosław wrote: > > Kick out firmware fb when loading tegra driver. > Cool. Can you provide some background on how you tested this? What is > your firmware FB? That'd be useful information to put in the commit > message. Also, nit: "tegra driver" -> "Tegra driver". I checked this on my Asus TF300T, as I use simplefb for initial boot messages. simplefb uses framebuffer set up by the bootloader. Best Regards, Michał Mirosław ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: glxgears on Etnaviv: couldn't get an RGB, Double-buffered visual
Hi Lucas, On Fri, 2017-11-24 at 18:11 +0100, Lucas Stach wrote: > Am Freitag, den 24.11.2017, 16:49 + schrieb Alexey Brodkin: > [...] > > > > > > > > Yes, a "core" in Vivante speak is a GPU with one DMA frontend. A > > > single > > > frontend can feed both 3D and 2D acceleration engines behind it. On > > > i.MX6 the 2D and 3D engine are on separate cores, but Marvell Dove > > > has > > > a combined 2D/3D core. > > > > Hm, that sounds encouraging. The next question would be if Marvel > > Dove is > > supported in Etnaviv DDX? I guess it's called Armada so the answer if > > yes, right? > > Yes, the Dove was the original platform for the Armada X.Org driver. > Combined 2D/3D cores are supported just fine by etnaviv. Sweet! Maybe another question then. To get kmscube working on our board which uses essentially different bit-streamer device "udl" as opposed to "imx-drm" I had just to say: -->8-- export MESA_LOADER_DRIVER_OVERRIDE=imx-drm -->8-- and then all the magic has happened. Will it be a) required b) enough for Vivante X.org driver? > > > > If we happen to not have 2D core if that's a no go for us for > > > > anything? > > > > > > I don't know if the DDX works properly without 2D acceleration. > > > Weston > > > on the other hand only relies on the 3D accel core for doing > > > compositing, so even if you don't have a 2D engine you will be able > > > to > > > launch a modern Linux graphics stack. > > > > That's really cool! I'm much more interested in Weston ATM, which is > > actually another separate question :) > > I tried to find some details on how to run Weston on Wandboard > > but seems like I was looking at wrong Google again... do you > > know any good manuals for doing that? > > There really is no magic to it. Or better there is, but it's all hidden > in the Mesa implementation. > > You need at least Mesa 17.2 and Weston 3.0 for etnaviv to work > properly. Other than that just set XDG_RUNTIME_DIR to something > sensible and launch Weston with "weston --tty=63", done. Cool, will try that! > > > The etnaviv DDX could also emulate 2D accel over the 3D core by > > > using > > > the X.Org glamor module, but no one has bothered to implement this > > > yet. > > > > Ok we'll see if above case (combined cores) is applicable to us and > > then > > we'll see what to do. > > > > > > > > > > > > > In the meantime I'll try to figure out if we have 2D core or not. > > > > > > You can find out what your GPU provides by looking at the feature > > > bits. > > > chipFeatures_PIPE_2D, chipFeatures_PIPE_3D and chipFeatures_PIPE_VG > > > is > > > what you are looking out for. > > > > Does that info helps to decipher these bits? > > Unfortunately we forgot to expose the major feature bits register in > debugfs. It's gpu->identity.features in the kernel driver, the > interesting bits in there are chipFeatures_PIPE_3D and > chipFeatures_PIPE_2D. Noted! Are you going to add that yourself sometime soon or shall I do it? -Alexey ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
glxgears on Etnaviv: couldn't get an RGB, Double-buffered visual
Hello, Being in the middle of bring-up of the new board with Vivante GPU (HSDK namely, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arc/plat-hsdk) I was looking at simple 3D test apps to see how Etnaviv works on the hardware. So far I was able to get kmscube working perfectly fine and the next item I took was glxgears (for some reason I was under impression that's de facto "Hello world" app in the GPU world). But apparently even with Xserver up and running glxgears doesn't work. Moreover I tried the same thing on Wandboard Quad but to no avail as well. That's what I saw: ->8- # glxgears Error: couldn't get an RGB, Double-buffered visual # glxinfo name of display: :0 Error: couldn't find RGB GLX visual or fbconfig ->8- Googling didn't help here unfortunately so maybe some pointers could be suggested here... like what do I do wrong and if glxgears is supposed to work on top of DRM GPU at all? Thanks a lot in advance! -Alexey ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/13] drm/cirrus: use simpler remove_conflicting_pci_framebuffers()
Signed-off-by: Michał Mirosław --- drivers/gpu/drm/cirrus/cirrus_drv.c | 23 +-- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 69c4e352dd78..85ed8657c862 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -42,33 +42,12 @@ static const struct pci_device_id pciidlist[] = { }; -static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - bool primary = false; - - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#endif - drm_fb_helper_remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary); - kfree(ap); - - return 0; -} - static int cirrus_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int ret; - ret = cirrus_kick_out_firmware_fb(pdev); + ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "cirrusdrmfb"); if (ret) return ret; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 13/13] drm/tegra: kick out simplefb
Kick out firmware fb when loading tegra driver. Signed-off-by: Michał Mirosław --- drivers/gpu/drm/tegra/drm.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 943bdf88c4a2..1ec66ae29839 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1239,6 +1239,10 @@ static int host1x_drm_probe(struct host1x_device *dev) dev_set_drvdata(&dev->dev, drm); + err = drm_fb_helper_remove_conflicting_framebuffers(NULL, "tegradrmfb", false); + if (err < 0) + goto unref; + err = drm_dev_register(drm, 0); if (err < 0) goto unref; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 06/13] drm/mgag200: use simpler remove_conflicting_pci_framebuffers()
Remove duplicated call, while at it. Signed-off-by: Michał Mirosław --- drivers/gpu/drm/mgag200/mgag200_drv.c | 21 + drivers/gpu/drm/mgag200/mgag200_main.c | 9 - 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 74cdde2ee474..ac6af4bd9df6 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -42,29 +42,10 @@ static const struct pci_device_id pciidlist[] = { MODULE_DEVICE_TABLE(pci, pciidlist); -static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - bool primary = false; - - ap = alloc_apertures(1); - if (!ap) - return; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#endif - drm_fb_helper_remove_conflicting_framebuffers(ap, "mgag200drmfb", primary); - kfree(ap); -} - static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { - mgag200_kick_out_firmware_fb(pdev); + drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "mgag200drmfb"); return drm_get_pci_dev(pdev, ent, &driver); } diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index 780f983b0294..79d54103d470 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -124,20 +124,11 @@ static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem) static int mga_vram_init(struct mga_device *mdev) { void __iomem *mem; - struct apertures_struct *aper = alloc_apertures(1); - if (!aper) - return -ENOMEM; /* BAR 0 is VRAM */ mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0); mdev->mc.vram_window = pci_resource_len(mdev->dev->pdev, 0); - aper->ranges[0].base = mdev->mc.vram_base; - aper->ranges[0].size = mdev->mc.vram_window; - - drm_fb_helper_remove_conflicting_framebuffers(aper, "mgafb", true); - kfree(aper); - if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, "mgadrmfb_vram")) { DRM_ERROR("can't reserve VRAM\n"); -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: glxgears on Etnaviv: couldn't get an RGB, Double-buffered visual
Hi Lucas, On Fri, 2017-11-24 at 17:11 +0100, Lucas Stach wrote: > Hi Alexey, > > Am Freitag, den 24.11.2017, 16:02 + schrieb Alexey Brodkin: > > > > Hello, > > > > Being in the middle of bring-up of the new board with Vivante GPU (HSDK > > namely, > > see > > https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_torvalds_linux.git_tree_arch_arc_plat-2Dhsdk&d=Dw > > IDaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=ZXa-564Jm43PXsqGXCf2US2DY7C0qIlCw6c56pL- > > bLY&s=ZJSI1u6GgsRHNIcONVFfIKvn1AWaB38GmtCN1dGB3w0&e=) > > I was looking at simple 3D test apps to see how Etnaviv works on the > > hardware. > > > > So far I was able to get kmscube working perfectly fine and the next item I > > took > > was glxgears (for some reason I was under impression that's de facto "Hello > > world" app > > in the GPU world). But apparently even with Xserver up and running glxgears > > doesn't work. > > > > Moreover I tried the same thing on Wandboard Quad but to no avail as well. > > That's what I saw: > > ->8- > > # glxgears > > Error: couldn't get an RGB, Double-buffered visual > > > > # glxinfo > > name of display: :0 > > Error: couldn't find RGB GLX visual or fbconfig > > ->8- > > > > Googling didn't help here unfortunately so maybe some pointers could be > > suggested here... like what do I do wrong and if glxgears is supposed to > > work on top of DRM GPU at all? > > > > Thanks a lot in advance! > > For 3D acceleration to work under X you need the etnaviv specific DDX > driver, which can be found here: > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.arm.linux.org.uk_cgit_xf86-2Dvideo-2Darmada.git_log_-3Fh-3Dunstable-2Ddevel&d=DwIDaQ&c=DPL6_ > X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=ZXa-564Jm43PXsqGXCf2US2DY7C0qIlCw6c56pL- > bLY&s=ZzK2fxA6_XlN6pGnf2Tpo6qKzzQh76ocWZ6IDR-WPtc&e= Thanks for the pointer, still a couple of questions below... > Don't let you get confused by the name, the armada driver implements > support for both armada drm and imx-drm and the etnaviv DDX. This > provides 2D acceleration on the Vivante 2D cores, as well a the DRI2/3 > bit necessary to get a 3D context on X. From Wandboard's .dts I see that 2D core is a separate node with separate set of registers mapped at a different location in memory, right? Do you know if that's possible if the same one memory-mapped register set controls both 3D and 2D engine? If we happen to not have 2D core if that's a no go for us for anything? Like no compositing whatsoever etc? In the meantime I'll try to figure out if we have 2D core or not. -Alexey ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: glxgears on Etnaviv: couldn't get an RGB, Double-buffered visual
Hi Lucas, On Fri, 2017-11-24 at 17:38 +0100, Lucas Stach wrote: > Am Freitag, den 24.11.2017, 16:25 + schrieb Alexey Brodkin: > > > > Hi Lucas, > > > > On Fri, 2017-11-24 at 17:11 +0100, Lucas Stach wrote: > > > > > > Hi Alexey, > > > > > > Am Freitag, den 24.11.2017, 16:02 + schrieb Alexey Brodkin: > > > > > > > > > > > > Hello, > > > > > > > > Being in the middle of bring-up of the new board with Vivante GPU (HSDK > > > > namely, > > > > see > > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_torvalds_linux.git_tree_arch_arc_plat-2Dhsdk&; > > > > d=Dw > > > > IDaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=ZXa-564Jm43PXsqGXCf2US2DY7C0qIlCw6c56pL- > > > > bLY&s=ZJSI1u6GgsRHNIcONVFfIKvn1AWaB38GmtCN1dGB3w0&e=) > > > > I was looking at simple 3D test apps to see how Etnaviv works on the > > > > hardware. > > > > > > > > So far I was able to get kmscube working perfectly fine and the next > > > > item I took > > > > was glxgears (for some reason I was under impression that's de facto > > > > "Hello world" app > > > > in the GPU world). But apparently even with Xserver up and running > > > > glxgears doesn't work. > > > > > > > > Moreover I tried the same thing on Wandboard Quad but to no avail as > > > > well. > > > > That's what I saw: > > > > ->8- > > > > # glxgears > > > > Error: couldn't get an RGB, Double-buffered visual > > > > > > > > # glxinfo > > > > name of display: :0 > > > > Error: couldn't find RGB GLX visual or fbconfig > > > > ->8- > > > > > > > > Googling didn't help here unfortunately so maybe some pointers could be > > > > suggested here... like what do I do wrong and if glxgears is supposed to > > > > work on top of DRM GPU at all? > > > > > > > > Thanks a lot in advance! > > > > > > For 3D acceleration to work under X you need the etnaviv specific DDX > > > driver, which can be found here: > > > > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.arm.linux.org.uk_cgit_xf86-2Dvideo-2Darmada.git_log_-3Fh-3Dunstable-2Ddevel&d=DwIDaQ&c=D > > > PL6_ > > > X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=ZXa-564Jm43PXsqGXCf2US2DY7C0qIlCw6c56pL- > > > bLY&s=ZzK2fxA6_XlN6pGnf2Tpo6qKzzQh76ocWZ6IDR-WPtc&e= > > > > Thanks for the pointer, still a couple of questions below... > > > > > > > > Don't let you get confused by the name, the armada driver implements > > > support for both armada drm and imx-drm and the etnaviv DDX. This > > > provides 2D acceleration on the Vivante 2D cores, as well a the DRI2/3 > > > bit necessary to get a 3D context on X. > > > > From Wandboard's .dts I see that 2D core is a separate node with separate > > set of registers mapped at a different location in memory, right? > > > > Do you know if that's possible if the same one memory-mapped register set > > controls both 3D and 2D engine? > > Yes, a "core" in Vivante speak is a GPU with one DMA frontend. A single > frontend can feed both 3D and 2D acceleration engines behind it. On > i.MX6 the 2D and 3D engine are on separate cores, but Marvell Dove has > a combined 2D/3D core. Hm, that sounds encouraging. The next question would be if Marvel Dove is supported in Etnaviv DDX? I guess it's called Armada so the answer if yes, right? > > If we happen to not have 2D core if that's a no go for us for anything? > > I don't know if the DDX works properly without 2D acceleration. Weston > on the other hand only relies on the 3D accel core for doing > compositing, so even if you don't have a 2D engine you will be able to > launch a modern Linux graphics stack. That's really cool! I'm much more interested in Weston ATM, which is actually another separate question :) I tried to find some details on how to run Weston on Wandboard but seems like I was looking at wrong Google again... do you know any good manuals for doing that? > > The etnaviv DDX could also emulate 2D accel over the 3D core by using > the X.Org glamor module, but no one has bothered to implement this yet. Ok we'll see if above case (combined cores) is applicable to us and then we'll see what to do. > > In the meantime I'll try to figure out if we have 2D core or not. > > You can find out what your GPU provides by looking at the feature bits. > chipFeatures_PIPE_2D, chipFeatures_PIPE_3D and chipFeatures_PIPE_VG is > what you are looking out for. Does that info helps to decipher these bits? -->8-- # dmesg | grep etnaviv etnaviv soc:gpu-subsystem: bound f009.gpu (ops 0x9075271c) etnaviv-gpu f009.gpu: model: GC880, revision: 5124 [drm] Initialized etnaviv 1.1.0 20151214 for soc:gpu-subsystem on minor 0 # cat /sys/kernel/debug/dri/0/gpu f009.gpu Status: features minor_features0: 0x41f99efb minor_features1: 0xfefbf2d9 minor_features2: 0x4a
[PATCH 09/13] staging: sm750fb: use simpler remove_conflicting_pci_framebuffers()
Signed-off-by: Michał Mirosław --- drivers/staging/sm750fb/sm750.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 67207b0554cd..0590fc45c493 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1053,26 +1053,6 @@ static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx) return err; } -static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - bool primary = false; - - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & - IORESOURCE_ROM_SHADOW; -#endif - remove_conflicting_framebuffers(ap, "sm750_fb1", primary); - kfree(ap); - return 0; -} - static int lynxfb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -1081,7 +1061,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, int fbidx; int err; - err = lynxfb_kick_out_firmware_fb(pdev); + err = remove_conflicting_pci_framebuffers(pdev, 0, "sm750_fb1"); if (err) return err; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 00/13] remove_conflicting_framebuffers() cleanup
This series cleans up duplicated code for replacing firmware FB driver with proper DRI driver and adds handover support to Tegra driver. The last patch is here because it uses new semantics of remove_conflicting_framebuffers() from this series. This can be considered independently, though. --- Michał Mirosław (13): fbdev: show fbdev number for debugging fbdev: add remove_conflicting_pci_framebuffers() drm/amdgpu: use simpler remove_conflicting_pci_framebuffers() drm/bochs: use simpler remove_conflicting_pci_framebuffers() drm/cirrus: use simpler remove_conflicting_pci_framebuffers() drm/mgag200: use simpler remove_conflicting_pci_framebuffers() drm/radeon: use simpler remove_conflicting_pci_framebuffers() drm/virtio: use simpler remove_conflicting_pci_framebuffers() staging: sm750fb: use simpler remove_conflicting_pci_framebuffers() fbdev: allow apertures == NULL in remove_conflicting_framebuffers() drm/vc4: use simpler remove_conflicting_framebuffers(NULL) drm/sun4i: use simpler remove_conflicting_framebuffers(NULL) drm/tegra: kick out simplefb drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 23 +- drivers/gpu/drm/bochs/bochs_drv.c| 18 +- drivers/gpu/drm/cirrus/cirrus_drv.c | 23 +- drivers/gpu/drm/mgag200/mgag200_drv.c| 21 + drivers/gpu/drm/mgag200/mgag200_main.c | 9 --- drivers/gpu/drm/radeon/radeon_drv.c | 23 +- drivers/gpu/drm/sun4i/sun4i_drv.c| 18 +- drivers/gpu/drm/tegra/drm.c | 4 drivers/gpu/drm/vc4/vc4_drv.c| 20 +--- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 24 +++ drivers/staging/sm750fb/sm750.c | 22 +- drivers/video/fbdev/core/fbmem.c | 40 ++-- include/drm/drm_fb_helper.h | 12 ++ include/linux/fb.h | 2 ++ 14 files changed, 67 insertions(+), 192 deletions(-) -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 10/13] fbdev: allow apertures == NULL in remove_conflicting_framebuffers()
Interpret (otherwise-invalid) NULL apertures argument to mean all-memory range. This will allow to remove several duplicates of this code from drivers in following patches. Signed-off-by: Michał Mirosław --- drivers/video/fbdev/core/fbmem.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 5ea980e5d3b7..927e016487e9 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1780,11 +1780,25 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary) { int ret; + bool do_free = false; + + if (!a) { + a = alloc_apertures(1); + if (!a) + return -ENOMEM; + + a->ranges[0].base = 0; + a->ranges[0].size = ~0; + do_free = true; + } mutex_lock(®istration_lock); ret = do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); + if (do_free) + kfree(a); + return ret; } EXPORT_SYMBOL(remove_conflicting_framebuffers); -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: RFC: page-flip with damage?
On 09/26/2017 10:18 AM, Daniel Vetter wrote: On Sun, Sep 24, 2017 at 07:41:45PM +0200, Thomas Hellstrom wrote: Hi, list! Page flips, while efficient on real hardware, aren't that efficient in other situations, like for virtual devices with local, or even worse, remote desktops. We might ending up forwarding or encoding a couple of full frames worth of data instead of a small region at a cursor blink. Now there is this extension EGL_KHR_swap_buffers_with_damage, and gnome-shell/wayland on KMS also has a damage region that it forwards all the way down to the function where page-flip is called. So I'd like to start looking at page-flips with damage, meaning that the damage is an optional hint to the device about what part of the contents is actually updated. What would be the best way to implement this? I figure this can be done within the atomic context with a region attached to the plane state? Would we want to follow the EGL extension and forward an array of rects or for simplicity use a single bounding box? Both these options would be a great win. So my rough plan for all this was: - Add damage to drm_crtc_state, in screen coordinates. I think this is the most natural place for this, since it's what PSR/manual upload DSI want. It should also fit well for udl and tinydrm. Virtual drivers like vmwgfx might need helpers to wrap this back to framebuffer rectangles, but that seems the odd case out - the framebuffer-based approach in the DIRTY_IOCTL forces most drivers to do a fancy lookup from fb to the crtc. Per-plane dirty rectangle seems to be an awkward in-betwen state, with all the confusion about whether it's pre/post scaled and how to best combine them. And then someone changes the background color of the crtc (or something like that), what happens then? I think pushing all that onto userspace is best, it can always ask for a complete flip if it's unclear whether it damaged the entire screen or not. Actually, after looking into this a bit in the context of remoting, I think I will have to disagree. The most natural place for damage appears to be the drm_plane state, in plane fb coordinates. The reason for this is that devices with hardware planes will want to have the coordinates in this way. Think cursor, Video overlay. Currently with vmwgfx and atomic we need to send the cursor image down the device pipeline on each cursor move which is pretty nasty. Same thing holds for video overlay if we decide to move it to atomic. The overlay engine wants to know what part of the source image has changed. Damage is triggered by a content change and the change lives in the framebuffer, and this is easier on user-space as well. Now for software plane compositing, you might be hitting the problems you describe above. But if you're doing software plane compositing in your drm driver (which you probably aren't), you'd have enough information anyway to handle both the odd case of background color change and any scaling if present (god forbid). Thanks, Thomas ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Regression in TTM driver w/Linus' master
On 11/24/17 4:35 PM, Christian König wrote: Am 24.11.2017 um 16:17 schrieb Tobias Klausmann: On 11/24/17 3:54 PM, Daniel Vetter wrote: On Thu, Nov 23, 2017 at 03:24:38PM +0100, Tobias Klausmann wrote: On 11/23/17 2:58 AM, Dave Airlie wrote: On 23 November 2017 at 11:17, Laura Abbott wrote: Hi, Fedora QA testing reported a panic when booting up VMs using qmeu vga drivers (https://paste.fedoraproject.org/paste/498yRWTCJv2LKIrmj4EliQ) [ 30.108507] [ cut here ] [ 30.108920] kernel BUG at ./include/linux/gfp.h:408! [ 30.109356] invalid opcode: [#1] SMP [ 30.109700] Modules linked in: fuse nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack devlink ip_set nfnetlink ebtable_nat ebtable_broute bridge ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables snd_hda_codec_generic kvm_intel kvm snd_hda_intel snd_hda_codec irqbypass ppdev snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm bochs_drm ttm joydev drm_kms_helper virtio_balloon snd_timer snd parport_pc drm soundcore parport i2c_piix4 nls_utf8 isofs squashfs zstd_decompress xxhash 8021q garp mrp stp llc virtio_net [ 30.115605] virtio_console virtio_scsi crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel serio_raw virtio_pci virtio_ring virtio ata_generic pata_acpi qemu_fw_cfg sunrpc scsi_transport_iscsi loop [ 30.117425] CPU: 0 PID: 1347 Comm: gnome-shell Not tainted 4.15.0-0.rc0.git6.1.fc28.x86_64 #1 [ 30.118141] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-2.fc27 04/01/2014 [ 30.118866] task: 923a77e03380 task.stack: a78182228000 [ 30.119366] RIP: 0010:__alloc_pages_nodemask+0x35e/0x430 [ 30.119810] RSP: :a7818222bba8 EFLAGS: 00010202 [ 30.120250] RAX: 0001 RBX: 014382c6 RCX: 0006 [ 30.120840] RDX: RSI: 0009 RDI: [ 30.121443] RBP: 923a760d6000 R08: R09: 0006 [ 30.122039] R10: 0040 R11: 0300 R12: 923a729273c0 [ 30.122629] R13: R14: R15: 923a7483d400 [ 30.123223] FS: 7fe48da7dac0() GS:923a7cc0() knlGS: [ 30.123896] CS: 0010 DS: ES: CR0: 80050033 [ 30.124373] CR2: 7fe457b73000 CR3: 78313000 CR4: 06f0 [ 30.124968] Call Trace: [ 30.125186] ttm_pool_populate+0x19b/0x400 [ttm] [ 30.125578] ttm_bo_vm_fault+0x325/0x570 [ttm] [ 30.125964] __do_fault+0x19/0x11e [ 30.126255] __handle_mm_fault+0xcd3/0x1260 [ 30.126609] handle_mm_fault+0x14c/0x310 [ 30.126947] __do_page_fault+0x28c/0x530 [ 30.127282] do_page_fault+0x32/0x270 [ 30.127593] async_page_fault+0x22/0x30 [ 30.127922] RIP: 0033:0x7fe48aae39a8 [ 30.128225] RSP: 002b:7ffc21c4d928 EFLAGS: 00010206 [ 30.128664] RAX: 7fe457b73000 RBX: 55cd4c1041a0 RCX: 7fe457b73040 [ 30.129259] RDX: 0030 RSI: RDI: 7fe457b73000 [ 30.129855] RBP: 0300 R08: 000c R09: 0001 [ 30.130457] R10: 0001 R11: 0246 R12: 55cd4c1041a0 [ 30.131054] R13: 55cd4bdfe990 R14: 55cd4c104110 R15: 0400 [ 30.131648] Code: 11 01 00 0f 84 a9 00 00 00 65 ff 0d 6d cc dd 44 e9 0f ff ff ff 40 80 cd 80 e9 99 fe ff ff 48 89 c7 e8 e7 f6 01 00 e9 b7 fe ff ff <0f> 0b 0f ff e9 40 fd ff ff 65 48 8b 04 25 80 d5 00 00 8b 40 4c [ 30.133245] RIP: __alloc_pages_nodemask+0x35e/0x430 RSP: a7818222bba8 [ 30.133836] ---[ end trace d4f1deb60784f40a ]--- This is based off of Linus' master branch at c8a0739b185d11d6e2ca7ad9f5835841d1cfc765 Configs are at https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/commit/?h=rawhide&id=0be14662c54f49b4e640868b9d67df18d39edff0 Looks like a TTM regression due to: 0284f1ead87463bc17cf5e81a24fc65c052486f3 drm/ttm: add transparent huge page support for cached allocations v2 If the driver requests dma32 pages, we can end up trying to alloc huge dma32 pages which triggers the oops. The bochs driver always requests dma32 here. I'll send a rough patch once I boot it. Dave. Hi Dave, fyi only: It looks like this is not the only regression in this cycle with ttm, novueau seems to suffer as well [1]. Adding ttm folks. Might be useful if we have an entry for ttm in MAINTAINERS ... -Daniel A bit more of investigation for the nouveau regression: This only show when Transparent Hugepages (CONFIG_TRANSPARENT_HUGEPAGE) are enable. Thanks Dave for pointing me to that! Yeah, sorry for that. I missed to handle the DMA32 case with transparent huge page support. Dav
[PATCH 07/13] drm/radeon: use simpler remove_conflicting_pci_framebuffers()
Signed-off-by: Michał Mirosław --- drivers/gpu/drm/radeon/radeon_drv.c | 23 +-- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 31dd04f6baa1..49f51b17ae81 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -311,27 +311,6 @@ static struct drm_driver kms_driver; bool radeon_device_is_virtual(void); -static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - bool primary = false; - - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#endif - drm_fb_helper_remove_conflicting_framebuffers(ap, "radeondrmfb", primary); - kfree(ap); - - return 0; -} - static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -341,7 +320,7 @@ static int radeon_pci_probe(struct pci_dev *pdev, return -EPROBE_DEFER; /* Get rid of things like offb */ - ret = radeon_kick_out_firmware_fb(pdev); + ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "radeondrmfb"); if (ret) return ret; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/sun4i: use sun4i_tcon_of_table to check if a device node is a TCON
The sun4i DRM driver maintains a list of compatible strings it uses to check if a device node within the display component graph is a TCON. The TCON driver also has this list, used to bind the TCON driver to the device. These two lists are identical. Instead of maintaining two identical lists, export the list from the TCON driver for the DRM driver to use. Suggested-by: Rob Herring Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_drv.c | 8 +--- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 +++- drivers/gpu/drm/sun4i/sun4i_tcon.h | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 75c76cdd82bc..49215d91c853 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -187,13 +187,7 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node) static bool sun4i_drv_node_is_tcon(struct device_node *node) { - return of_device_is_compatible(node, "allwinner,sun4i-a10-tcon") || - of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") || - of_device_is_compatible(node, "allwinner,sun6i-a31-tcon") || - of_device_is_compatible(node, "allwinner,sun6i-a31s-tcon") || - of_device_is_compatible(node, "allwinner,sun7i-a20-tcon") || - of_device_is_compatible(node, "allwinner,sun8i-a33-tcon") || - of_device_is_compatible(node, "allwinner,sun8i-v3s-tcon"); + return !!of_match_node(sun4i_tcon_of_table, node); } static int compare_of(struct device *dev, void *data) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e122f5b2a395..a1ed462c2430 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -900,7 +900,8 @@ static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { /* nothing is supported */ }; -static const struct of_device_id sun4i_tcon_of_table[] = { +/* sun4i_drv uses this list to check if a device node is a TCON */ +const struct of_device_id sun4i_tcon_of_table[] = { { .compatible = "allwinner,sun4i-a10-tcon", .data = &sun4i_a10_quirks }, { .compatible = "allwinner,sun5i-a13-tcon", .data = &sun5i_a13_quirks }, { .compatible = "allwinner,sun6i-a31-tcon", .data = &sun6i_a31_quirks }, @@ -911,6 +912,7 @@ static const struct of_device_id sun4i_tcon_of_table[] = { { } }; MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table); +EXPORT_SYMBOL(sun4i_tcon_of_table); static struct platform_driver sun4i_tcon_platform_driver = { .probe = sun4i_tcon_probe, diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index f61bf6d83b4a..839266a38505 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -197,4 +197,6 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon, void sun4i_tcon_set_status(struct sun4i_tcon *crtc, const struct drm_encoder *encoder, bool enable); +extern const struct of_device_id sun4i_tcon_of_table[]; + #endif /* __SUN4I_TCON_H__ */ -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: PROBLEM: Asus C201 video mode problems on HDMI hotplug (regression)
Hi Archit, Thank you for handling this, and sorry for missing the original bug report (and for breaking this in the first place). On Monday, 27 November 2017 06:05:03 EET Archit Taneja wrote: > On 11/16/2017 11:58 AM, Nick Bowler wrote: > > On 2017-11-05 11:41 -0500, Nick Bowler wrote: > >> On 2017-11-02, Nick Bowler wrote: > >>> ~50% of the time after a hotplug, there is a vertical pink bar on the > >>> left of the display area and audio is not working at all. According to > >>> the sink device the display size is 1282x720 which seems pretty wrong > >>> (normal and working situation is 1280x720). > >>> > >>> I posted photos of non-working versus working states here: > >>>https://imgur.com/a/qhAZG > >>> > >>> Unplugging and plugging the cable again will correct the issue (it seems > >>> to, for the most part, alternate between working and not-working states, > >>> although not always). It always works on power up with the cable > >>> initially connected. > >>> > >>> This is a regression from 4.11, where hotplug works perfectly every > >>> time. > >> > >> Bisection implicates the following commit: > >> > >> 181e0ef092a4952aa523c5b9cb21394cf43bcd46 is the first bad commit > >> commit 181e0ef092a4952aa523c5b9cb21394cf43bcd46 > >> Author: Laurent Pinchart > >> Date: Mon Mar 6 01:35:57 2017 +0200 > >> > >> drm: bridge: dw-hdmi: Fix the PHY power up sequence > >> > >> When powering the PHY up we need to wait for the PLL to lock. This > >> is done by polling the TX_PHY_LOCK bit in the HDMI_PHY_STAT0 > >> register (interrupt-based wait could be implemented as well but is > >> likely overkill). The bit is asserted when the PLL locks, but the > >> current code incorrectly waits for the bit to be deasserted. Fix it, > >> and while at it, replace the udelay() with a sleep as the code never > >> runs in non-sleepable context. > >> > >> To be consistent with the power down implementation move the poll > >> loop to the power off function. > > The two main things the commit below does it to a) correctly wait on the > TX_PHY_LOCK bit to be asserted and b) use usleep_range() instead of > udelay(). Another difference is that the PWDN and TMDS signals, in theory needed for Gen1 PHYs only, are not set anymore for Gen2 PHYs. Nick, could you test the following change to see if it makes a difference ? diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/ bridge/synopsys/dw-hdmi.c index b172139502d6..1c18ff1bf24a 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1104,14 +1104,14 @@ static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi) unsigned int i; u8 val; - if (phy->gen == 1) { - dw_hdmi_phy_enable_powerdown(hdmi, false); + dw_hdmi_phy_enable_powerdown(hdmi, false); - /* Toggle TMDS enable. */ - dw_hdmi_phy_enable_tmds(hdmi, 0); - dw_hdmi_phy_enable_tmds(hdmi, 1); + /* Toggle TMDS enable. */ + dw_hdmi_phy_enable_tmds(hdmi, 0); + dw_hdmi_phy_enable_tmds(hdmi, 1); + + if (phy->gen == 1) return 0; - } dw_hdmi_phy_gen2_txpwron(hdmi, 1); dw_hdmi_phy_gen2_pddq(hdmi, 0); > I don't see (b) being a problem. About (a), it's possible that the bit above > is interpreted differently on a rockchip SoC versus a renesas chip. Could > you print the value of HDMI_PHY_STAT0 that's read back? The driver should print a "PHY PLL failed to lock" error message to the kernel log in that case. Nick, does that happen on your system ? > If the code returns an -ETIMEDOUT, hdmi->phy.ops->init() will return an > -ETIMEDOUT. This will cause dw_hdmi_setup() to bail out early, before we > get a chance to configure the AVI infoframe and other stuff. I've seen > other HDMI HW throwing up pink strips if the AVI infoframe stuff isn't > configured properly. > > As an experiment, could you forcefully return 0 instead of -ETIMEDOUT and > see if things return back to normal? -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] video: fsl-diu-fb: Delete an error message for a failed memory allocation in fsl_diu_init()
From: Markus Elfring Date: Mon, 27 Nov 2017 09:56:09 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/fsl-diu-fb.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index 25abbcf38913..1bfd13cbd4e3 100644 --- a/drivers/video/fbdev/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c @@ -1960,12 +1960,8 @@ static int __init fsl_diu_init(void) of_node_put(np); coherence_data = vmalloc(coherence_data_size); - if (!coherence_data) { - pr_err("fsl-diu-fb: could not allocate coherence data " - "(size=%zu)\n", coherence_data_size); + if (!coherence_data) return -ENOMEM; - } - #endif ret = platform_driver_register(&fsl_diu_driver); -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] video: fb_ddc: Delete an error message for a failed memory allocation in fb_do_probe_ddc_edid()
From: Markus Elfring Date: Mon, 27 Nov 2017 10:12:26 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/core/fb_ddc.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fb_ddc.c b/drivers/video/fbdev/core/fb_ddc.c index 8bf5f2f54be7..256b518d1db9 100644 --- a/drivers/video/fbdev/core/fb_ddc.c +++ b/drivers/video/fbdev/core/fb_ddc.c @@ -37,11 +37,8 @@ static unsigned char *fb_do_probe_ddc_edid(struct i2c_adapter *adapter) } }; - if (!buf) { - dev_warn(&adapter->dev, "unable to allocate memory for EDID " -"block.\n"); + if (!buf) return NULL; - } if (i2c_transfer(adapter, msgs, 2) == 2) return buf; -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103924] [CI] igt@perf_pmu@other-* - fail - Test assertion failure function read_other - Failed assertion: fd >= 0
https://bugs.freedesktop.org/show_bug.cgi?id=103924 Chris Wilson changed: What|Removed |Added Resolution|--- |FIXED QA Contact|intel-gfx-bugs@lists.freede | |sktop.org | Component|DRM/Intel |IGT Status|NEW |RESOLVED Assignee|intel-gfx-bugs@lists.freede |dri-devel@lists.freedesktop |sktop.org |.org --- Comment #2 from Chris Wilson --- commit 4c57ff468fa4870184b3da56432602f967af (upstream/master, origin/master, origin/HEAD) Author: Tvrtko Ursulin Date: Fri Nov 24 17:16:18 2017 + intel/pmu: Catch-up with i915 RC6 aggregation changes Since i915 PMU is removing separate RC6 counters and now aggregates all under a single one, catch up the test and intel-gpu-overlay with those changes. Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson Signed-off-by: Chris Wilson -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] video: adv7393fb: Delete two error messages for a failed memory allocation in bfin_adv7393_fb_probe()
From: Markus Elfring Date: Mon, 27 Nov 2017 10:33:19 +0100 Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/bfin_adv7393fb.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c index 542ffaddc6ab..aed6b934f009 100644 --- a/drivers/video/fbdev/bfin_adv7393fb.c +++ b/drivers/video/fbdev/bfin_adv7393fb.c @@ -389,10 +389,8 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, } fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); - if (!fbdev) { - dev_err(&client->dev, "failed to allocate device private record"); + if (!fbdev) return -ENOMEM; - } i2c_set_clientdata(client, fbdev); @@ -461,7 +459,6 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, fbdev->info.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); if (!fbdev->info.pseudo_palette) { - dev_err(&client->dev, "failed to allocate pseudo_palette\n"); ret = -ENOMEM; goto free_fb_mem; } -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/2] drm/tegra: Sanitize format modifiers
From: Thierry Reding Hi, This series is preparatory work in order to enable format modifiers on both Tegra and Nouveau drivers to allow drivers to exchange tiling mode information. I also have the corresponding libdrm changes that I can send out as soon as these patches have been merged. Technically this breaks ABI, but these modifiers are not used anywhere yet, except in libdrm's modetest where they are used to decode the IN_FORMATS property. However, the Tegra DRM driver doesn't implement the ->format_mod_supported() callback yet, so the modifiers are never actually exposed. I had discussed this with Daniel Vetter a little while back and he thought this was okay. As suggested by him, I renamed the modifier definitions for good measure to avoid clashing with the old definitions in case they are used in test code somewhere. Thierry Thierry Reding (2): drm/fourcc: Fix fourcc_mod_code() definition drm/tegra: Sanitize format modifiers drivers/gpu/drm/tegra/fb.c| 35 +-- include/uapi/drm/drm_fourcc.h | 38 -- 2 files changed, 49 insertions(+), 24 deletions(-) -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/2] drm/fourcc: Fix fourcc_mod_code() definition
From: Thierry Reding Avoid compiler warnings when the val parameter is an expression. Signed-off-by: Thierry Reding --- include/uapi/drm/drm_fourcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 3ad838d3f93f..a76ed8f9e383 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -188,7 +188,7 @@ extern "C" { #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) #define fourcc_mod_code(vendor, val) \ - __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffULL)) + __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffULL)) /* * Format Modifier tokens: -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/2] drm/tegra: Sanitize format modifiers
From: Thierry Reding The existing format modifier definitions were merged prematurely, and recent work has unveiled that the definitions are suboptimal in several ways: - The format specifiers, except for one, are not Tegra specific, but the names don't reflect that. - The number space is split into two, reserving 32 bits for some "parameter" which most of the modifiers are not going to have. - Symbolic names for the modifiers are not using the standard DRM_FORMAT_MOD_* prefix, which makes them awkward to use. - The vendor prefix NV is somewhat ambiguous. Fortunately, nobody's started using these modifiers, so we can still fix the above issues. Do so by using the standard prefix. Also, remove TEGRA from the name of those modifiers that exist on NVIDIA GPUs as well. In case of the block linear modifiers, make the "parameter" smaller (4 bits, though only 6 values are valid) and don't let that leak into any of the other modifiers. Finally, also use the more canonical NVIDIA instead of the ambiguous NV prefix. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/fb.c| 35 +-- include/uapi/drm/drm_fourcc.h | 36 +++- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 80540c1c66dc..406e895d82cc 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -54,17 +54,40 @@ int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, struct tegra_fb *fb = to_tegra_fb(framebuffer); uint64_t modifier = fb->base.modifier; - switch (fourcc_mod_tegra_mod(modifier)) { - case NV_FORMAT_MOD_TEGRA_TILED: + switch (modifier) { + case DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED: tiling->mode = TEGRA_BO_TILING_MODE_TILED; tiling->value = 0; break; - case NV_FORMAT_MOD_TEGRA_16BX2_BLOCK(0): + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(0): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; - tiling->value = fourcc_mod_tegra_param(modifier); - if (tiling->value > 5) - return -EINVAL; + tiling->value = 0; + break; + + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(1): + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; + tiling->value = 1; + break; + + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(2): + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; + tiling->value = 2; + break; + + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(3): + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; + tiling->value = 3; + break; + + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(4): + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; + tiling->value = 4; + break; + + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(5): + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; + tiling->value = 5; break; default: diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index a76ed8f9e383..e04613d30a13 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -178,7 +178,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NONE0 #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 -#define DRM_FORMAT_MOD_VENDOR_NV 0x03 +#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM0x05 #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 @@ -338,29 +338,17 @@ extern "C" { */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) -/* NVIDIA Tegra frame buffer modifiers */ - -/* - * Some modifiers take parameters, for example the number of vertical GOBs in - * a block. Reserve the lower 32 bits for parameters - */ -#define __fourcc_mod_tegra_mode_shift 32 -#define fourcc_mod_tegra_code(val, params) \ - fourcc_mod_code(NV, __u64)val) << __fourcc_mod_tegra_mode_shift) | params)) -#define fourcc_mod_tegra_mod(m) \ - (m & ~((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) -#define fourcc_mod_tegra_param(m) \ - (m & ((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) +/* NVIDIA frame buffer modifiers */ /* * Tegra Tiled Layout, used by Tegra 2, 3 and 4. * * Pixels are arranged in simple tiles of 16 x 16 bytes. */ -#define NV_FORMAT_MOD_TEGRA_TILED fourcc_mod_tegra_code(1, 0) +#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) /* - * Tegra 16Bx2 Block Linear layout, used by TK1/TX1 + * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later * * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked * vertically by a power of 2 (1 to 32 GOBs) to form a block. @@ -380,7 +368,21 @@ e
[GIT PULL v2] hdlcd: fixes for drm-next
On Fri, Nov 24, 2017 at 04:10:14PM +, Liviu Dudau wrote: Hi Dave, I've managed to push one of the patches without my Signed-off-by, Stephen caught that, so I'm sending a v2. Cleaning up the backlog of patches that I have in my tree, they have all been baking in linux-next for weeks. Minor fixes that could be sent as late -rc but I'm not in any rush, so queueing them for v4.16 is fine. Many thanks, Liviu The following changes since commit c209101fc1c91a318422733a3721ff6a9ff7899f: Merge tag 'drm-misc-fixes-2017-11-20' of git://anongit.freedesktop.org/drm/drm-misc into drm-next (2017-11-24 11:33:29 +1000) are available in the Git repository at: git://linux-arm.org/linux-ld.git for-upstream/hdlcd for you to fetch changes up to f73e8b82531573a198a4d0e5bff0d3256cbbd1d8: drm/arm: Replace instances of drm_dev_unref with drm_dev_put. (2017-11-27 09:51:42 +) Liviu Dudau (1): drm: hdlcd: Update PM code to save/restore console. Srishti Sharma (1): drm/arm: Replace instances of drm_dev_unref with drm_dev_put. Vitor Massaru Iha (1): drm: Fix checkpatch issue: "WARNING: braces {} are not necessary for single statement blocks." drivers/gpu/drm/arm/hdlcd_crtc.c | 3 +-- drivers/gpu/drm/arm/hdlcd_drv.c | 9 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) -- | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --- ¯\_(ツ)_/¯ ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: RFC: page-flip with damage?
On 11/27/2017 09:25 AM, Daniel Vetter wrote: On Mon, Nov 27, 2017 at 09:03:22AM +0100, Thomas Hellstrom wrote: On 09/26/2017 10:18 AM, Daniel Vetter wrote: On Sun, Sep 24, 2017 at 07:41:45PM +0200, Thomas Hellstrom wrote: Hi, list! Page flips, while efficient on real hardware, aren't that efficient in other situations, like for virtual devices with local, or even worse, remote desktops. We might ending up forwarding or encoding a couple of full frames worth of data instead of a small region at a cursor blink. Now there is this extension EGL_KHR_swap_buffers_with_damage, and gnome-shell/wayland on KMS also has a damage region that it forwards all the way down to the function where page-flip is called. So I'd like to start looking at page-flips with damage, meaning that the damage is an optional hint to the device about what part of the contents is actually updated. What would be the best way to implement this? I figure this can be done within the atomic context with a region attached to the plane state? Would we want to follow the EGL extension and forward an array of rects or for simplicity use a single bounding box? Both these options would be a great win. So my rough plan for all this was: - Add damage to drm_crtc_state, in screen coordinates. I think this is the most natural place for this, since it's what PSR/manual upload DSI want. It should also fit well for udl and tinydrm. Virtual drivers like vmwgfx might need helpers to wrap this back to framebuffer rectangles, but that seems the odd case out - the framebuffer-based approach in the DIRTY_IOCTL forces most drivers to do a fancy lookup from fb to the crtc. Per-plane dirty rectangle seems to be an awkward in-betwen state, with all the confusion about whether it's pre/post scaled and how to best combine them. And then someone changes the background color of the crtc (or something like that), what happens then? I think pushing all that onto userspace is best, it can always ask for a complete flip if it's unclear whether it damaged the entire screen or not. Actually, after looking into this a bit in the context of remoting, I think I will have to disagree. The most natural place for damage appears to be the drm_plane state, in plane fb coordinates. The reason for this is that devices with hardware planes will want to have the coordinates in this way. Think cursor, Video overlay. Currently with vmwgfx and atomic we need to send the cursor image down the device pipeline on each cursor move which is pretty nasty. Same thing holds for video overlay if we decide to move it to atomic. The overlay engine wants to know what part of the source image has changed. Damage is triggered by a content change and the change lives in the framebuffer, and this is easier on user-space as well. Now for software plane compositing, you might be hitting the problems you describe above. But if you're doing software plane compositing in your drm driver (which you probably aren't), you'd have enough information anyway to handle both the odd case of background color change and any scaling if present (god forbid). The one thing I'm somewhat worried about with per-plane damage rects is correctly adding them up into an overall crtc rect for hw that needs it (that's edp and manual upload dsi). There's some fixed point math involved first to get from plane src to crtc dst coords, and then there's the fun of figuring out which properties affect the entire screen or entire plane (background, gamma tables, ...). But I guess we can do that in a helper and share that code with all drivers that need it. I think we have 2 different kinds of drivers which would benefit from this: - drivers that composite on the "display"/remotely (like vmwgfx, or maybe also spice): Want damage in plane source coordinates. I think we could also group udl and spi/i2c-connected screens into this, since you can do the same buffer upload dance. Those drivers also might benefit from a list of rectangles (assuming the rectangles aren't too small). At least e.g. udl has a hw cursor which is also composited remotely. - hw drivers where the selective upload happens after compositing, i.e. edp psr and dsi manual upload. Generally you get 1 rectangle, maybe 2 if they're well-seperated enough. Screen coordinates only, and for damage calculation we must take all compositing parameters into account. Are these latter type of drivers typically hw- or sw plane compositing? In any case, I agree I think we would want a helper that turns plane source damage into crtc damage. With the other way around, we can't really determine what planes are damaged. We could also perhaps submit damage per plane in plane crtc-side coordinates, It wouldn't hurt video overlays much since they would probably do full size updates anyway. /Thomas Cheers, Daniel ___ dri-devel mailing list dri-devel@l
[PATCH 02/13] drm/tegra: dsi: Move register definitions into a table
From: Thierry Reding After commit 75af8fa7fd47 ("drm/tegra: dsi: Trace register accesses"), the debugfs register dump implementation causes excessive stack usage and can result in build warnings. To fix this, move the register definitions into a table and iterate over the table while dumping the registers to debugfs. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dsi.c | 170 +--- 1 file changed, 83 insertions(+), 87 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 046649ec9441..4a78af08df82 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -122,12 +122,89 @@ static inline void tegra_dsi_writel(struct tegra_dsi *dsi, u32 value, writel(value, dsi->regs + (offset << 2)); } +#define DEBUGFS_REG32(_name) { .name = #_name, .offset = _name } + +static const struct debugfs_reg32 tegra_dsi_regs[] = { + DEBUGFS_REG32(DSI_INCR_SYNCPT), + DEBUGFS_REG32(DSI_INCR_SYNCPT_CONTROL), + DEBUGFS_REG32(DSI_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DSI_CTXSW), + DEBUGFS_REG32(DSI_RD_DATA), + DEBUGFS_REG32(DSI_WR_DATA), + DEBUGFS_REG32(DSI_POWER_CONTROL), + DEBUGFS_REG32(DSI_INT_ENABLE), + DEBUGFS_REG32(DSI_INT_STATUS), + DEBUGFS_REG32(DSI_INT_MASK), + DEBUGFS_REG32(DSI_HOST_CONTROL), + DEBUGFS_REG32(DSI_CONTROL), + DEBUGFS_REG32(DSI_SOL_DELAY), + DEBUGFS_REG32(DSI_MAX_THRESHOLD), + DEBUGFS_REG32(DSI_TRIGGER), + DEBUGFS_REG32(DSI_TX_CRC), + DEBUGFS_REG32(DSI_STATUS), + DEBUGFS_REG32(DSI_INIT_SEQ_CONTROL), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_0), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_1), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_2), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_3), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_4), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_5), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_6), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_7), + DEBUGFS_REG32(DSI_PKT_SEQ_0_LO), + DEBUGFS_REG32(DSI_PKT_SEQ_0_HI), + DEBUGFS_REG32(DSI_PKT_SEQ_1_LO), + DEBUGFS_REG32(DSI_PKT_SEQ_1_HI), + DEBUGFS_REG32(DSI_PKT_SEQ_2_LO), + DEBUGFS_REG32(DSI_PKT_SEQ_2_HI), + DEBUGFS_REG32(DSI_PKT_SEQ_3_LO), + DEBUGFS_REG32(DSI_PKT_SEQ_3_HI), + DEBUGFS_REG32(DSI_PKT_SEQ_4_LO), + DEBUGFS_REG32(DSI_PKT_SEQ_4_HI), + DEBUGFS_REG32(DSI_PKT_SEQ_5_LO), + DEBUGFS_REG32(DSI_PKT_SEQ_5_HI), + DEBUGFS_REG32(DSI_DCS_CMDS), + DEBUGFS_REG32(DSI_PKT_LEN_0_1), + DEBUGFS_REG32(DSI_PKT_LEN_2_3), + DEBUGFS_REG32(DSI_PKT_LEN_4_5), + DEBUGFS_REG32(DSI_PKT_LEN_6_7), + DEBUGFS_REG32(DSI_PHY_TIMING_0), + DEBUGFS_REG32(DSI_PHY_TIMING_1), + DEBUGFS_REG32(DSI_PHY_TIMING_2), + DEBUGFS_REG32(DSI_BTA_TIMING), + DEBUGFS_REG32(DSI_TIMEOUT_0), + DEBUGFS_REG32(DSI_TIMEOUT_1), + DEBUGFS_REG32(DSI_TO_TALLY), + DEBUGFS_REG32(DSI_PAD_CONTROL_0), + DEBUGFS_REG32(DSI_PAD_CONTROL_CD), + DEBUGFS_REG32(DSI_PAD_CD_STATUS), + DEBUGFS_REG32(DSI_VIDEO_MODE_CONTROL), + DEBUGFS_REG32(DSI_PAD_CONTROL_1), + DEBUGFS_REG32(DSI_PAD_CONTROL_2), + DEBUGFS_REG32(DSI_PAD_CONTROL_3), + DEBUGFS_REG32(DSI_PAD_CONTROL_4), + DEBUGFS_REG32(DSI_GANGED_MODE_CONTROL), + DEBUGFS_REG32(DSI_GANGED_MODE_START), + DEBUGFS_REG32(DSI_GANGED_MODE_SIZE), + DEBUGFS_REG32(DSI_RAW_DATA_BYTE_COUNT), + DEBUGFS_REG32(DSI_ULTRA_LOW_POWER_CONTROL), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_8), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_9), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_10), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_11), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_12), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_13), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_14), + DEBUGFS_REG32(DSI_INIT_SEQ_DATA_15), +}; + static int tegra_dsi_show_regs(struct seq_file *s, void *data) { struct drm_info_node *node = s->private; struct tegra_dsi *dsi = node->info_ent->data; struct drm_crtc *crtc = dsi->output.encoder.crtc; struct drm_device *drm = node->minor->dev; + unsigned int i; int err = 0; drm_modeset_lock_all(drm); @@ -137,93 +214,12 @@ static int tegra_dsi_show_regs(struct seq_file *s, void *data) goto unlock; } -#define DUMP_REG(name) \ - seq_printf(s, "%-32s %#05x %08x\n", #name, name,\ - tegra_dsi_readl(dsi, name)) - - DUMP_REG(DSI_INCR_SYNCPT); - DUMP_REG(DSI_INCR_SYNCPT_CONTROL); - DUMP_REG(DSI_INCR_SYNCPT_ERROR); - DUMP_REG(DSI_CTXSW); - DUMP_REG(DSI_RD_DATA); - DUMP_REG(DSI_WR_DATA); - DUMP_REG(DSI_POWER_CONTROL); - DUMP_REG(DSI_INT_ENABLE); - DUMP_REG(DSI_INT_STATUS); - DUMP_REG(DSI_INT_MASK); - DUMP_REG(DSI_HOST_CONTROL); - DUMP_REG(DSI_CONTROL); - DU
[PATCH 00/13] drm/tegra: Miscellaneous cleanups
From: Thierry Reding This series has some cleanup patches to fix up various, mostly minor issues with the Tegra DRM driver. Patches 1-4 move register definitions into a table, which is necessary in order to prevent the stack from growing excessively large in the debugfs support. Patches 5-10 move debugfs registration code into ->late_register() callbacks in order to tie them to the correct lifetime of device nodes. Patches 11 and 12 are whitespace fixups and patch 13 fixes some naming issues in hardware capabilities. Thierry Thierry Reding (13): drm/tegra: dc: Move register definitions into a table drm/tegra: dsi: Move register definitions into a table drm/tegra: hdmi: Move register definitions into a table drm/tegra: sor: Move register definitions into a table drm/tegra: dc: Reshuffle some code drm/tegra: dc: Register debugfs in ->late_register() drm/tegra: dsi: Register debugfs in ->late_register() drm/tegra: hdmi: Register debugfs in ->late_register() drm/tegra: sor: Root debugfs files at the connector drm/tegra: sor: Register debugfs in ->late_register() drm/tegra: Do not wrap lines unnecessarily drm/tegra: vic: Properly align arguments drm/tegra: dc: Support background color drivers/gpu/drm/tegra/dc.c | 858 +-- drivers/gpu/drm/tegra/dc.h | 10 +- drivers/gpu/drm/tegra/drm.c | 3 +- drivers/gpu/drm/tegra/dsi.c | 228 +--- drivers/gpu/drm/tegra/hdmi.c | 504 - drivers/gpu/drm/tegra/sor.c | 304 --- drivers/gpu/drm/tegra/vic.c | 2 +- 7 files changed, 919 insertions(+), 990 deletions(-) -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 01/13] drm/tegra: dc: Move register definitions into a table
From: Thierry Reding After commit 67e04d1ab19b ("drm/tegra: dc: Trace register accesses"), the debugfs register dump implementation causes excessive stack usage and can result in build warnings. To fix this, move the register definitions into a table and iterate over the table while dumping the registers to debugfs. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 442 +++-- 1 file changed, 224 insertions(+), 218 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 24a5ef4f5bb8..825419dff07b 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1383,10 +1383,228 @@ static irqreturn_t tegra_dc_irq(int irq, void *data) return IRQ_HANDLED; } +#define DEBUGFS_REG32(_name) { .name = #_name, .offset = _name } + +static const struct debugfs_reg32 tegra_dc_regs[] = { + DEBUGFS_REG32(DC_CMD_GENERAL_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_GENERAL_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_GENERAL_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_WIN_A_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_WIN_A_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_WIN_A_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_WIN_B_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_WIN_B_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_WIN_B_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_WIN_C_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_WIN_C_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_WIN_C_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_CONT_SYNCPT_VSYNC), + DEBUGFS_REG32(DC_CMD_DISPLAY_COMMAND_OPTION0), + DEBUGFS_REG32(DC_CMD_DISPLAY_COMMAND), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE), + DEBUGFS_REG32(DC_CMD_DISPLAY_POWER_CONTROL), + DEBUGFS_REG32(DC_CMD_INT_STATUS), + DEBUGFS_REG32(DC_CMD_INT_MASK), + DEBUGFS_REG32(DC_CMD_INT_ENABLE), + DEBUGFS_REG32(DC_CMD_INT_TYPE), + DEBUGFS_REG32(DC_CMD_INT_POLARITY), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE1), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE2), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE3), + DEBUGFS_REG32(DC_CMD_STATE_ACCESS), + DEBUGFS_REG32(DC_CMD_STATE_CONTROL), + DEBUGFS_REG32(DC_CMD_DISPLAY_WINDOW_HEADER), + DEBUGFS_REG32(DC_CMD_REG_ACT_CONTROL), + DEBUGFS_REG32(DC_COM_CRC_CONTROL), + DEBUGFS_REG32(DC_COM_CRC_CHECKSUM), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(3)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(3)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(3)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(0)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(1)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(2)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(3)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_DATA(0)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_DATA(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(3)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(4)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(5)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(6)), + DEBUGFS_REG32(DC_COM_PIN_MISC_CONTROL), + DEBUGFS_REG32(DC_COM_PIN_PM0_CONTROL), + DEBUGFS_REG32(DC_COM_PIN_PM0_DUTY_CYCLE), + DEBUGFS_REG32(DC_COM_PIN_PM1_CONTROL), + DEBUGFS_REG32(DC_COM_PIN_PM1_DUTY_CYCLE), + DEBUGFS_REG32(DC_COM_SPI_CONTROL), + DEBUGFS_REG32(DC_COM_SPI_START_BYTE), + DEBUGFS_REG32(DC_COM_HSPI_WRITE_DATA_AB), + DEBUGFS_REG32(DC_COM_HSPI_WRITE_DATA_CD), + DEBUGFS_REG32(DC_COM_HSPI_CS_DC), + DEBUGFS_REG32(DC_COM_SCRATCH_REGISTER_A), + DEBUGFS_REG32(DC_COM_SCRATCH_REGISTER_B), + DEBUGFS_REG32(DC_COM_GPIO_CTRL), + DEBUGFS_REG32(DC_COM_GPIO_DEBOUNCE_COUNTER), + DEBUGFS_REG32(DC_COM_CRC_CHECKSUM_LATCHED), + DEBUGFS_REG32(DC_DISP_DISP_SIGNAL_OPTIONS0), + DEBUGFS_REG32(DC_DISP_DISP_SIGNAL_OPTIONS1), + DEBUGFS_REG32(DC_DISP_DISP_WIN_OPTIONS), + DEBUGFS_REG32(DC_DISP_DISP_MEM_HIGH_PRIORITY), + DEBUGFS_REG32(DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER), + DEBUGFS_REG32(DC_DISP_DISP_TIMING_OPTIONS), + DEBUGFS_REG32(DC_DISP_REF_TO_SYNC), + DEBUGFS_REG32(DC_DISP_SYNC_WIDTH), + DEBUGFS_REG32(DC_DISP_BACK_PORCH), + DEBUGFS_REG32(DC_DISP_ACTIVE), + DEBUGFS_REG32(DC_DISP_FRONT_PORCH), + DEBUGFS_REG32(DC_DISP_H_PULSE0_CONTROL
[PATCH 04/13] drm/tegra: sor: Move register definitions into a table
From: Thierry Reding After commit 932f6529139e ("drm/tegra: sor: Trace register accesses"), the debugfs register dump implementation causes excessive stack usage and can result in build warnings. To fix this, move the register definitions into a table and iterate over the table while dumping the registers to debugfs. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 246 +++- 1 file changed, 126 insertions(+), 120 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index b0a1dedac802..75b21dbaa8f0 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -1105,12 +1105,132 @@ static int tegra_sor_show_crc(struct seq_file *s, void *data) return err; } +#define DEBUGFS_REG32(_name) { .name = #_name, .offset = _name } + +static const struct debugfs_reg32 tegra_sor_regs[] = { + DEBUGFS_REG32(SOR_CTXSW), + DEBUGFS_REG32(SOR_SUPER_STATE0), + DEBUGFS_REG32(SOR_SUPER_STATE1), + DEBUGFS_REG32(SOR_STATE0), + DEBUGFS_REG32(SOR_STATE1), + DEBUGFS_REG32(SOR_HEAD_STATE0(0)), + DEBUGFS_REG32(SOR_HEAD_STATE0(1)), + DEBUGFS_REG32(SOR_HEAD_STATE1(0)), + DEBUGFS_REG32(SOR_HEAD_STATE1(1)), + DEBUGFS_REG32(SOR_HEAD_STATE2(0)), + DEBUGFS_REG32(SOR_HEAD_STATE2(1)), + DEBUGFS_REG32(SOR_HEAD_STATE3(0)), + DEBUGFS_REG32(SOR_HEAD_STATE3(1)), + DEBUGFS_REG32(SOR_HEAD_STATE4(0)), + DEBUGFS_REG32(SOR_HEAD_STATE4(1)), + DEBUGFS_REG32(SOR_HEAD_STATE5(0)), + DEBUGFS_REG32(SOR_HEAD_STATE5(1)), + DEBUGFS_REG32(SOR_CRC_CNTRL), + DEBUGFS_REG32(SOR_DP_DEBUG_MVID), + DEBUGFS_REG32(SOR_CLK_CNTRL), + DEBUGFS_REG32(SOR_CAP), + DEBUGFS_REG32(SOR_PWR), + DEBUGFS_REG32(SOR_TEST), + DEBUGFS_REG32(SOR_PLL0), + DEBUGFS_REG32(SOR_PLL1), + DEBUGFS_REG32(SOR_PLL2), + DEBUGFS_REG32(SOR_PLL3), + DEBUGFS_REG32(SOR_CSTM), + DEBUGFS_REG32(SOR_LVDS), + DEBUGFS_REG32(SOR_CRCA), + DEBUGFS_REG32(SOR_CRCB), + DEBUGFS_REG32(SOR_BLANK), + DEBUGFS_REG32(SOR_SEQ_CTL), + DEBUGFS_REG32(SOR_LANE_SEQ_CTL), + DEBUGFS_REG32(SOR_SEQ_INST(0)), + DEBUGFS_REG32(SOR_SEQ_INST(1)), + DEBUGFS_REG32(SOR_SEQ_INST(2)), + DEBUGFS_REG32(SOR_SEQ_INST(3)), + DEBUGFS_REG32(SOR_SEQ_INST(4)), + DEBUGFS_REG32(SOR_SEQ_INST(5)), + DEBUGFS_REG32(SOR_SEQ_INST(6)), + DEBUGFS_REG32(SOR_SEQ_INST(7)), + DEBUGFS_REG32(SOR_SEQ_INST(8)), + DEBUGFS_REG32(SOR_SEQ_INST(9)), + DEBUGFS_REG32(SOR_SEQ_INST(10)), + DEBUGFS_REG32(SOR_SEQ_INST(11)), + DEBUGFS_REG32(SOR_SEQ_INST(12)), + DEBUGFS_REG32(SOR_SEQ_INST(13)), + DEBUGFS_REG32(SOR_SEQ_INST(14)), + DEBUGFS_REG32(SOR_SEQ_INST(15)), + DEBUGFS_REG32(SOR_PWM_DIV), + DEBUGFS_REG32(SOR_PWM_CTL), + DEBUGFS_REG32(SOR_VCRC_A0), + DEBUGFS_REG32(SOR_VCRC_A1), + DEBUGFS_REG32(SOR_VCRC_B0), + DEBUGFS_REG32(SOR_VCRC_B1), + DEBUGFS_REG32(SOR_CCRC_A0), + DEBUGFS_REG32(SOR_CCRC_A1), + DEBUGFS_REG32(SOR_CCRC_B0), + DEBUGFS_REG32(SOR_CCRC_B1), + DEBUGFS_REG32(SOR_EDATA_A0), + DEBUGFS_REG32(SOR_EDATA_A1), + DEBUGFS_REG32(SOR_EDATA_B0), + DEBUGFS_REG32(SOR_EDATA_B1), + DEBUGFS_REG32(SOR_COUNT_A0), + DEBUGFS_REG32(SOR_COUNT_A1), + DEBUGFS_REG32(SOR_COUNT_B0), + DEBUGFS_REG32(SOR_COUNT_B1), + DEBUGFS_REG32(SOR_DEBUG_A0), + DEBUGFS_REG32(SOR_DEBUG_A1), + DEBUGFS_REG32(SOR_DEBUG_B0), + DEBUGFS_REG32(SOR_DEBUG_B1), + DEBUGFS_REG32(SOR_TRIG), + DEBUGFS_REG32(SOR_MSCHECK), + DEBUGFS_REG32(SOR_XBAR_CTRL), + DEBUGFS_REG32(SOR_XBAR_POL), + DEBUGFS_REG32(SOR_DP_LINKCTL0), + DEBUGFS_REG32(SOR_DP_LINKCTL1), + DEBUGFS_REG32(SOR_LANE_DRIVE_CURRENT0), + DEBUGFS_REG32(SOR_LANE_DRIVE_CURRENT1), + DEBUGFS_REG32(SOR_LANE4_DRIVE_CURRENT0), + DEBUGFS_REG32(SOR_LANE4_DRIVE_CURRENT1), + DEBUGFS_REG32(SOR_LANE_PREEMPHASIS0), + DEBUGFS_REG32(SOR_LANE_PREEMPHASIS1), + DEBUGFS_REG32(SOR_LANE4_PREEMPHASIS0), + DEBUGFS_REG32(SOR_LANE4_PREEMPHASIS1), + DEBUGFS_REG32(SOR_LANE_POSTCURSOR0), + DEBUGFS_REG32(SOR_LANE_POSTCURSOR1), + DEBUGFS_REG32(SOR_DP_CONFIG0), + DEBUGFS_REG32(SOR_DP_CONFIG1), + DEBUGFS_REG32(SOR_DP_MN0), + DEBUGFS_REG32(SOR_DP_MN1), + DEBUGFS_REG32(SOR_DP_PADCTL0), + DEBUGFS_REG32(SOR_DP_PADCTL1), + DEBUGFS_REG32(SOR_DP_DEBUG0), + DEBUGFS_REG32(SOR_DP_DEBUG1), + DEBUGFS_REG32(SOR_DP_SPARE0), + DEBUGFS_REG32(SOR_DP_SPARE1), + DEBUGFS_REG32(SOR_DP_AUDIO_CTRL), + DEBUGFS_REG32(SOR_DP_AUDIO_HBLANK_SYMBOLS), + DEBUGFS_REG32(SOR_DP_AUDIO_VBLANK_SYMBOLS), + DEBUGFS_REG32(SOR_DP_GENERIC_INFOFRAME_HEADER), + DEBUGFS_REG32(SOR_DP_GENERIC_INFOFRAME_SUBPACK0), + DEBUGFS_RE
[PATCH 03/13] drm/tegra: hdmi: Move register definitions into a table
From: Thierry Reding After commit 07a8aab89927 ("drm/tegra: hdmi: Trace register accesses"), the debugfs register dump implementation causes excessive stack usage and can result in build warnings. To fix this, move the register definitions into a table and iterate over the table while dumping the registers to debugfs. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/hdmi.c | 346 ++- 1 file changed, 176 insertions(+), 170 deletions(-) diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 6434b3d3d1ba..a68d80476e46 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -1225,12 +1225,182 @@ static const struct drm_encoder_helper_funcs tegra_hdmi_encoder_helper_funcs = { .atomic_check = tegra_hdmi_encoder_atomic_check, }; +#define DEBUGFS_REG32(_name) { .name = #_name, .offset = _name } + +static const struct debugfs_reg32 tegra_hdmi_regs[] = { + DEBUGFS_REG32(HDMI_CTXSW), + DEBUGFS_REG32(HDMI_NV_PDISP_SOR_STATE0), + DEBUGFS_REG32(HDMI_NV_PDISP_SOR_STATE1), + DEBUGFS_REG32(HDMI_NV_PDISP_SOR_STATE2), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AN_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AN_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CN_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CN_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_BKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_BKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_DKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_DKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CMODE), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_MPRIME_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_MPRIME_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_SPRIME_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_SPRIME_LSB2), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_SPRIME_LSB1), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_RI), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CS_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CS_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU0), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU_RDATA0), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU1), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU2), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_STATUS), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_STATUS), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_HEADER), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_STATUS), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_HEADER), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK0_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK0_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK1_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK1_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK2_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK2_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK3_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK3_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0882_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0882_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_1764_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_1764_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0480_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0480_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0960_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0960_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_1920_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_H
[PATCH 06/13] drm/tegra: dc: Register debugfs in ->late_register()
From: Thierry Reding The ->late_register() and ->early_unregister() callbacks are called at the right time to make sure userspace only accesses interfaces when it should. Move debugfs registration and unregistration to these callback functions to avoid potential races with userspace. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 698 ++--- drivers/gpu/drm/tegra/dc.h | 2 - 2 files changed, 335 insertions(+), 365 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 052f512572d5..69d98bf84ceb 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -959,6 +959,339 @@ static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc, kfree(state); } +#define DEBUGFS_REG32(_name) { .name = #_name, .offset = _name } + +static const struct debugfs_reg32 tegra_dc_regs[] = { + DEBUGFS_REG32(DC_CMD_GENERAL_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_GENERAL_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_GENERAL_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_WIN_A_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_WIN_A_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_WIN_A_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_WIN_B_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_WIN_B_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_WIN_B_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_WIN_C_INCR_SYNCPT), + DEBUGFS_REG32(DC_CMD_WIN_C_INCR_SYNCPT_CNTRL), + DEBUGFS_REG32(DC_CMD_WIN_C_INCR_SYNCPT_ERROR), + DEBUGFS_REG32(DC_CMD_CONT_SYNCPT_VSYNC), + DEBUGFS_REG32(DC_CMD_DISPLAY_COMMAND_OPTION0), + DEBUGFS_REG32(DC_CMD_DISPLAY_COMMAND), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE), + DEBUGFS_REG32(DC_CMD_DISPLAY_POWER_CONTROL), + DEBUGFS_REG32(DC_CMD_INT_STATUS), + DEBUGFS_REG32(DC_CMD_INT_MASK), + DEBUGFS_REG32(DC_CMD_INT_ENABLE), + DEBUGFS_REG32(DC_CMD_INT_TYPE), + DEBUGFS_REG32(DC_CMD_INT_POLARITY), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE1), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE2), + DEBUGFS_REG32(DC_CMD_SIGNAL_RAISE3), + DEBUGFS_REG32(DC_CMD_STATE_ACCESS), + DEBUGFS_REG32(DC_CMD_STATE_CONTROL), + DEBUGFS_REG32(DC_CMD_DISPLAY_WINDOW_HEADER), + DEBUGFS_REG32(DC_CMD_REG_ACT_CONTROL), + DEBUGFS_REG32(DC_COM_CRC_CONTROL), + DEBUGFS_REG32(DC_COM_CRC_CHECKSUM), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_ENABLE(3)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_POLARITY(3)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_DATA(3)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(0)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(1)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(2)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_ENABLE(3)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_DATA(0)), + DEBUGFS_REG32(DC_COM_PIN_INPUT_DATA(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(0)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(1)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(2)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(3)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(4)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(5)), + DEBUGFS_REG32(DC_COM_PIN_OUTPUT_SELECT(6)), + DEBUGFS_REG32(DC_COM_PIN_MISC_CONTROL), + DEBUGFS_REG32(DC_COM_PIN_PM0_CONTROL), + DEBUGFS_REG32(DC_COM_PIN_PM0_DUTY_CYCLE), + DEBUGFS_REG32(DC_COM_PIN_PM1_CONTROL), + DEBUGFS_REG32(DC_COM_PIN_PM1_DUTY_CYCLE), + DEBUGFS_REG32(DC_COM_SPI_CONTROL), + DEBUGFS_REG32(DC_COM_SPI_START_BYTE), + DEBUGFS_REG32(DC_COM_HSPI_WRITE_DATA_AB), + DEBUGFS_REG32(DC_COM_HSPI_WRITE_DATA_CD), + DEBUGFS_REG32(DC_COM_HSPI_CS_DC), + DEBUGFS_REG32(DC_COM_SCRATCH_REGISTER_A), + DEBUGFS_REG32(DC_COM_SCRATCH_REGISTER_B), + DEBUGFS_REG32(DC_COM_GPIO_CTRL), + DEBUGFS_REG32(DC_COM_GPIO_DEBOUNCE_COUNTER), + DEBUGFS_REG32(DC_COM_CRC_CHECKSUM_LATCHED), + DEBUGFS_REG32(DC_DISP_DISP_SIGNAL_OPTIONS0), + DEBUGFS_REG32(DC_DISP_DISP_SIGNAL_OPTIONS1), + DEBUGFS_REG32(DC_DISP_DISP_WIN_OPTIONS), + DEBUGFS_REG32(DC_DISP_DISP_MEM_HIGH_PRIORITY), + DEBUGFS_REG32(DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER), + DEBUGFS_REG32(DC_DISP_DISP_TIMING_OPTIONS), + DEBUGFS_REG32(DC_DISP_REF_TO_SYNC), + DEBUGFS_REG32(DC_DISP_SYNC_WIDTH), + DEBUGFS_REG32(DC_DISP_BACK_PORCH), + DEBUGFS_REG32(DC_DISP_ACTIVE), + DEBUGFS_REG32(DC_DISP_FRONT_PORCH), + DEBUGFS_REG32(DC_DISP_H_PULS
[PATCH 07/13] drm/tegra: dsi: Register debugfs in ->late_register()
From: Thierry Reding The ->late_register() and ->early_unregister() callbacks are called at the right time to make sure userspace only accesses interfaces when it should. Move debugfs registration and unregistration to these callback functions to avoid potential races with userspace. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dsi.c | 58 ++--- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 4a78af08df82..4d2ed966f9e3 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -65,8 +65,6 @@ struct tegra_dsi { struct clk *clk; struct drm_info_list *debugfs_files; - struct drm_minor *minor; - struct dentry *debugfs; unsigned long flags; enum mipi_dsi_pixel_format format; @@ -230,58 +228,46 @@ static struct drm_info_list debugfs_files[] = { { "regs", tegra_dsi_show_regs, 0, NULL }, }; -static int tegra_dsi_debugfs_init(struct tegra_dsi *dsi, - struct drm_minor *minor) +static int tegra_dsi_late_register(struct drm_connector *connector) { - const char *name = dev_name(dsi->dev); - unsigned int i; + struct tegra_output *output = connector_to_output(connector); + unsigned int i, count = ARRAY_SIZE(debugfs_files); + struct drm_minor *minor = connector->dev->primary; + struct dentry *root = connector->debugfs_entry; + struct tegra_dsi *dsi = to_dsi(output); int err; - dsi->debugfs = debugfs_create_dir(name, minor->debugfs_root); - if (!dsi->debugfs) - return -ENOMEM; - dsi->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files), GFP_KERNEL); - if (!dsi->debugfs_files) { - err = -ENOMEM; - goto remove; - } + if (!dsi->debugfs_files) + return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(debugfs_files); i++) + for (i = 0; i < count; i++) dsi->debugfs_files[i].data = dsi; - err = drm_debugfs_create_files(dsi->debugfs_files, - ARRAY_SIZE(debugfs_files), - dsi->debugfs, minor); + err = drm_debugfs_create_files(dsi->debugfs_files, count, root, minor); if (err < 0) goto free; - dsi->minor = minor; - return 0; free: kfree(dsi->debugfs_files); dsi->debugfs_files = NULL; -remove: - debugfs_remove(dsi->debugfs); - dsi->debugfs = NULL; return err; } -static void tegra_dsi_debugfs_exit(struct tegra_dsi *dsi) +static void tegra_dsi_early_unregister(struct drm_connector *connector) { - drm_debugfs_remove_files(dsi->debugfs_files, ARRAY_SIZE(debugfs_files), -dsi->minor); - dsi->minor = NULL; + struct tegra_output *output = connector_to_output(connector); + unsigned int count = ARRAY_SIZE(debugfs_files); + struct tegra_dsi *dsi = to_dsi(output); + drm_debugfs_remove_files(dsi->debugfs_files, count, +connector->dev->primary); kfree(dsi->debugfs_files); dsi->debugfs_files = NULL; - - debugfs_remove(dsi->debugfs); - dsi->debugfs = NULL; } #define PKT_ID0(id)id) & 0x3f) << 3) | (1 << 9)) @@ -823,6 +809,8 @@ static const struct drm_connector_funcs tegra_dsi_connector_funcs = { .destroy = tegra_output_connector_destroy, .atomic_duplicate_state = tegra_dsi_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, + .late_register = tegra_dsi_late_register, + .early_unregister = tegra_dsi_early_unregister, }; static enum drm_mode_status @@ -1076,12 +1064,6 @@ static int tegra_dsi_init(struct host1x_client *client) dsi->output.encoder.possible_crtcs = 0x3; } - if (IS_ENABLED(CONFIG_DEBUG_FS)) { - err = tegra_dsi_debugfs_init(dsi, drm->primary); - if (err < 0) - dev_err(dsi->dev, "debugfs setup failed: %d\n", err); - } - return 0; } @@ -1090,10 +1072,6 @@ static int tegra_dsi_exit(struct host1x_client *client) struct tegra_dsi *dsi = host1x_client_to_dsi(client); tegra_output_exit(&dsi->output); - - if (IS_ENABLED(CONFIG_DEBUG_FS)) - tegra_dsi_debugfs_exit(dsi); - regulator_disable(dsi->vdd); return 0; -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 11/13] drm/tegra: Do not wrap lines unnecessarily
From: Thierry Reding The tegra_drm_alloc() function signature fits on a single line, no need to wrap it. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/drm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 52552b9b89ef..de1d122ba820 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1148,8 +1148,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra, return 0; } -void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, - dma_addr_t *dma) +void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) { struct iova *alloc; void *virt; -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/13] drm/tegra: dc: Reshuffle some code
From: Thierry Reding Reshuffle some code so that functions are defined closer to where they are used. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 152 ++--- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 825419dff07b..052f512572d5 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -909,82 +909,6 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) return 0; } -static u32 tegra_dc_get_vblank_counter(struct drm_crtc *crtc) -{ - struct tegra_dc *dc = to_tegra_dc(crtc); - - if (dc->syncpt) - return host1x_syncpt_read(dc->syncpt); - - /* fallback to software emulated VBLANK counter */ - return drm_crtc_vblank_count(&dc->base); -} - -static int tegra_dc_enable_vblank(struct drm_crtc *crtc) -{ - struct tegra_dc *dc = to_tegra_dc(crtc); - unsigned long value, flags; - - spin_lock_irqsave(&dc->lock, flags); - - value = tegra_dc_readl(dc, DC_CMD_INT_MASK); - value |= VBLANK_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_MASK); - - spin_unlock_irqrestore(&dc->lock, flags); - - return 0; -} - -static void tegra_dc_disable_vblank(struct drm_crtc *crtc) -{ - struct tegra_dc *dc = to_tegra_dc(crtc); - unsigned long value, flags; - - spin_lock_irqsave(&dc->lock, flags); - - value = tegra_dc_readl(dc, DC_CMD_INT_MASK); - value &= ~VBLANK_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_MASK); - - spin_unlock_irqrestore(&dc->lock, flags); -} - -static void tegra_dc_finish_page_flip(struct tegra_dc *dc) -{ - struct drm_device *drm = dc->base.dev; - struct drm_crtc *crtc = &dc->base; - unsigned long flags, base; - struct tegra_bo *bo; - - spin_lock_irqsave(&drm->event_lock, flags); - - if (!dc->event) { - spin_unlock_irqrestore(&drm->event_lock, flags); - return; - } - - bo = tegra_fb_get_plane(crtc->primary->fb, 0); - - spin_lock(&dc->lock); - - /* check if new start address has been latched */ - tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); - tegra_dc_writel(dc, READ_MUX, DC_CMD_STATE_ACCESS); - base = tegra_dc_readl(dc, DC_WINBUF_START_ADDR); - tegra_dc_writel(dc, 0, DC_CMD_STATE_ACCESS); - - spin_unlock(&dc->lock); - - if (base == bo->paddr + crtc->primary->fb->offsets[0]) { - drm_crtc_send_vblank_event(crtc, dc->event); - drm_crtc_vblank_put(crtc); - dc->event = NULL; - } - - spin_unlock_irqrestore(&drm->event_lock, flags); -} - static void tegra_dc_destroy(struct drm_crtc *crtc) { drm_crtc_cleanup(crtc); @@ -1035,6 +959,47 @@ static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc, kfree(state); } +static u32 tegra_dc_get_vblank_counter(struct drm_crtc *crtc) +{ + struct tegra_dc *dc = to_tegra_dc(crtc); + + if (dc->syncpt) + return host1x_syncpt_read(dc->syncpt); + + /* fallback to software emulated VBLANK counter */ + return drm_crtc_vblank_count(&dc->base); +} + +static int tegra_dc_enable_vblank(struct drm_crtc *crtc) +{ + struct tegra_dc *dc = to_tegra_dc(crtc); + unsigned long value, flags; + + spin_lock_irqsave(&dc->lock, flags); + + value = tegra_dc_readl(dc, DC_CMD_INT_MASK); + value |= VBLANK_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + + spin_unlock_irqrestore(&dc->lock, flags); + + return 0; +} + +static void tegra_dc_disable_vblank(struct drm_crtc *crtc) +{ + struct tegra_dc *dc = to_tegra_dc(crtc); + unsigned long value, flags; + + spin_lock_irqsave(&dc->lock, flags); + + value = tegra_dc_readl(dc, DC_CMD_INT_MASK); + value &= ~VBLANK_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + + spin_unlock_irqrestore(&dc->lock, flags); +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .page_flip = drm_atomic_helper_page_flip, .set_config = drm_atomic_helper_set_config, @@ -1342,6 +1307,41 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { .atomic_disable = tegra_crtc_atomic_disable, }; +static void tegra_dc_finish_page_flip(struct tegra_dc *dc) +{ + struct drm_device *drm = dc->base.dev; + struct drm_crtc *crtc = &dc->base; + unsigned long flags, base; + struct tegra_bo *bo; + + spin_lock_irqsave(&drm->event_lock, flags); + + if (!dc->event) { + spin_unlock_irqrestore(&drm->event_lock, flags); + return; + } + + bo = tegra_fb_get_plane(crtc->primary->fb, 0); + + spin_lock(&dc->lock); + + /* check if new start address has been latched */ + tegra_dc_writel(dc, WINDOW_A_SELECT,
[PATCH 13/13] drm/tegra: dc: Support background color
From: Thierry Reding Starting with Tegra124, the interface to set the background color (the value generated for pixels that are not sourced from any window) is via a different register. Earlier generations called this the border color. Reverse the feature flag and assume that IP revisions that don't have support for background color will support border color instead. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 14 -- drivers/gpu/drm/tegra/dc.h | 8 +++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 69d98bf84ceb..954bf92f21fd 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1572,7 +1572,9 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc, WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT; tegra_dc_writel(dc, value, DC_CMD_INT_MASK); - if (dc->soc->supports_border_color) + if (dc->soc->supports_background_color) + tegra_dc_writel(dc, 0, DC_DISP_BLEND_BACKGROUND_COLOR); + else tegra_dc_writel(dc, 0, DC_DISP_BORDER_COLOR); /* apply PLL and pixel clock changes */ @@ -1835,7 +1837,7 @@ static const struct host1x_client_ops dc_client_ops = { }; static const struct tegra_dc_soc_info tegra20_dc_soc_info = { - .supports_border_color = true, + .supports_background_color = false, .supports_interlacing = false, .supports_cursor = false, .supports_block_linear = false, @@ -1845,7 +1847,7 @@ static const struct tegra_dc_soc_info tegra20_dc_soc_info = { }; static const struct tegra_dc_soc_info tegra30_dc_soc_info = { - .supports_border_color = true, + .supports_background_color = false, .supports_interlacing = false, .supports_cursor = false, .supports_block_linear = false, @@ -1855,7 +1857,7 @@ static const struct tegra_dc_soc_info tegra30_dc_soc_info = { }; static const struct tegra_dc_soc_info tegra114_dc_soc_info = { - .supports_border_color = true, + .supports_background_color = false, .supports_interlacing = false, .supports_cursor = false, .supports_block_linear = false, @@ -1865,7 +1867,7 @@ static const struct tegra_dc_soc_info tegra114_dc_soc_info = { }; static const struct tegra_dc_soc_info tegra124_dc_soc_info = { - .supports_border_color = false, + .supports_background_color = true, .supports_interlacing = true, .supports_cursor = true, .supports_block_linear = true, @@ -1875,7 +1877,7 @@ static const struct tegra_dc_soc_info tegra124_dc_soc_info = { }; static const struct tegra_dc_soc_info tegra210_dc_soc_info = { - .supports_border_color = false, + .supports_background_color = true, .supports_interlacing = true, .supports_cursor = true, .supports_block_linear = true, diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 032c734dd470..571a6c78619f 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -26,7 +26,7 @@ struct tegra_dc_stats { }; struct tegra_dc_soc_info { - bool supports_border_color; + bool supports_background_color; bool supports_interlacing; bool supports_cursor; bool supports_block_linear; @@ -447,6 +447,12 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc); #define DC_DISP_SD_HW_K_VALUES 0x4dd #define DC_DISP_SD_MAN_K_VALUES0x4de +#define DC_DISP_BLEND_BACKGROUND_COLOR 0x4e4 +#define BACKGROUND_COLOR_ALPHA(x) (((x) & 0xff) << 24) +#define BACKGROUND_COLOR_BLUE(x) (((x) & 0xff) << 16) +#define BACKGROUND_COLOR_GREEN(x) (((x) & 0xff) << 8) +#define BACKGROUND_COLOR_RED(x) (((x) & 0xff) << 0) + #define DC_DISP_INTERLACE_CONTROL 0x4e5 #define INTERLACE_STATUS (1 << 2) #define INTERLACE_START (1 << 1) -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 08/13] drm/tegra: hdmi: Register debugfs in ->late_register()
From: Thierry Reding The ->late_register() and ->early_unregister() callbacks are called at the right time to make sure userspace only accesses interfaces when it should. Move debugfs registration and unregistration to these callback functions to avoid potential races with userspace. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/hdmi.c | 510 +-- 1 file changed, 245 insertions(+), 265 deletions(-) diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index a68d80476e46..784739a9f497 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -79,8 +79,6 @@ struct tegra_hdmi { bool dvi; struct drm_info_list *debugfs_files; - struct drm_minor *minor; - struct dentry *debugfs; }; static inline struct tegra_hdmi * @@ -910,6 +908,249 @@ tegra_hdmi_connector_detect(struct drm_connector *connector, bool force) return status; } +#define DEBUGFS_REG32(_name) { .name = #_name, .offset = _name } + +static const struct debugfs_reg32 tegra_hdmi_regs[] = { + DEBUGFS_REG32(HDMI_CTXSW), + DEBUGFS_REG32(HDMI_NV_PDISP_SOR_STATE0), + DEBUGFS_REG32(HDMI_NV_PDISP_SOR_STATE1), + DEBUGFS_REG32(HDMI_NV_PDISP_SOR_STATE2), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AN_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AN_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CN_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CN_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_AKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_BKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_BKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_DKSV_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_DKSV_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CMODE), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_MPRIME_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_MPRIME_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_SPRIME_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_SPRIME_LSB2), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_SPRIME_LSB1), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_RI), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CS_MSB), + DEBUGFS_REG32(HDMI_NV_PDISP_RG_HDCP_CS_LSB), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU0), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU_RDATA0), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU1), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_EMU2), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_STATUS), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_STATUS), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_HEADER), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_STATUS), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_HEADER), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK0_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK0_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK1_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK1_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK2_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK2_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK3_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_GENERIC_SUBPACK3_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_CTRL), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0882_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0882_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_1764_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_1764_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0480_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0480_SUBPACK_HIGH), + DEBUGFS_REG32(HDMI_NV_PDISP_HDMI_ACR_0960_SUBPACK_LOW), + DEBUGFS_REG32(HDMI_NV_PDISP_HD
[PATCH 09/13] drm/tegra: sor: Root debugfs files at the connector
From: Thierry Reding Rather create new files within the top-level DRM device's debugfs node, add the SOR specific files to the connector's debugfs node. This avoids the need to come up with subdirectory names and is also more intuitive. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 75b21dbaa8f0..f40fc987900c 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -184,7 +184,6 @@ struct tegra_sor { struct drm_info_list *debugfs_files; struct drm_minor *minor; - struct dentry *debugfs; const struct tegra_sor_ops *ops; @@ -1260,14 +1259,10 @@ static const struct drm_info_list debugfs_files[] = { static int tegra_sor_debugfs_init(struct tegra_sor *sor, struct drm_minor *minor) { - const char *name = sor->soc->supports_dp ? "sor1" : "sor"; + struct dentry *root = sor->output.connector.debugfs_entry; unsigned int i; int err; - sor->debugfs = debugfs_create_dir(name, minor->debugfs_root); - if (!sor->debugfs) - return -ENOMEM; - sor->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files), GFP_KERNEL); if (!sor->debugfs_files) { @@ -1280,7 +1275,7 @@ static int tegra_sor_debugfs_init(struct tegra_sor *sor, err = drm_debugfs_create_files(sor->debugfs_files, ARRAY_SIZE(debugfs_files), - sor->debugfs, minor); + root, minor); if (err < 0) goto free; @@ -1292,13 +1287,14 @@ static int tegra_sor_debugfs_init(struct tegra_sor *sor, kfree(sor->debugfs_files); sor->debugfs_files = NULL; remove: - debugfs_remove_recursive(sor->debugfs); - sor->debugfs = NULL; + debugfs_remove_recursive(root); return err; } static void tegra_sor_debugfs_exit(struct tegra_sor *sor) { + struct dentry *root = sor->output.connector.debugfs_entry; + drm_debugfs_remove_files(sor->debugfs_files, ARRAY_SIZE(debugfs_files), sor->minor); sor->minor = NULL; @@ -1306,8 +1302,7 @@ static void tegra_sor_debugfs_exit(struct tegra_sor *sor) kfree(sor->debugfs_files); sor->debugfs_files = NULL; - debugfs_remove_recursive(sor->debugfs); - sor->debugfs = NULL; + debugfs_remove_recursive(root); } static void tegra_sor_connector_reset(struct drm_connector *connector) -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 10/13] drm/tegra: sor: Register debugfs in ->late_register()
From: Thierry Reding The ->late_register() and ->early_unregister() callbacks are called at the right time to make sure userspace only accesses interfaces when it should. Move debugfs registration and unregistration to these callback functions to avoid potential races with userspace. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 53 - 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index f40fc987900c..2fba6c2bd486 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -183,7 +183,6 @@ struct tegra_sor { struct drm_dp_aux *aux; struct drm_info_list *debugfs_files; - struct drm_minor *minor; const struct tegra_sor_ops *ops; @@ -1256,53 +1255,46 @@ static const struct drm_info_list debugfs_files[] = { { "regs", tegra_sor_show_regs, 0, NULL }, }; -static int tegra_sor_debugfs_init(struct tegra_sor *sor, - struct drm_minor *minor) +static int tegra_sor_late_register(struct drm_connector *connector) { - struct dentry *root = sor->output.connector.debugfs_entry; - unsigned int i; + struct tegra_output *output = connector_to_output(connector); + unsigned int i, count = ARRAY_SIZE(debugfs_files); + struct drm_minor *minor = connector->dev->primary; + struct dentry *root = connector->debugfs_entry; + struct tegra_sor *sor = to_sor(output); int err; sor->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files), GFP_KERNEL); - if (!sor->debugfs_files) { - err = -ENOMEM; - goto remove; - } + if (!sor->debugfs_files) + return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(debugfs_files); i++) + for (i = 0; i < count; i++) sor->debugfs_files[i].data = sor; - err = drm_debugfs_create_files(sor->debugfs_files, - ARRAY_SIZE(debugfs_files), - root, minor); + err = drm_debugfs_create_files(sor->debugfs_files, count, root, minor); if (err < 0) goto free; - sor->minor = minor; - return 0; free: kfree(sor->debugfs_files); sor->debugfs_files = NULL; -remove: - debugfs_remove_recursive(root); + return err; } -static void tegra_sor_debugfs_exit(struct tegra_sor *sor) +static void tegra_sor_early_unregister(struct drm_connector *connector) { - struct dentry *root = sor->output.connector.debugfs_entry; - - drm_debugfs_remove_files(sor->debugfs_files, ARRAY_SIZE(debugfs_files), -sor->minor); - sor->minor = NULL; + struct tegra_output *output = connector_to_output(connector); + unsigned int count = ARRAY_SIZE(debugfs_files); + struct tegra_sor *sor = to_sor(output); + drm_debugfs_remove_files(sor->debugfs_files, count, +connector->dev->primary); kfree(sor->debugfs_files); sor->debugfs_files = NULL; - - debugfs_remove_recursive(root); } static void tegra_sor_connector_reset(struct drm_connector *connector) @@ -1355,6 +1347,8 @@ static const struct drm_connector_funcs tegra_sor_connector_funcs = { .destroy = tegra_output_connector_destroy, .atomic_duplicate_state = tegra_sor_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, + .late_register = tegra_sor_late_register, + .early_unregister = tegra_sor_early_unregister, }; static int tegra_sor_connector_get_modes(struct drm_connector *connector) @@ -2347,12 +2341,6 @@ static int tegra_sor_init(struct host1x_client *client) sor->output.encoder.possible_crtcs = 0x3; - if (IS_ENABLED(CONFIG_DEBUG_FS)) { - err = tegra_sor_debugfs_init(sor, drm->primary); - if (err < 0) - dev_err(sor->dev, "debugfs setup failed: %d\n", err); - } - if (sor->aux) { err = drm_dp_aux_attach(sor->aux, &sor->output); if (err < 0) { @@ -2421,9 +2409,6 @@ static int tegra_sor_exit(struct host1x_client *client) clk_disable_unprepare(sor->clk_dp); clk_disable_unprepare(sor->clk); - if (IS_ENABLED(CONFIG_DEBUG_FS)) - tegra_sor_debugfs_exit(sor); - return 0; } -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 12/13] drm/tegra: vic: Properly align arguments
From: Thierry Reding Properly align function arguments on subsequent lines with the first argument on the first line. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/vic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 18024183aa2b..d9664a34fb43 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -115,7 +115,7 @@ static int vic_boot(struct vic *vic) } static void *vic_falcon_alloc(struct falcon *falcon, size_t size, - dma_addr_t *iova) + dma_addr_t *iova) { struct tegra_drm *tegra = falcon->data; -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: RFC: page-flip with damage?
On Mon, Nov 27, 2017 at 10:59:49AM +0100, Thomas Hellstrom wrote: > On 11/27/2017 09:25 AM, Daniel Vetter wrote: > > On Mon, Nov 27, 2017 at 09:03:22AM +0100, Thomas Hellstrom wrote: > > > On 09/26/2017 10:18 AM, Daniel Vetter wrote: > > > > On Sun, Sep 24, 2017 at 07:41:45PM +0200, Thomas Hellstrom wrote: > > > > > Hi, list! > > > > > > > > > > Page flips, while efficient on real hardware, aren't that efficient > > > > > in other > > > > > situations, like for virtual devices with local, or even worse, remote > > > > > desktops. > > > > > We might ending up forwarding or encoding a couple of full frames > > > > > worth of > > > > > data instead of a small region at a cursor blink. > > > > > > > > > > Now there is this extension EGL_KHR_swap_buffers_with_damage, and > > > > > gnome-shell/wayland on KMS also has a damage region that it forwards > > > > > all the > > > > > way down to the function where page-flip is called. > > > > > > > > > > So I'd like to start looking at page-flips with damage, meaning that > > > > > the > > > > > damage is an optional hint to the device about what part of the > > > > > contents is > > > > > actually updated. What would be the best way to implement this? I > > > > > figure > > > > > this can be done within the atomic context with a region attached to > > > > > the > > > > > plane state? Would we want to follow the EGL extension and forward an > > > > > array > > > > > of rects or for simplicity use a single bounding box? Both these > > > > > options > > > > > would be a great win. > > > > So my rough plan for all this was: > > > > > > > > - Add damage to drm_crtc_state, in screen coordinates. I think this is > > > > the > > > > most natural place for this, since it's what PSR/manual upload DSI > > > > want. > > > > It should also fit well for udl and tinydrm. Virtual drivers like > > > > vmwgfx might need helpers to wrap this back to framebuffer > > > > rectangles, > > > > but that seems the odd case out - the framebuffer-based approach in > > > > the > > > > DIRTY_IOCTL forces most drivers to do a fancy lookup from fb to the > > > > crtc. > > > > > > > > Per-plane dirty rectangle seems to be an awkward in-betwen state, > > > > with > > > > all the confusion about whether it's pre/post scaled and how to best > > > > combine them. And then someone changes the background color of the > > > > crtc > > > > (or something like that), what happens then? I think pushing all > > > > that > > > > onto userspace is best, it can always ask for a complete flip if > > > > it's > > > > unclear whether it damaged the entire screen or not. > > > Actually, after looking into this a bit in the context of remoting, I > > > think > > > I will have to disagree. > > > > > > The most natural place for damage appears to be the drm_plane state, in > > > plane fb coordinates. > > > The reason for this is that devices with hardware planes will want to have > > > the coordinates in this way. Think cursor, Video overlay. Currently with > > > vmwgfx and atomic we need to send the cursor image down the device > > > pipeline > > > on each cursor move which is pretty nasty. > > > Same thing holds for video overlay if we decide to move it to atomic. The > > > overlay engine wants to know what part of the source image > > > has changed. > > > Damage is triggered by a content change and the change lives in the > > > framebuffer, and this is easier on user-space as well. > > > > > > Now for software plane compositing, you might be hitting the problems you > > > describe above. > > > But if you're doing software plane compositing in your drm driver (which > > > you > > > probably aren't), > > > you'd have enough information anyway to handle both the odd case of > > > background color change and any scaling if present (god forbid). > > The one thing I'm somewhat worried about with per-plane damage rects is > > correctly adding them up into an overall crtc rect for hw that needs it > > (that's edp and manual upload dsi). There's some fixed point math involved > > first to get from plane src to crtc dst coords, and then there's the fun > > of figuring out which properties affect the entire screen or entire plane > > (background, gamma tables, ...). > > > > But I guess we can do that in a helper and share that code with all > > drivers that need it. > > > > I think we have 2 different kinds of drivers which would benefit from > > this: > > > > - drivers that composite on the "display"/remotely (like vmwgfx, or maybe > >also spice): Want damage in plane source coordinates. I think we could > >also group udl and spi/i2c-connected screens into this, since you can do > >the same buffer upload dance. Those drivers also might benefit from a > >list of rectangles (assuming the rectangles aren't too small). At least > >e.g. udl has a hw cursor which is also composited remotely. > > > > - hw drivers where the selective uplo
[PATCH 00/12] drm/tegra: Basic Tegra186 support
From: Thierry Reding Hi, this series adds support for display and HDMI on Tegra186. The initial 6 patches are preparatory work to move code around and make the subsequent patches easier to review. Patch 7 introduces the display hub driver which controls resources shared between all display controllers and patch 8 extends the display controller driver with Tegra186 support. Some changes to the registers are backwards incompatible, but this can be dealt with with a bit of parameterization of code and register offsets. Finally, the SOR driver is also parameterized to take into account some changes on Tegra186 and the last patch in the series enables support for HDMI 2.0 modes using the SCDC helpers. Thierry Thierry Reding (12): drm/tegra: dc: Remove tegra_primary_plane_destroy() drm/tegra: dc: Remove duplicate plane funcs drm/tegra: dc: Remove tegra_overlay_plane_destroy() drm/tegra: dc: Remove duplicate plane funcs drm/tegra: dc: Move state definition to header drm/tegra: Move common plane code to separate file drm/tegra: Add Tegra186 display hub support drm/tegra: dc: Add Tegra186 support drm/tegra: Support ARGB and ABGR formats drm/tegra: sor: Parameterize register offsets drm/tegra: sor: Add Tegra186 support drm/tegra: sor: Support HDMI 2.0 modes drivers/gpu/drm/tegra/Makefile | 2 + drivers/gpu/drm/tegra/dc.c | 549 +--- drivers/gpu/drm/tegra/dc.h | 237 ++-- drivers/gpu/drm/tegra/drm.c| 70 +++- drivers/gpu/drm/tegra/drm.h| 21 ++ drivers/gpu/drm/tegra/hub.c| 808 + drivers/gpu/drm/tegra/hub.h| 82 + drivers/gpu/drm/tegra/output.c | 24 ++ drivers/gpu/drm/tegra/plane.c | 188 ++ drivers/gpu/drm/tegra/plane.h | 61 drivers/gpu/drm/tegra/sor.c| 805 +--- drivers/gpu/drm/tegra/sor.h| 16 + 12 files changed, 2329 insertions(+), 534 deletions(-) create mode 100644 drivers/gpu/drm/tegra/hub.c create mode 100644 drivers/gpu/drm/tegra/hub.h create mode 100644 drivers/gpu/drm/tegra/plane.c create mode 100644 drivers/gpu/drm/tegra/plane.h -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 02/12] drm/tegra: dc: Remove duplicate plane funcs
From: Thierry Reding Both tegra_primary_plane_funcs and tegra_cursor_plane_funcs are identical. Get rid of the duplicate and use one set of function pointers for all planes. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 552710f5c386..2b7ece1d0c18 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -458,7 +458,7 @@ static void tegra_plane_atomic_destroy_state(struct drm_plane *plane, kfree(state); } -static const struct drm_plane_funcs tegra_primary_plane_funcs = { +static const struct drm_plane_funcs tegra_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = tegra_plane_destroy, @@ -673,7 +673,7 @@ static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, formats = tegra_primary_plane_formats; err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, - &tegra_primary_plane_funcs, formats, + &tegra_plane_funcs, formats, num_formats, NULL, DRM_PLANE_TYPE_PRIMARY, NULL); if (err < 0) { @@ -799,15 +799,6 @@ static void tegra_cursor_atomic_disable(struct drm_plane *plane, tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); } -static const struct drm_plane_funcs tegra_cursor_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = tegra_plane_destroy, - .reset = tegra_plane_reset, - .atomic_duplicate_state = tegra_plane_atomic_duplicate_state, - .atomic_destroy_state = tegra_plane_atomic_destroy_state, -}; - static const struct drm_plane_helper_funcs tegra_cursor_plane_helper_funcs = { .atomic_check = tegra_cursor_atomic_check, .atomic_update = tegra_cursor_atomic_update, @@ -840,7 +831,7 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, formats = tegra_cursor_plane_formats; err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, - &tegra_cursor_plane_funcs, formats, + &tegra_plane_funcs, formats, num_formats, NULL, DRM_PLANE_TYPE_CURSOR, NULL); if (err < 0) { -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 03/12] drm/tegra: dc: Remove tegra_overlay_plane_destroy()
From: Thierry Reding This function is a simple wrapper around tegra_plane_destroy(), so it can be dropped. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 2b7ece1d0c18..fdffab7e41b9 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -844,15 +844,10 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, return &plane->base; } -static void tegra_overlay_plane_destroy(struct drm_plane *plane) -{ - tegra_plane_destroy(plane); -} - static const struct drm_plane_funcs tegra_overlay_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, - .destroy = tegra_overlay_plane_destroy, + .destroy = tegra_plane_destroy, .reset = tegra_plane_reset, .atomic_duplicate_state = tegra_plane_atomic_duplicate_state, .atomic_destroy_state = tegra_plane_atomic_destroy_state, -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/12] drm/tegra: dc: Move state definition to header
From: Thierry Reding Move the display controller state definition to the header file so that it can be referenced by other files. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 18 -- drivers/gpu/drm/tegra/dc.h | 18 ++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 1075b4e06834..88b8d137726e 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -34,24 +34,6 @@ static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane) return container_of(plane, struct tegra_plane, base); } -struct tegra_dc_state { - struct drm_crtc_state base; - - struct clk *clk; - unsigned long pclk; - unsigned int div; - - u32 planes; -}; - -static inline struct tegra_dc_state *to_dc_state(struct drm_crtc_state *state) -{ - if (state) - return container_of(state, struct tegra_dc_state, base); - - return NULL; -} - struct tegra_plane_state { struct drm_plane_state base; diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 6e46e4aed10b..b65dfbb0af89 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -18,6 +18,24 @@ struct tegra_output; +struct tegra_dc_state { + struct drm_crtc_state base; + + struct clk *clk; + unsigned long pclk; + unsigned int div; + + u32 planes; +}; + +static inline struct tegra_dc_state *to_dc_state(struct drm_crtc_state *state) +{ + if (state) + return container_of(state, struct tegra_dc_state, base); + + return NULL; +} + struct tegra_dc_stats { unsigned long frames; unsigned long vblank; -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 06/12] drm/tegra: Move common plane code to separate file
From: Thierry Reding Subsequent patches will add support for Tegra186 which has a different architecture and needs different plane code but which can share a lot of code with earlier Tegra support. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/Makefile | 1 + drivers/gpu/drm/tegra/dc.c | 199 ++--- drivers/gpu/drm/tegra/plane.c | 180 + drivers/gpu/drm/tegra/plane.h | 59 4 files changed, 245 insertions(+), 194 deletions(-) create mode 100644 drivers/gpu/drm/tegra/plane.c create mode 100644 drivers/gpu/drm/tegra/plane.h diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile index 46d65d39214d..a47784765217 100644 --- a/drivers/gpu/drm/tegra/Makefile +++ b/drivers/gpu/drm/tegra/Makefile @@ -5,6 +5,7 @@ tegra-drm-y := \ drm.o \ gem.o \ fb.o \ + plane.o \ dc.o \ output.o \ rgb.o \ diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 88b8d137726e..d2c7a3481022 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -19,38 +19,12 @@ #include "dc.h" #include "drm.h" #include "gem.h" +#include "plane.h" #include #include #include -struct tegra_plane { - struct drm_plane base; - unsigned int index; -}; - -static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane) -{ - return container_of(plane, struct tegra_plane, base); -} - -struct tegra_plane_state { - struct drm_plane_state base; - - struct tegra_bo_tiling tiling; - u32 format; - u32 swap; -}; - -static inline struct tegra_plane_state * -to_tegra_plane_state(struct drm_plane_state *state) -{ - if (state) - return container_of(state, struct tegra_plane_state, base); - - return NULL; -} - static void tegra_dc_stats_reset(struct tegra_dc_stats *stats) { stats->frames = 0; @@ -97,81 +71,6 @@ void tegra_dc_commit(struct tegra_dc *dc) tegra_dc_writel(dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); } -static int tegra_dc_format(u32 fourcc, u32 *format, u32 *swap) -{ - /* assume no swapping of fetched data */ - if (swap) - *swap = BYTE_SWAP_NOSWAP; - - switch (fourcc) { - case DRM_FORMAT_XBGR: - *format = WIN_COLOR_DEPTH_R8G8B8A8; - break; - - case DRM_FORMAT_XRGB: - *format = WIN_COLOR_DEPTH_B8G8R8A8; - break; - - case DRM_FORMAT_RGB565: - *format = WIN_COLOR_DEPTH_B5G6R5; - break; - - case DRM_FORMAT_UYVY: - *format = WIN_COLOR_DEPTH_YCbCr422; - break; - - case DRM_FORMAT_YUYV: - if (swap) - *swap = BYTE_SWAP_SWAP2; - - *format = WIN_COLOR_DEPTH_YCbCr422; - break; - - case DRM_FORMAT_YUV420: - *format = WIN_COLOR_DEPTH_YCbCr420P; - break; - - case DRM_FORMAT_YUV422: - *format = WIN_COLOR_DEPTH_YCbCr422P; - break; - - default: - return -EINVAL; - } - - return 0; -} - -static bool tegra_dc_format_is_yuv(unsigned int format, bool *planar) -{ - switch (format) { - case WIN_COLOR_DEPTH_YCbCr422: - case WIN_COLOR_DEPTH_YUV422: - if (planar) - *planar = false; - - return true; - - case WIN_COLOR_DEPTH_YCbCr420P: - case WIN_COLOR_DEPTH_YUV420P: - case WIN_COLOR_DEPTH_YCbCr422P: - case WIN_COLOR_DEPTH_YUV422P: - case WIN_COLOR_DEPTH_YCbCr422R: - case WIN_COLOR_DEPTH_YUV422R: - case WIN_COLOR_DEPTH_YCbCr422RA: - case WIN_COLOR_DEPTH_YUV422RA: - if (planar) - *planar = true; - - return true; - } - - if (planar) - *planar = false; - - return false; -} - static inline u32 compute_dda_inc(unsigned int in, unsigned int out, bool v, unsigned int bpp) { @@ -223,7 +122,7 @@ static void tegra_dc_setup_window(struct tegra_dc *dc, unsigned int index, * For YUV planar modes, the number of bytes per pixel takes into * account only the luma component and therefore is 1. */ - yuv = tegra_dc_format_is_yuv(window->format, &planar); + yuv = tegra_plane_format_is_yuv(window->format, &planar); if (!yuv) bpp = window->bits_per_pixel / 8; else @@ -385,101 +284,12 @@ static void tegra_dc_setup_window(struct tegra_dc *dc, unsigned int index, spin_unlock_irqrestore(&dc->lock, flags); } -static void tegra_plane_destroy(struct drm_plane *plane) -{ - struct tegra_plane *p = to_tegra_plane(plane); - - drm_plane_cleanup(plane); - kfree(p); -} - static const u32 tegra_primary_plane_formats[] = {
[PATCH 04/12] drm/tegra: dc: Remove duplicate plane funcs
From: Thierry Reding Both tegra_overlay_plane_funcs is identical to tegra_plane_funcs. Get rid of the duplicate and use one set of function pointers for all planes. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index fdffab7e41b9..1075b4e06834 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -844,15 +844,6 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, return &plane->base; } -static const struct drm_plane_funcs tegra_overlay_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = tegra_plane_destroy, - .reset = tegra_plane_reset, - .atomic_duplicate_state = tegra_plane_atomic_duplicate_state, - .atomic_destroy_state = tegra_plane_atomic_destroy_state, -}; - static const uint32_t tegra_overlay_plane_formats[] = { DRM_FORMAT_XBGR, DRM_FORMAT_XRGB, @@ -882,7 +873,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, formats = tegra_overlay_plane_formats; err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, - &tegra_overlay_plane_funcs, formats, + &tegra_plane_funcs, formats, num_formats, NULL, DRM_PLANE_TYPE_OVERLAY, NULL); if (err < 0) { -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 08/12] drm/tegra: dc: Add Tegra186 support
From: Thierry Reding The display architecture has changed in several signifcant ways with the new Tegra186 SoC. Display controllers are a completely different design, but have been given a frontend that simulates the register interface for earlier chips. Unfortunately the frontend isn't completely backwards compatible, so the driver needs parameterization to take the changes into account. One big change is that the total number of display controllers has been increased to three. At the same time the number of planes available has remained constant. However, planes can now be freely assigned between the display controllers, giving applications more flexibility in making the best use of the available resources. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 250 +++- drivers/gpu/drm/tegra/dc.h | 98 +++-- drivers/gpu/drm/tegra/drm.c | 1 + 3 files changed, 267 insertions(+), 82 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 0ba1bf7f7615..2d54657b538e 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -19,6 +19,7 @@ #include "dc.h" #include "drm.h" #include "gem.h" +#include "hub.h" #include "plane.h" #include @@ -437,8 +438,8 @@ static const struct drm_plane_helper_funcs tegra_plane_helper_funcs = { .prepare_fb = tegra_plane_prepare_fb, }; -static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, - struct tegra_dc *dc) +static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, + struct tegra_dc *dc) { /* * Ideally this would use drm_crtc_mask(), but that would require the @@ -453,6 +454,7 @@ static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, * the same as drm_crtc_index() after registration. */ unsigned long possible_crtcs = 1 << drm->mode_config.num_crtc; + enum drm_plane_type type = DRM_PLANE_TYPE_PRIMARY; struct tegra_plane *plane; unsigned int num_formats; const u32 *formats; @@ -476,8 +478,7 @@ static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, &tegra_plane_funcs, formats, - num_formats, NULL, - DRM_PLANE_TYPE_PRIMARY, NULL); + num_formats, NULL, type, NULL); if (err < 0) { kfree(plane); return ERR_PTR(err); @@ -691,18 +692,61 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, return &plane->base; } -static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) +static struct drm_plane *tegra_dc_add_shared_planes(struct drm_device *drm, + struct tegra_dc *dc) +{ + struct drm_plane *plane, *primary = NULL; + unsigned int i, j; + + for (i = 0; i < dc->soc->num_wgrps; i++) { + const struct tegra_windowgroup_soc *wgrp = &dc->soc->wgrps[i]; + + if (wgrp->dc == dc->pipe) { + for (j = 0; j < wgrp->num_windows; j++) { + unsigned int index = wgrp->windows[j]; + + plane = tegra_shared_plane_create(drm, dc, + wgrp->index, + index); + if (IS_ERR(plane)) + return plane; + + /* +* Choose the first shared plane owned by this +* head as the primary plane. +*/ + if (!primary) { + plane->type = DRM_PLANE_TYPE_PRIMARY; + primary = plane; + } + } + } + } + + return primary; +} + +static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm, +struct tegra_dc *dc) { - struct drm_plane *plane; + struct drm_plane *plane, *primary; unsigned int i; + primary = tegra_primary_plane_create(drm, dc); + if (IS_ERR(primary)) + return primary; + for (i = 0; i < 2; i++) { plane = tegra_dc_overlay_plane_create(drm, dc, 1 + i); - if (IS_ERR(plane)) - return PTR_ERR(plane); + if (IS_ERR(plane)) { + /* XXX tegra_plane_destroy()
[PATCH 01/12] drm/tegra: dc: Remove tegra_primary_plane_destroy()
From: Thierry Reding This function is a simple wrapper around tegra_plane_destroy(), so it can be dropped. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f825c39888f9..552710f5c386 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -417,11 +417,6 @@ static const u32 tegra_primary_plane_formats[] = { DRM_FORMAT_RGB565, }; -static void tegra_primary_plane_destroy(struct drm_plane *plane) -{ - tegra_plane_destroy(plane); -} - static void tegra_plane_reset(struct drm_plane *plane) { struct tegra_plane_state *state; @@ -466,7 +461,7 @@ static void tegra_plane_atomic_destroy_state(struct drm_plane *plane, static const struct drm_plane_funcs tegra_primary_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, - .destroy = tegra_primary_plane_destroy, + .destroy = tegra_plane_destroy, .reset = tegra_plane_reset, .atomic_duplicate_state = tegra_plane_atomic_duplicate_state, .atomic_destroy_state = tegra_plane_atomic_destroy_state, -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 07/12] drm/tegra: Add Tegra186 display hub support
From: Thierry Reding The display architecture has changed in several significant ways with the new Tegra186 SoC. Shared between all display controllers is a set of common resources referred to as the display hub. The hub generates accesses to memory and feeds them into various composition pipelines, each of which being a window that can be assigned to arbitrary heads. Atomic state is subclassed in order to track the global bandwidth requirements and select and adjust the hub clocks appropriately. The plane code is shared to a large degree with earlier SoC generations, except where the programming differs. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/Makefile | 1 + drivers/gpu/drm/tegra/dc.c | 31 ++ drivers/gpu/drm/tegra/dc.h | 114 ++ drivers/gpu/drm/tegra/drm.c| 67 +++- drivers/gpu/drm/tegra/drm.h| 19 + drivers/gpu/drm/tegra/hub.c| 808 + drivers/gpu/drm/tegra/hub.h| 82 + drivers/gpu/drm/tegra/plane.h | 2 + 8 files changed, 1121 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/tegra/hub.c create mode 100644 drivers/gpu/drm/tegra/hub.h diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile index a47784765217..2e0d6213f6bc 100644 --- a/drivers/gpu/drm/tegra/Makefile +++ b/drivers/gpu/drm/tegra/Makefile @@ -5,6 +5,7 @@ tegra-drm-y := \ drm.o \ gem.o \ fb.o \ + hub.o \ plane.o \ dc.o \ output.o \ diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index d2c7a3481022..0ba1bf7f7615 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -465,6 +465,15 @@ static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, num_formats = ARRAY_SIZE(tegra_primary_plane_formats); formats = tegra_primary_plane_formats; + /* +* XXX compute offset so that we can directly access windows. +* +* Always use window A as primary window. +*/ + plane->offset = 0; + plane->index = 0; + plane->depth = 255; + err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, &tegra_plane_funcs, formats, num_formats, NULL, @@ -660,7 +669,10 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, if (!plane) return ERR_PTR(-ENOMEM); + /* XXX compute offset so that we can directly access windows */ + plane->offset = 0; plane->index = index; + plane->depth = 0; num_formats = ARRAY_SIZE(tegra_overlay_plane_formats); formats = tegra_overlay_plane_formats; @@ -1401,6 +1413,25 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc, static int tegra_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { + struct tegra_atomic_state *s = to_tegra_atomic_state(state->state); + struct tegra_dc_state *tegra = to_dc_state(state); + + /* +* The display hub display clock needs to be fed by the display clock +* with the highest frequency to ensure proper functioning of all the +* displays. +* +* Note that this isn't used before Tegra186, but it doesn't hurt and +* conditionalizing it would make the code less clean. +*/ + if (state->active) { + if (!s->clk_disp || tegra->pclk > s->rate) { + s->dc = to_tegra_dc(crtc); + s->clk_disp = s->dc->clk; + s->rate = tegra->pclk; + } + } + return 0; } diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index b65dfbb0af89..22c5091006bc 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -209,6 +209,8 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc); #define WIN_B_UPDATE(1 << 10) #define WIN_C_UPDATE(1 << 11) #define CURSOR_UPDATE (1 << 15) +#define COMMON_ACTREQ (1 << 16) +#define COMMON_UPDATE (1 << 17) #define NC_HOST_TRIG(1 << 24) #define DC_CMD_DISPLAY_WINDOW_HEADER 0x042 @@ -486,6 +488,35 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc); #define CURSOR_SRC_BLEND_MASK (3 << 8) #define CURSOR_ALPHA 0xff +#define DC_WIN_CORE_ACT_CONTROL 0x50e +#define VCOUNTER (0 << 0) +#define HCOUNTER (1 << 0) + +#define DC_WIN_CORE_IHUB_WGRP_LATENCY_CTLA 0x543 +#define LATENCY_CTL_MODE_ENABLE (1 << 2) + +#define DC_WIN_CORE_IHUB_WGRP_LATENCY_CTLB 0x544 +#define WATERMARK_MASK 0x1fff + +#define DC_WIN_CORE_PRECOMP_WGRP_PIPE_METER 0x560 +#define PIPE_METER_INT(x) (((x) & 0xff) << 8) +#define PIPE_METER_FRAC(x) (((x) & 0xff) << 0) + +#define DC_WIN_CORE_IHUB_WGRP_POOL_CONFIG 0x561 +#define MEMPOOL_ENTRIES(x) (((x) & 0x) << 0) + +#define DC_WIN_CORE_IH
[PATCH 11/12] drm/tegra: sor: Add Tegra186 support
From: Thierry Reding The SOR found on Tegra186 is very similar to the one found on Tegra210 and earlier. However, due to some changes in the display architecture, some programming sequences have changed and some register have moved around. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 13 ++ drivers/gpu/drm/tegra/dc.h | 5 +- drivers/gpu/drm/tegra/drm.c| 2 + drivers/gpu/drm/tegra/drm.h| 2 + drivers/gpu/drm/tegra/output.c | 24 +++ drivers/gpu/drm/tegra/sor.c| 479 ++--- drivers/gpu/drm/tegra/sor.h| 12 ++ 7 files changed, 414 insertions(+), 123 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index e40272493235..bf7fcb93fc17 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -54,6 +54,19 @@ static u32 tegra_dc_readl_active(struct tegra_dc *dc, unsigned long offset) return value; } +bool tegra_dc_has_output(struct tegra_dc *dc, struct device *dev) +{ + struct device_node *np = dc->dev->of_node; + struct of_phandle_iterator it; + int err; + + of_for_each_phandle(&it, err, np, "nvidia,outputs", NULL, 0) + if (it.node == dev->of_node) + return true; + + return false; +} + /* * Double-buffered registers have two copies: ASSEMBLY and ACTIVE. When the * *_ACT_REQ bits are set the ASSEMBLY copy is latched into the ACTIVE copy. diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 018fea74fb50..336d2c22f521 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -141,6 +141,7 @@ struct tegra_dc_window { }; /* from dc.c */ +bool tegra_dc_has_output(struct tegra_dc *dc, struct device *dev); void tegra_dc_commit(struct tegra_dc *dc); int tegra_dc_state_setup_clock(struct tegra_dc *dc, struct drm_crtc_state *crtc_state, @@ -289,10 +290,10 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc); #define HDMI_ENABLE(1 << 30) #define DSI_ENABLE (1 << 29) #define SOR1_TIMING_CYA(1 << 27) -#define SOR1_ENABLE(1 << 26) -#define SOR_ENABLE (1 << 25) #define CURSOR_ENABLE (1 << 16) +#define SOR_ENABLE(x) (1 << (25 + (x))) + #define DC_DISP_DISP_MEM_HIGH_PRIORITY 0x403 #define CURSOR_THRESHOLD(x) (((x) & 0x03) << 24) #define WINDOW_A_THRESHOLD(x) (((x) & 0x7f) << 16) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index edd440504876..5d9bfcf65161 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1347,6 +1347,8 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra210-vic", }, { .compatible = "nvidia,tegra186-display", }, { .compatible = "nvidia,tegra186-dc", }, + { .compatible = "nvidia,tegra186-sor", }, + { .compatible = "nvidia,tegra186-sor1", }, { .compatible = "nvidia,tegra186-vic", }, { /* sentinel */ } }; diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 4073bad48f14..da3d8c141aee 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -165,6 +165,8 @@ int tegra_output_probe(struct tegra_output *output); void tegra_output_remove(struct tegra_output *output); int tegra_output_init(struct drm_device *drm, struct tegra_output *output); void tegra_output_exit(struct tegra_output *output); +void tegra_output_find_possible_crtcs(struct tegra_output *output, + struct drm_device *drm); int tegra_output_connector_get_modes(struct drm_connector *connector); enum drm_connector_status diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 1cfbacea8113..0ab076819df9 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -9,7 +9,9 @@ #include #include + #include "drm.h" +#include "dc.h" #include @@ -219,3 +221,25 @@ void tegra_output_exit(struct tegra_output *output) if (output->panel) drm_panel_detach(output->panel); } + +void tegra_output_find_possible_crtcs(struct tegra_output *output, + struct drm_device *drm) +{ + struct device *dev = output->dev; + struct drm_crtc *crtc; + unsigned int mask = 0; + + drm_for_each_crtc(crtc, drm) { + struct tegra_dc *dc = to_tegra_dc(crtc); + + if (tegra_dc_has_output(dc, dev)) + mask |= drm_crtc_mask(crtc); + } + + if (mask == 0) { + dev_warn(dev, "missing output definition for heads in DT\n"); + mask = 0x3; + } + + output->encoder.possible_crtcs = mask; +} diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index d51399587aca..91fd0a48dcaa 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -34,11 +34,16 @@ struct tegra_sor_hdmi_s
[PATCH 12/12] drm/tegra: sor: Support HDMI 2.0 modes
From: Thierry Reding Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 121 +--- drivers/gpu/drm/tegra/sor.h | 4 ++ 2 files changed, 119 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 91fd0a48dcaa..d3cc25fcccdd 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "dc.h" #include "drm.h" @@ -342,11 +343,16 @@ struct tegra_sor { struct regulator *avdd_io_supply; struct regulator *vdd_pll_supply; struct regulator *hdmi_supply; + + struct delayed_work scdc; + bool scdc_enabled; }; struct tegra_sor_state { struct drm_connector_state base; + unsigned int link_speed; + unsigned long pclk; unsigned int bpc; }; @@ -1481,10 +1487,6 @@ static enum drm_mode_status tegra_sor_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { - /* HDMI 2.0 modes are not yet supported */ - if (mode->clock > 34) - return MODE_NOCLOCK; - return MODE_OK; } @@ -1909,6 +1911,18 @@ tegra_sor_encoder_atomic_check(struct drm_encoder *encoder, info = &output->connector.display_info; + /* +* For HBR2 modes, the SOR brick needs to use the x20 multiplier, so +* the pixel clock must be corrected accordingly. +*/ + if (pclk >= 34000) { + state->link_speed = 20; + state->pclk = pclk / 2; + } else { + state->link_speed = 10; + state->pclk = pclk; + } + err = tegra_dc_state_setup_clock(dc, crtc_state, sor->clk_parent, pclk, 0); if (err < 0) { @@ -2059,6 +2073,81 @@ tegra_sor_hdmi_find_settings(struct tegra_sor *sor, unsigned long frequency) return NULL; } +static void tegra_sor_hdmi_disable_scrambling(struct tegra_sor *sor) +{ + u32 value; + + value = tegra_sor_readl(sor, SOR_HDMI2_CTRL); + value &= ~SOR_HDMI2_CTRL_CLOCK_MODE_DIV_BY_4; + value &= ~SOR_HDMI2_CTRL_SCRAMBLE; + tegra_sor_writel(sor, value, SOR_HDMI2_CTRL); +} + +static void tegra_sor_hdmi_scdc_disable(struct tegra_sor *sor) +{ + struct i2c_adapter *ddc = sor->output.ddc; + + drm_scdc_set_high_tmds_clock_ratio(ddc, false); + drm_scdc_set_scrambling(ddc, false); + + tegra_sor_hdmi_disable_scrambling(sor); +} + +static void tegra_sor_hdmi_scdc_stop(struct tegra_sor *sor) +{ + if (sor->scdc_enabled) { + cancel_delayed_work_sync(&sor->scdc); + tegra_sor_hdmi_scdc_disable(sor); + } +} + +static void tegra_sor_hdmi_enable_scrambling(struct tegra_sor *sor) +{ + u32 value; + + value = tegra_sor_readl(sor, SOR_HDMI2_CTRL); + value |= SOR_HDMI2_CTRL_CLOCK_MODE_DIV_BY_4; + value |= SOR_HDMI2_CTRL_SCRAMBLE; + tegra_sor_writel(sor, value, SOR_HDMI2_CTRL); +} + +static void tegra_sor_hdmi_scdc_enable(struct tegra_sor *sor) +{ + struct i2c_adapter *ddc = sor->output.ddc; + + drm_scdc_set_high_tmds_clock_ratio(ddc, true); + drm_scdc_set_scrambling(ddc, true); + + tegra_sor_hdmi_enable_scrambling(sor); +} + +static void tegra_sor_hdmi_scdc_work(struct work_struct *work) +{ + struct tegra_sor *sor = container_of(work, struct tegra_sor, scdc.work); + struct i2c_adapter *ddc = sor->output.ddc; + + if (!drm_scdc_get_scrambling_status(ddc)) { + DRM_DEBUG_KMS("SCDC not scrambled\n"); + tegra_sor_hdmi_scdc_enable(sor); + } + + schedule_delayed_work(&sor->scdc, msecs_to_jiffies(5000)); +} + +static void tegra_sor_hdmi_scdc_start(struct tegra_sor *sor) +{ + struct drm_scdc *scdc = &sor->output.connector.display_info.hdmi.scdc; + struct drm_display_mode *mode; + + mode = &sor->output.encoder.crtc->state->adjusted_mode; + + if (mode->clock >= 34 && scdc->supported) { + schedule_delayed_work(&sor->scdc, msecs_to_jiffies(5000)); + tegra_sor_hdmi_scdc_enable(sor); + sor->scdc_enabled = true; + } +} + static void tegra_sor_hdmi_disable(struct drm_encoder *encoder) { struct tegra_output *output = encoder_to_output(encoder); @@ -2067,6 +2156,8 @@ static void tegra_sor_hdmi_disable(struct drm_encoder *encoder) u32 value; int err; + tegra_sor_hdmi_scdc_stop(sor); + err = tegra_sor_detach(sor); if (err < 0) dev_err(sor->dev, "failed to detach SOR: %d\n", err); @@ -2106,12 +2197,14 @@ static void tegra_sor_hdmi_enable(struct drm_encoder *encoder) struct tegra_sor *sor = to_sor(output); struct tegra_sor_state *state; struct drm_display_mode *mode; + unsigned long rate, pclk;
[PATCH 10/12] drm/tegra: sor: Parameterize register offsets
From: Thierry Reding Future Tegra generations have an increased number of display controllers that can drive individual SORs. In order to support that, the offset and layout of some registers has changed in backwards-incompatible ways. Use parameterized register offsets to support this. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 203 +++- 1 file changed, 127 insertions(+), 76 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 2fba6c2bd486..d51399587aca 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -144,12 +144,29 @@ static const struct tegra_sor_hdmi_settings tegra210_sor_hdmi_defaults[] = { }; #endif +struct tegra_sor_regs { + unsigned int head_state0; + unsigned int head_state1; + unsigned int head_state2; + unsigned int head_state3; + unsigned int head_state4; + unsigned int head_state5; + unsigned int pll0; + unsigned int pll1; + unsigned int pll2; + unsigned int pll3; + unsigned int dp_padctl0; + unsigned int dp_padctl2; +}; + struct tegra_sor_soc { bool supports_edp; bool supports_lvds; bool supports_hdmi; bool supports_dp; + const struct tegra_sor_regs *regs; + const struct tegra_sor_hdmi_settings *settings; unsigned int num_settings; @@ -387,23 +404,23 @@ static int tegra_sor_dp_train_fast(struct tegra_sor *sor, /* disable LVDS mode */ tegra_sor_writel(sor, 0, SOR_LVDS); - value = tegra_sor_readl(sor, SOR_DP_PADCTL0); + value = tegra_sor_readl(sor, sor->soc->regs->dp_padctl0); value |= SOR_DP_PADCTL_TX_PU_ENABLE; value &= ~SOR_DP_PADCTL_TX_PU_MASK; value |= SOR_DP_PADCTL_TX_PU(2); /* XXX: don't hardcode? */ - tegra_sor_writel(sor, value, SOR_DP_PADCTL0); + tegra_sor_writel(sor, value, sor->soc->regs->dp_padctl0); - value = tegra_sor_readl(sor, SOR_DP_PADCTL0); + value = tegra_sor_readl(sor, sor->soc->regs->dp_padctl0); value |= SOR_DP_PADCTL_CM_TXD_3 | SOR_DP_PADCTL_CM_TXD_2 | SOR_DP_PADCTL_CM_TXD_1 | SOR_DP_PADCTL_CM_TXD_0; - tegra_sor_writel(sor, value, SOR_DP_PADCTL0); + tegra_sor_writel(sor, value, sor->soc->regs->dp_padctl0); usleep_range(10, 100); - value = tegra_sor_readl(sor, SOR_DP_PADCTL0); + value = tegra_sor_readl(sor, sor->soc->regs->dp_padctl0); value &= ~(SOR_DP_PADCTL_CM_TXD_3 | SOR_DP_PADCTL_CM_TXD_2 | SOR_DP_PADCTL_CM_TXD_1 | SOR_DP_PADCTL_CM_TXD_0); - tegra_sor_writel(sor, value, SOR_DP_PADCTL0); + tegra_sor_writel(sor, value, sor->soc->regs->dp_padctl0); err = drm_dp_aux_prepare(sor->aux, DP_SET_ANSI_8B10B); if (err < 0) @@ -895,31 +912,31 @@ static void tegra_sor_mode_set(struct tegra_sor *sor, */ value = ((mode->vtotal & 0x7fff) << 16) | (mode->htotal & 0x7fff); - tegra_sor_writel(sor, value, SOR_HEAD_STATE1(dc->pipe)); + tegra_sor_writel(sor, value, sor->soc->regs->head_state1 + dc->pipe); /* sync end = sync width - 1 */ vse = mode->vsync_end - mode->vsync_start - 1; hse = mode->hsync_end - mode->hsync_start - 1; value = ((vse & 0x7fff) << 16) | (hse & 0x7fff); - tegra_sor_writel(sor, value, SOR_HEAD_STATE2(dc->pipe)); + tegra_sor_writel(sor, value, sor->soc->regs->head_state2 + dc->pipe); /* blank end = sync end + back porch */ vbe = vse + (mode->vtotal - mode->vsync_end); hbe = hse + (mode->htotal - mode->hsync_end); value = ((vbe & 0x7fff) << 16) | (hbe & 0x7fff); - tegra_sor_writel(sor, value, SOR_HEAD_STATE3(dc->pipe)); + tegra_sor_writel(sor, value, sor->soc->regs->head_state3 + dc->pipe); /* blank start = blank end + active */ vbs = vbe + mode->vdisplay; hbs = hbe + mode->hdisplay; value = ((vbs & 0x7fff) << 16) | (hbs & 0x7fff); - tegra_sor_writel(sor, value, SOR_HEAD_STATE4(dc->pipe)); + tegra_sor_writel(sor, value, sor->soc->regs->head_state4 + dc->pipe); /* XXX interlacing support */ - tegra_sor_writel(sor, 0x001, SOR_HEAD_STATE5(dc->pipe)); + tegra_sor_writel(sor, 0x001, sor->soc->regs->head_state5 + dc->pipe); } static int tegra_sor_detach(struct tegra_sor *sor) @@ -1001,10 +1018,10 @@ static int tegra_sor_power_down(struct tegra_sor *sor) return err; } - value = tegra_sor_readl(sor, SOR_DP_PADCTL0); + value = tegra_sor_readl(sor, sor->soc->regs->dp_padctl0); value &= ~(SOR_DP_PADCTL_PD_TXD_3 | SOR_DP_PADCTL_PD_TXD_0 | SOR_DP_PADCTL_PD_TXD_1 | SOR_DP_PADCTL_PD_TXD_2); - tegra_sor_writel(sor, value, SOR_DP_PADCTL0); + tegra_sor_writel(sor, value, sor->soc->regs->dp_padctl0); /* stop lane sequencer */ value = SO
[PATCH 09/12] drm/tegra: Support ARGB and ABGR formats
From: Thierry Reding These formats can easily be supported on all generations of Tegra. Note that the XRGB and XBGR formats that we supported were in fact using the ARGB and ABGR Tegra formats. This happened to work in cases where no alpha was being considered. This change is also a fix for those formats. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c| 4 drivers/gpu/drm/tegra/dc.h| 2 ++ drivers/gpu/drm/tegra/plane.c | 8 3 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 2d54657b538e..e40272493235 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -287,7 +287,9 @@ static void tegra_dc_setup_window(struct tegra_dc *dc, unsigned int index, static const u32 tegra_primary_plane_formats[] = { DRM_FORMAT_XBGR, + DRM_FORMAT_ABGR, DRM_FORMAT_XRGB, + DRM_FORMAT_ARGB, DRM_FORMAT_RGB565, }; @@ -649,7 +651,9 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, static const uint32_t tegra_overlay_plane_formats[] = { DRM_FORMAT_XBGR, + DRM_FORMAT_ABGR, DRM_FORMAT_XRGB, + DRM_FORMAT_ARGB, DRM_FORMAT_RGB565, DRM_FORMAT_UYVY, DRM_FORMAT_YUYV, diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 47f43663adcb..018fea74fb50 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -598,6 +598,8 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc); #define WIN_COLOR_DEPTH_YUV422R23 #define WIN_COLOR_DEPTH_YCbCr422RA 24 #define WIN_COLOR_DEPTH_YUV422RA 25 +#define WIN_COLOR_DEPTH_B8G8R8X8 37 +#define WIN_COLOR_DEPTH_R8G8B8X8 38 #define DC_WIN_POSITION0x704 #define H_POSITION(x) (((x) & 0x1fff) << 0) /* XXX 0x7fff on Tegra186 */ diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c index 1847d0204e46..1fff98fe6962 100644 --- a/drivers/gpu/drm/tegra/plane.c +++ b/drivers/gpu/drm/tegra/plane.c @@ -111,10 +111,18 @@ int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap) switch (fourcc) { case DRM_FORMAT_XBGR: + *format = WIN_COLOR_DEPTH_R8G8B8X8; + break; + + case DRM_FORMAT_ABGR: *format = WIN_COLOR_DEPTH_R8G8B8A8; break; case DRM_FORMAT_XRGB: + *format = WIN_COLOR_DEPTH_B8G8R8X8; + break; + + case DRM_FORMAT_ARGB: *format = WIN_COLOR_DEPTH_B8G8R8A8; break; -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] gpu: host1x: Cleanup on initialization failure
From: Thierry Reding When an error happens during the initialization of one of the sub- devices, make sure to properly cleanup all sub-devices that have been initialized up to that point. Signed-off-by: Thierry Reding --- drivers/gpu/host1x/bus.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 2e57c9cea696..88a3558b7916 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -211,8 +211,7 @@ int host1x_device_init(struct host1x_device *device) dev_err(&device->dev, "failed to initialize %s: %d\n", dev_name(client->dev), err); - mutex_unlock(&device->clients_lock); - return err; + goto teardown; } } } @@ -220,6 +219,14 @@ int host1x_device_init(struct host1x_device *device) mutex_unlock(&device->clients_lock); return 0; + +teardown: + list_for_each_entry_continue_reverse(client, &device->clients, list) + if (client->ops->exit) + client->ops->exit(client); + + mutex_unlock(&device->clients_lock); + return err; } EXPORT_SYMBOL(host1x_device_init); -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Build regressions/improvements in v4.15-rc1
On Mon, Nov 27, 2017 at 11:01 AM, Geert Uytterhoeven wrote: > Below is the list of build error/warning regressions/improvements in > v4.15-rc1[1] compared to v4.14[2]. > > Summarized: > - build errors: +2/-5 > [1] > http://kisskb.ellerman.id.au/kisskb/head/4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323/ > (all 271 configs) > [2] > http://kisskb.ellerman.id.au/kisskb/head/bebc6082da0a9f5d47a1ea2edc099bf671058bd4/ > (270 out of 271 configs) > 2 error regressions: > + /home/kisskb/slave/src/drivers/gpu/drm/i915/intel_csr.c: error: 'si' may > be used uninitialized in this function [-Werror=uninitialized]: => 204:3 x86_64-randconfig > + /home/kisskb/slave/src/include/linux/bcma/bcma_driver_pci.h: error: field > 'pci_controller' has incomplete type: => 218:24 mips-allmodconfig Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/atomic: Use DRM_DEBUG_KMS instead of DRM_DEBUG_ATOMIC in error paths
On Fri, Nov 24, 2017 at 06:13:56PM +0200, Ville Syrjälä wrote: > On Wed, Nov 15, 2017 at 08:38:41PM +0200, Ville Syrjala wrote: > > From: Ville Syrjälä > > > > DRM_DEBUG_ATOMIC generates a lot of noise that no one normally cares > > about. However error paths everyone cares about, so hiding thea error > > debugs under DRM_DEBUG_ATOMIC is a bad idea. Let's use DRM_DEBUG_KMS > > for those instead. > > Actually, one idea that came to my mind right now is that maybe we want > to keep using _ATOMIC with TEST_ONLY, and only use _KMS w/o TEST_ONLY? Yeah a DRM_DEBUG_ATOMIC_CHECK which does this sounds like a very good idea. I even thought of encapsulating the return -EINVAL, but that's maybe a bit too nasty control flow :-) But maybe something like #define atomic_check_failure_return(reason, ..) wouldn't be too eye-gauging ... -Daniel > > > > > v2: Rebase and handle a few new cases > > > > Cc: Jani Nikula > > Reviewed-by: Jani Nikula #v1 > > Signed-off-by: Ville Syrjälä > > --- > > drivers/gpu/drm/drm_atomic.c| 64 - > > drivers/gpu/drm/drm_atomic_helper.c | 70 > > ++--- > > 2 files changed, 66 insertions(+), 68 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > > index 37445d50816a..594bdd5c33cb 100644 > > --- a/drivers/gpu/drm/drm_atomic.c > > +++ b/drivers/gpu/drm/drm_atomic.c > > @@ -572,8 +572,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc, > > */ > > > > if (state->active && !state->enable) { > > - DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n", > > -crtc->base.id, crtc->name); > > + DRM_DEBUG_KMS("[CRTC:%d:%s] active without enabled\n", > > + crtc->base.id, crtc->name); > > return -EINVAL; > > } > > > > @@ -582,15 +582,15 @@ static int drm_atomic_crtc_check(struct drm_crtc > > *crtc, > > * be able to trigger. */ > > if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && > > WARN_ON(state->enable && !state->mode_blob)) { > > - DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n", > > -crtc->base.id, crtc->name); > > + DRM_DEBUG_KMS("[CRTC:%d:%s] enabled without mode blob\n", > > + crtc->base.id, crtc->name); > > return -EINVAL; > > } > > > > if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && > > WARN_ON(!state->enable && state->mode_blob)) { > > - DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n", > > -crtc->base.id, crtc->name); > > + DRM_DEBUG_KMS("[CRTC:%d:%s] disabled with mode blob\n", > > + crtc->base.id, crtc->name); > > return -EINVAL; > > } > > > > @@ -605,8 +605,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc, > > * pipe. > > */ > > if (state->event && !state->active && !crtc->state->active) { > > - DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n", > > -crtc->base.id, crtc->name); > > + DRM_DEBUG_KMS("[CRTC:%d:%s] requesting event but off\n", > > + crtc->base.id, crtc->name); > > return -EINVAL; > > } > > > > @@ -861,10 +861,10 @@ static int drm_atomic_plane_check(struct drm_plane > > *plane, > > > > /* either *both* CRTC and FB must be set, or neither */ > > if (WARN_ON(state->crtc && !state->fb)) { > > - DRM_DEBUG_ATOMIC("CRTC set but no FB\n"); > > + DRM_DEBUG_KMS("CRTC set but no FB\n"); > > return -EINVAL; > > } else if (WARN_ON(state->fb && !state->crtc)) { > > - DRM_DEBUG_ATOMIC("FB set but no CRTC\n"); > > + DRM_DEBUG_KMS("FB set but no CRTC\n"); > > return -EINVAL; > > } > > > > @@ -874,7 +874,7 @@ static int drm_atomic_plane_check(struct drm_plane > > *plane, > > > > /* Check whether this plane is usable on this CRTC */ > > if (!(plane->possible_crtcs & drm_crtc_mask(state->crtc))) { > > - DRM_DEBUG_ATOMIC("Invalid crtc for plane\n"); > > + DRM_DEBUG_KMS("Invalid crtc for plane\n"); > > return -EINVAL; > > } > > > > @@ -882,9 +882,9 @@ static int drm_atomic_plane_check(struct drm_plane > > *plane, > > ret = drm_plane_check_pixel_format(plane, state->fb->format->format); > > if (ret) { > > struct drm_format_name_buf format_name; > > - DRM_DEBUG_ATOMIC("Invalid pixel format %s\n", > > -drm_get_format_name(state->fb->format->format, > > -&format_name)); > > + DRM_DEBUG_KMS("Invalid pixel format %s\n", > > + drm_get_format_name(state->fb->format->format, > > + &format_name)); >
[PATCH] video: bf54x-lq043fb: Delete an error message for a failed memory allocation in bfin_bf54x_probe()
From: Markus Elfring Date: Mon, 27 Nov 2017 11:04:22 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/bf54x-lq043fb.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/video/fbdev/bf54x-lq043fb.c b/drivers/video/fbdev/bf54x-lq043fb.c index 8f1f97c75619..69a8c5d82ad7 100644 --- a/drivers/video/fbdev/bf54x-lq043fb.c +++ b/drivers/video/fbdev/bf54x-lq043fb.c @@ -605,9 +605,6 @@ static int bfin_bf54x_probe(struct platform_device *pdev) fbinfo->pseudo_palette = devm_kzalloc(&pdev->dev, sizeof(u32) * 16, GFP_KERNEL); if (!fbinfo->pseudo_palette) { - printk(KERN_ERR DRIVER_NAME - "Fail to allocate pseudo_palette\n"); - ret = -ENOMEM; goto out4; } -- 2.15.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/i915: Avoid enum conversion warning
On Sun, Nov 26, 2017 at 07:49:14PM -0800, Nick Desaulniers wrote: > Fixes the following enum conversion warning: > > drivers/gpu/drm/i915/intel_ddi.c:1481:30: error: implicit conversion > from enumeration type 'enum port' to different enumeration type 'enum > intel_dpll_id' [-Werror,-Wenum-conversion] > enum intel_dpll_id pll_id = port; >~~ ^~~~ > > Suggested-by: Daniel Vetter > Signed-off-by: Nick Desaulniers This doesn't apply on latest drm-intel.git code anymore, we removed this. Thanks anyway. -Daniel > --- > drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c > b/drivers/gpu/drm/i915/intel_ddi.c > index 933c18fd4258..3c346c8cbf78 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -1477,8 +1477,8 @@ static void bxt_ddi_clock_get(struct intel_encoder > *encoder, > struct intel_crtc_state *pipe_config) > { > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > - enum port port = intel_ddi_get_encoder_port(encoder); > - enum intel_dpll_id pll_id = port; > + enum intel_dpll_id pll_id = > + (enum intel_dpll_id)intel_ddi_get_encoder_port(encoder); > > pipe_config->port_clock = bxt_calc_pll_link(dev_priv, pll_id); > > -- > 2.14.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/13] staging: sm750fb: use simpler remove_conflicting_pci_framebuffers()
On Fri, Nov 24, 2017 at 06:53:33PM +0100, Michał Mirosław wrote: > Signed-off-by: Michał Mirosław > --- Why exactly do we have an fbdev driver in staging? Afaiui fbdev is entirely closed for new drivers (pls convert to an atomic drm driver instead, it likely will be smaller even). That's even worse than having a non-atomic drm driver in staging ... -Daniel > drivers/staging/sm750fb/sm750.c | 22 +- > 1 file changed, 1 insertion(+), 21 deletions(-) > > diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c > index 67207b0554cd..0590fc45c493 100644 > --- a/drivers/staging/sm750fb/sm750.c > +++ b/drivers/staging/sm750fb/sm750.c > @@ -1053,26 +1053,6 @@ static int sm750fb_frambuffer_alloc(struct sm750_dev > *sm750_dev, int fbidx) > return err; > } > > -static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev) > -{ > - struct apertures_struct *ap; > - bool primary = false; > - > - ap = alloc_apertures(1); > - if (!ap) > - return -ENOMEM; > - > - ap->ranges[0].base = pci_resource_start(pdev, 0); > - ap->ranges[0].size = pci_resource_len(pdev, 0); > -#ifdef CONFIG_X86 > - primary = pdev->resource[PCI_ROM_RESOURCE].flags & > - IORESOURCE_ROM_SHADOW; > -#endif > - remove_conflicting_framebuffers(ap, "sm750_fb1", primary); > - kfree(ap); > - return 0; > -} > - > static int lynxfb_pci_probe(struct pci_dev *pdev, > const struct pci_device_id *ent) > { > @@ -1081,7 +1061,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, > int fbidx; > int err; > > - err = lynxfb_kick_out_firmware_fb(pdev); > + err = remove_conflicting_pci_framebuffers(pdev, 0, "sm750_fb1"); > if (err) > return err; > > -- > 2.11.0 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103769] Unity based games do not start
https://bugs.freedesktop.org/show_bug.cgi?id=103769 --- Comment #4 from Nicolai Hähnle --- Thanks for the report. Is this still an issue? The traces look subtly different... Do you have backtraces with symbols? Make sure you compile Mesa with debug symbols enabled. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103917] [gfx9/Vega] Performance regression in master, 17.3 works fine
https://bugs.freedesktop.org/show_bug.cgi?id=103917 --- Comment #1 from Michel Dänzer --- (In reply to Vedran Miletić from comment #0) > I tried to bisect, but wasn't able to figure out what commit exactly is > causing the problem. What was the problem? Were you able to narrow it down at least? -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/13] fbdev: add remove_conflicting_pci_framebuffers()
On Fri, Nov 24, 2017 at 06:53:31PM +0100, Michał Mirosław wrote: > Almost all drivers using remove_conflicting_framebuffers() wrap it with > the same code. Extract common part from PCI drivers into separate > remove_conflicting_pci_framebuffers(). > > Signed-off-by: Michał Mirosław Since the only driver that seems to use this is the staging one, which imo is a DOA project, not sure it's worth to bother with this here. -Daniel > --- > drivers/video/fbdev/core/fbmem.c | 22 ++ > include/drm/drm_fb_helper.h | 12 > include/linux/fb.h | 2 ++ > 3 files changed, 36 insertions(+) > > diff --git a/drivers/video/fbdev/core/fbmem.c > b/drivers/video/fbdev/core/fbmem.c > index 30a18d4c9de4..5ea980e5d3b7 100644 > --- a/drivers/video/fbdev/core/fbmem.c > +++ b/drivers/video/fbdev/core/fbmem.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > > #include > > @@ -1788,6 +1789,27 @@ int remove_conflicting_framebuffers(struct > apertures_struct *a, > } > EXPORT_SYMBOL(remove_conflicting_framebuffers); > > +int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, > const char *name) > +{ > + struct apertures_struct *ap; > + bool primary = false; > + > + ap = alloc_apertures(1); > + if (!ap) > + return -ENOMEM; > + > + ap->ranges[0].base = pci_resource_start(pdev, res_id); > + ap->ranges[0].size = pci_resource_len(pdev, res_id); > +#ifdef CONFIG_X86 > + primary = pdev->resource[PCI_ROM_RESOURCE].flags & > + IORESOURCE_ROM_SHADOW; > +#endif > + remove_conflicting_framebuffers(ap, name, primary); > + kfree(ap); > + return 0; > +} > +EXPORT_SYMBOL(remove_conflicting_pci_framebuffers); > + > /** > * register_framebuffer - registers a frame buffer device > * @fb_info: frame buffer info structure > diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h > index 33fe95927742..ac3412290289 100644 > --- a/include/drm/drm_fb_helper.h > +++ b/include/drm/drm_fb_helper.h > @@ -520,4 +520,16 @@ drm_fb_helper_remove_conflicting_framebuffers(struct > apertures_struct *a, > #endif > } > > +static inline int > +drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev, > + int resource_id, > + const char *name) > +{ > +#if IS_REACHABLE(CONFIG_FB) > + return remove_conflicting_pci_framebuffers(pdev, resource_id, name); > +#else > + return 0; > +#endif > +} > + > #endif > diff --git a/include/linux/fb.h b/include/linux/fb.h > index f4386b0ccf40..4196cb09e58e 100644 > --- a/include/linux/fb.h > +++ b/include/linux/fb.h > @@ -624,6 +624,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const > char __user *buf, > extern int register_framebuffer(struct fb_info *fb_info); > extern int unregister_framebuffer(struct fb_info *fb_info); > extern int unlink_framebuffer(struct fb_info *fb_info); > +extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int > res_id, > +const char *name); > extern int remove_conflicting_framebuffers(struct apertures_struct *a, > const char *name, bool primary); > extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); > -- > 2.11.0 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103817] [bisected] Heavy flickering in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=103817 --- Comment #2 from Nicolai Hähnle --- Thanks for the report. Do you see anything in dmesg while the flickering is happening? -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/13] fbdev: allow apertures == NULL in remove_conflicting_framebuffers()
On Fri, Nov 24, 2017 at 06:53:33PM +0100, Michał Mirosław wrote: > Interpret (otherwise-invalid) NULL apertures argument to mean all-memory > range. This will allow to remove several duplicates of this code from > drivers in following patches. > > Signed-off-by: Michał Mirosław > --- > drivers/video/fbdev/core/fbmem.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/video/fbdev/core/fbmem.c > b/drivers/video/fbdev/core/fbmem.c > index 5ea980e5d3b7..927e016487e9 100644 > --- a/drivers/video/fbdev/core/fbmem.c > +++ b/drivers/video/fbdev/core/fbmem.c > @@ -1780,11 +1780,25 @@ int remove_conflicting_framebuffers(struct > apertures_struct *a, > const char *name, bool primary) > { > int ret; > + bool do_free = false; > + > + if (!a) { > + a = alloc_apertures(1); > + if (!a) > + return -ENOMEM; > + > + a->ranges[0].base = 0; > + a->ranges[0].size = ~0; > + do_free = true; > + } > > mutex_lock(®istration_lock); > ret = do_remove_conflicting_framebuffers(a, name, primary); > mutex_unlock(®istration_lock); > > + if (do_free) > + kfree(a); > + > return ret; > } > EXPORT_SYMBOL(remove_conflicting_framebuffers); Please also update the kerneldoc for the varios drm wrappers and explain that passing NULL means to remove all fbdev drivers. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 00/13] remove_conflicting_framebuffers() cleanup
On Fri, Nov 24, 2017 at 06:53:25PM +0100, Michał Mirosław wrote: > This series cleans up duplicated code for replacing firmware FB > driver with proper DRI driver and adds handover support to > Tegra driver. > > The last patch is here because it uses new semantics of > remove_conflicting_framebuffers() from this series. This > can be considered independently, though. Except for that patches I've commented on: Acked-by: Daniel Vetter Since this is for tegra and Thierry has drm-misc commit rights, it's probably simplest when Thierry pushes this all to drm-misc once driver maintainers had a chance to look at it. Also needs and ack from Bart for the fbdev sides. -Daniel > > --- > > Michał Mirosław (13): > fbdev: show fbdev number for debugging > fbdev: add remove_conflicting_pci_framebuffers() > drm/amdgpu: use simpler remove_conflicting_pci_framebuffers() > drm/bochs: use simpler remove_conflicting_pci_framebuffers() > drm/cirrus: use simpler remove_conflicting_pci_framebuffers() > drm/mgag200: use simpler remove_conflicting_pci_framebuffers() > drm/radeon: use simpler remove_conflicting_pci_framebuffers() > drm/virtio: use simpler remove_conflicting_pci_framebuffers() > staging: sm750fb: use simpler remove_conflicting_pci_framebuffers() > fbdev: allow apertures == NULL in remove_conflicting_framebuffers() > drm/vc4: use simpler remove_conflicting_framebuffers(NULL) > drm/sun4i: use simpler remove_conflicting_framebuffers(NULL) > drm/tegra: kick out simplefb > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 23 +- > drivers/gpu/drm/bochs/bochs_drv.c| 18 +- > drivers/gpu/drm/cirrus/cirrus_drv.c | 23 +- > drivers/gpu/drm/mgag200/mgag200_drv.c| 21 + > drivers/gpu/drm/mgag200/mgag200_main.c | 9 --- > drivers/gpu/drm/radeon/radeon_drv.c | 23 +- > drivers/gpu/drm/sun4i/sun4i_drv.c| 18 +- > drivers/gpu/drm/tegra/drm.c | 4 > drivers/gpu/drm/vc4/vc4_drv.c| 20 +--- > drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 24 +++ > drivers/staging/sm750fb/sm750.c | 22 +- > drivers/video/fbdev/core/fbmem.c | 40 > ++-- > include/drm/drm_fb_helper.h | 12 ++ > include/linux/fb.h | 2 ++ > 14 files changed, 67 insertions(+), 192 deletions(-) > > -- > 2.11.0 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 100726] [REGRESSION][BISECTED] Severe flickering with an R9 290
https://bugs.freedesktop.org/show_bug.cgi?id=100726 Michel Dänzer changed: What|Removed |Added Attachment #135725|text/x-log |text/plain mime type|| -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103817] [bisected] Heavy flickering in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=103817 Nicolai Hähnle changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #3 from Nicolai Hähnle --- This is likely a duplicate of bug #103808, which has an apitrace. *** This bug has been marked as a duplicate of bug 103808 *** -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103808] [radeonsi, bisected] World of Warcraft scribbling all over screen
https://bugs.freedesktop.org/show_bug.cgi?id=103808 Nicolai Hähnle changed: What|Removed |Added CC||bartos.p...@gmail.com --- Comment #4 from Nicolai Hähnle --- *** Bug 103817 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 00/13] remove_conflicting_framebuffers() cleanup
On Mon, Nov 27, 2017 at 11:30:44AM +0100, Daniel Vetter wrote: > On Fri, Nov 24, 2017 at 06:53:25PM +0100, Michał Mirosław wrote: > > This series cleans up duplicated code for replacing firmware FB > > driver with proper DRI driver and adds handover support to > > Tegra driver. > > > > The last patch is here because it uses new semantics of > > remove_conflicting_framebuffers() from this series. This > > can be considered independently, though. > > Except for that patches I've commented on: > > Acked-by: Daniel Vetter > > Since this is for tegra and Thierry has drm-misc commit rights, it's > probably simplest when Thierry pushes this all to drm-misc once driver > maintainers had a chance to look at it. Will do. Thierry signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 100726] [REGRESSION][BISECTED] Severe flickering with an R9 290
https://bugs.freedesktop.org/show_bug.cgi?id=100726 --- Comment #6 from Michel Dänzer --- None of those commits look even remotely related, so I'm afraid you still incorrectly labelled at least one bad commit as good. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/2] drm/fourcc: Fix fourcc_mod_code() definition
On Mon, Nov 27, 2017 at 10:39:47AM +0100, Thierry Reding wrote: > From: Thierry Reding > > Avoid compiler warnings when the val parameter is an expression. > > Signed-off-by: Thierry Reding Reviewed-by: Daniel Vetter > --- > include/uapi/drm/drm_fourcc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h > index 3ad838d3f93f..a76ed8f9e383 100644 > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -188,7 +188,7 @@ extern "C" { > #define DRM_FORMAT_RESERVED((1ULL << 56) - 1) > > #define fourcc_mod_code(vendor, val) \ > - __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & > 0x00ffULL)) > + __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & > 0x00ffULL)) > > /* > * Format Modifier tokens: > -- > 2.15.0 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 103838] Random segfaults in applications from radeonsi_dri.so
https://bugs.freedesktop.org/show_bug.cgi?id=103838 --- Comment #3 from Nicolai Hähnle --- Thanks for the report. Maybe try a clean rebuild? Failing that, please provide a backtrace with debug symbols, otherwise there's no hope of fixing this if it is a real bug. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/tegra: Sanitize format modifiers
On Mon, Nov 27, 2017 at 10:39:48AM +0100, Thierry Reding wrote: > From: Thierry Reding > > The existing format modifier definitions were merged prematurely, and > recent work has unveiled that the definitions are suboptimal in several > ways: > > - The format specifiers, except for one, are not Tegra specific, but > the names don't reflect that. > - The number space is split into two, reserving 32 bits for some > "parameter" which most of the modifiers are not going to have. > - Symbolic names for the modifiers are not using the standard > DRM_FORMAT_MOD_* prefix, which makes them awkward to use. > - The vendor prefix NV is somewhat ambiguous. > > Fortunately, nobody's started using these modifiers, so we can still fix > the above issues. Do so by using the standard prefix. Also, remove TEGRA > from the name of those modifiers that exist on NVIDIA GPUs as well. In > case of the block linear modifiers, make the "parameter" smaller (4 > bits, though only 6 values are valid) and don't let that leak into any > of the other modifiers. > > Finally, also use the more canonical NVIDIA instead of the ambiguous NV > prefix. > > Signed-off-by: Thierry Reding > --- > drivers/gpu/drm/tegra/fb.c| 35 +-- > include/uapi/drm/drm_fourcc.h | 36 +++- > 2 files changed, 48 insertions(+), 23 deletions(-) > > diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c > index 80540c1c66dc..406e895d82cc 100644 > --- a/drivers/gpu/drm/tegra/fb.c > +++ b/drivers/gpu/drm/tegra/fb.c > @@ -54,17 +54,40 @@ int tegra_fb_get_tiling(struct drm_framebuffer > *framebuffer, > struct tegra_fb *fb = to_tegra_fb(framebuffer); > uint64_t modifier = fb->base.modifier; > > - switch (fourcc_mod_tegra_mod(modifier)) { > - case NV_FORMAT_MOD_TEGRA_TILED: > + switch (modifier) { > + case DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED: > tiling->mode = TEGRA_BO_TILING_MODE_TILED; > tiling->value = 0; > break; > > - case NV_FORMAT_MOD_TEGRA_16BX2_BLOCK(0): > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(0): > tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; > - tiling->value = fourcc_mod_tegra_param(modifier); > - if (tiling->value > 5) > - return -EINVAL; > + tiling->value = 0; > + break; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(1): > + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; > + tiling->value = 1; > + break; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(2): > + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; > + tiling->value = 2; > + break; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(3): > + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; > + tiling->value = 3; > + break; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(4): > + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; > + tiling->value = 4; > + break; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(5): > + tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; > + tiling->value = 5; > break; > > default: > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h > index a76ed8f9e383..e04613d30a13 100644 > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -178,7 +178,7 @@ extern "C" { > #define DRM_FORMAT_MOD_VENDOR_NONE0 > #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 > #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 > -#define DRM_FORMAT_MOD_VENDOR_NV 0x03 > +#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 > #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 > #define DRM_FORMAT_MOD_VENDOR_QCOM0x05 > #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 > @@ -338,29 +338,17 @@ extern "C" { > */ > #define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) > > -/* NVIDIA Tegra frame buffer modifiers */ > - > -/* > - * Some modifiers take parameters, for example the number of vertical GOBs in > - * a block. Reserve the lower 32 bits for parameters > - */ > -#define __fourcc_mod_tegra_mode_shift 32 > -#define fourcc_mod_tegra_code(val, params) \ > - fourcc_mod_code(NV, __u64)val) << __fourcc_mod_tegra_mode_shift) | > params)) > -#define fourcc_mod_tegra_mod(m) \ > - (m & ~((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) > -#define fourcc_mod_tegra_param(m) \ > - (m & ((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) > +/* NVIDIA frame buffer modifiers */ > > /* > * Tegra Tiled Layout, used by Tegra 2, 3 and 4. > * > * Pixels are arranged in simple tiles of 16 x 16 bytes. > */ > -#define NV_FORMAT_MOD_TEGRA_TILED fourcc_mod_tegra_code(1, 0) > +#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) > > /* > - * Tegra 16Bx2 Block Linear layout, used by TK1/TX1 > + * 16Bx