Paul Cercueil [Mon, 3 Jun 2019 15:25:55 +0000 (17:25 +0200)]
drm/panel: Add Novatek NT39016 panel support
Add support for display panels built around the Novatek NT39016 display
controller, as found on e.g. the King Display KD035G6-54NT 24-bit
320x240 3.5" LCD panel which equips the GCW Zero open-source handheld
gaming console.
Paul Cercueil [Wed, 5 Jun 2019 22:22:46 +0000 (00:22 +0200)]
media: uapi: Add MEDIA_BUS_FMT_RGB888_3X8 media bus format
This patch adds MEDIA_BUS_FMT_RGB888_3X8, used for the GiantPlus
GPM940B0 24-bit TFT panel, where the RGB components are transferred
sequentially on a 8-bit bus.
Daniel Vetter [Fri, 14 Jun 2019 20:36:01 +0000 (22:36 +0200)]
drm/msm: Drop robj from msm_gem_new_impl
Only user was the prime import, and drm_prime.c takes care of that
now.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Sean Paul <sean@poorly.run> Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-46-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:58 +0000 (22:35 +0200)]
drm/etnaviv: Drop resv argument from etnaviv_gem_new_impl
Only user was the prime import, and drm_prime.c takes care of that
now.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Russell King <linux+etnaviv@armlinux.org.uk> Cc: Christian Gmeiner <christian.gmeiner@gmail.com> Cc: etnaviv@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-43-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:36:00 +0000 (22:36 +0200)]
drm/mediatek: Use drm_atomic_helper_wait_for_fences
If we use the gem fb helper as the prepare_fb hook, plus the
drm_prime.c import helpers now automatically setting obj->resv, we can
use the shared helpers to wait for fences instead of rolling our own.
Note that this relies on mtk setting drm_fb->obj, which is already
done in mtk_drm_framebuffer_init().
Aside: Probably can use the default commit_tail with this again, but I
didn't check for that.
Reviewed-by: CK Hu <ck.hu@mediatek.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: CK Hu <ck.hu@mediatek.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-45-daniel.vetter@ffwll.ch
Ville Syrjälä [Thu, 20 Jun 2019 14:26:37 +0000 (17:26 +0300)]
drm: WARN on illegal aspect ratio when converting a mode to umode
WARN if the incoming drm_display_mode has an illegal aspect ratio
when converting it to a user mode. This should never happen unless
the driver made a mistake and put an invalid value into the aspect
ratio.
Maxime Ripard [Mon, 24 Jun 2019 08:40:16 +0000 (10:40 +0200)]
drm/connector: Fix warning in debug message
The commit 3aeeb13d8996 ("drm/modes: Support modes names on the command
line") added name support to the DRM modes, and added that name to the
debug message.
However, that code tests for whether or not the name variable is NULL and
only prints it if it's not. Except that that variable is an array, so it
will never be NULL.
The original intent was to print it only when the name has been specified.
Just printing the array directly will achieve the same thing since the
drm_cmdline_mode structure that holds it is itself contained in
drm_connector, that is allocated with its whole content zero'd.
That means that if the name is not declared, the array will be all zeros,
which will not print anything.
Cc: Nick Desaulniers <ndesaulniers@google.com> Reported-by: kbuild test robot <lkp@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Fixes: 3aeeb13d8996 ("drm/modes: Support modes names on the command line") Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190624084016.12937-1-maxime.ripard@bootlin.com
Matt Redfearn [Tue, 30 Apr 2019 08:17:04 +0000 (08:17 +0000)]
drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs
The Synopsys MIPI DSI IP contains a video test pattern generator which
is helpful in debugging video timing with connected displays.
Add a debugfs directory containing files which allow the VPG to be
enabled and disabled, and its orientation to be changed.
drm/lima: Reduce the amount of logs on deferred probe of clocks and reset controller
There is no point to print deferred probe messages as errors. Adjust
the printks for error paths of obtaining clocks and reset controller.
This removes the error message of lima_clk_init() call in favor or
specific failure messages inside.
drm/lima: Reduce the amount of logs on deferred probe
There is no point to print deferred probe (and its failures to get
resources) as an error. For example getting a regulator causes three
unneeded error messages:
lima 13000000.gpu: failed to get regulator: -517
lima 13000000.gpu: regulator init fail -517
lima 13000000.gpu: Fatal error during GPU init
Also do not print clock rates before the initialization finishes
because they will be duplicated after deferral. Each probe step already
prints error so remove the final error message "Fatal error during GPU
init".
In case of multiple probe tries this would pollute the dmesg.
Daniel Vetter [Fri, 14 Jun 2019 20:36:04 +0000 (22:36 +0200)]
drm/vgem: Ditch attach trickery in the fence ioctl
It looks like this was done purely to get a consistent place to look
up the reservation object pointer. With the drm_prime.c helper code
now also setting gem_object->resv for imported objects we can just use
that pointer directly, instead of first ensuring a dma-buf exists.
v2: Note that I screwed up the patch ordering, hence why this needed
a Fixes: tag - CI spotted the broken intermediate state.
Daniel Vetter [Fri, 14 Jun 2019 20:35:57 +0000 (22:35 +0200)]
drm/prime: automatically set gem_obj->resv on import
It's really the only reasonable thing to do, and it won't hurt drivers
which don't (yet) use drm_gem_object->resv.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Sean Paul <sean@poorly.run> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-42-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:45 +0000 (22:35 +0200)]
drm/sti: Drop drm_gem_prime_export/import
They're the default.
Aside: Would be really nice to switch the others over to
drm_gem_object_funcs.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Vincent Abriou <vincent.abriou@st.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-30-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:37 +0000 (22:35 +0200)]
drm/msm: Drop drm_gem_prime_export/import
They're the default.
Aside: Would be really nice to switch the others over to
drm_gem_object_funcs.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Sean Paul <sean@poorly.run> Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-22-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:36 +0000 (22:35 +0200)]
drm/meson: Drop drm_gem_prime_export/import
They're the default.
Aside: Would be really nice to switch the others over to
drm_gem_object_funcs.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Kevin Hilman <khilman@baylibre.com> Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-21-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:35 +0000 (22:35 +0200)]
drm/mtk: Drop drm_gem_prime_export/import
They're the default.
Aside: Would be really nice to switch the others over to
drm_gem_object_funcs.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: CK Hu <ck.hu@mediatek.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-20-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:32 +0000 (22:35 +0200)]
drm/hisilicon: Drop drm_gem_prime_export/import
They're the default.
Aside: Would be really nice to switch the others over to
drm_gem_object_funcs.
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com> Cc: "Noralf Trønnes" <noralf@tronnes.org> Cc: CK Hu <ck.hu@mediatek.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-17-daniel.vetter@ffwll.ch
Daniel Vetter [Fri, 14 Jun 2019 20:35:29 +0000 (22:35 +0200)]
drm/etnaviv: Drop drm_gem_prime_export/import
They're the default.
Aside: Would be really nice to switch the others over to
drm_gem_object_funcs.
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Russell King <linux+etnaviv@armlinux.org.uk> Cc: Christian Gmeiner <christian.gmeiner@gmail.com> Cc: etnaviv@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-14-daniel.vetter@ffwll.ch
Daniel Vetter [Wed, 5 Jun 2019 12:08:35 +0000 (14:08 +0200)]
drm/ioctl: Ditch DRM_UNLOCKED except for the legacy vblank ioctl
This completes Emil's series of removing DRM_UNLOCKED from modern
drivers. It's entirely cargo-culted since we ignore it on
non-DRIVER_LEGACY drivers since:
drm: Enforce unlocked ioctl operation for kms driver ioctls
Now justifying why we can do this for legacy drives too (and hence
close the source of all the bogus copypasting) is a bit more involved.
DRM_UNLOCKED was introduced in:
As a immediate hack to keep i810 happy, which would have deadlocked
without this trickery. The old BKL is automatically dropped in
schedule(), and hence the i810 vs. mmap_sem deadlock didn't actually
cause a real deadlock. But with a mutex it would. The solution was to
annotate these as DRM_UNLOCKED and mark i810 unsafe on SMP machines.
This conversion caused a regression, because unlike the BKL a mutex
isn't dropped over schedule (that thing again), which caused a vblank
wait in one thread to block the entire desktop and all its apps. Back
then we did vblank scheduling by blocking in the client, awesome isn't
it. This was fixed quickly in (ok not so quickly, took 2 years):
All the other DRM_UNLOCKED annotations for all the core ioctls was
work to reach finer-grained locking for modern drivers. This took
years, and culminated in:
DRM_UNLOCKED was never required by any legacy drivers, except for the
vblank_wait IOCTL. Therefore we will not regress these old drivers by
going back to where we've been in 2011. For all modern drivers nothing
will change.
To make this perfectly clear, also add a comment to DRM_UNLOCKED.
Daniel Vetter [Fri, 14 Jun 2019 20:35:24 +0000 (22:35 +0200)]
drm/omapdrm: drop fb_debug_enter/leave
This is a no-op on atomic drivers because with atomic it's simply too
complicated to get all the locking and workers and nonblocking
synchronization correct, from essentially an NMI context. Well, too
complicated = impossible. Also, omapdrm never implemented the
mode_set_base_atomic hook, so I kinda wonder why this was ever added.
Daniel Vetter [Fri, 14 Jun 2019 20:35:21 +0000 (22:35 +0200)]
drm/prime: Make DRIVER_PRIME a no-op
Drivers must fill out the handle_to_fd and fd_to_handle hooks to
enable export/import prime functionality already. The additional
DRIVER_PRIME flag doesn't serve any real purpose, since the overall
flag doesn't even tell you whether import or export or maybe even both
is supported.
Ditch it.
This patch just makes it defunct, subsequent patches will remove it
from all the drivers.
Note this changes the userspace visible errno in some situations from
EOPNOTSUPP to ENOSYS. Userspace already needs to treat both as "no
prime support", so this should break anything.
Daniel Vetter [Thu, 20 Jun 2019 12:46:15 +0000 (14:46 +0200)]
drm/prime: Update docs
Yes this is a bit a big patch, but since it's essentially a complete
rewrite of all the prime docs I didn't see how to better split it up.
Changes:
- Consistently point to drm_gem_object_funcs as the preferred hooks,
where applicable.
- Document all the hooks in &drm_driver that lacked kerneldoc.
- Completely new overview section, which now also includes the cleaned
up lifetime/reference counting subchapter. I also mentioned the weak
references in there due to the lookup caches.
- Completely rewritten helper intro section, highlight the
import/export related functionality.
- Polish for all the functions and more cross references.
I also sprinkled a bunch of todos all over.
Most important: 0 code changes in here. The cleanup motivated by
reading and improving all this will follow later on.
v2: Actually update the prime helper docs. Plus add a few FIXMEs that
I won't address right away in subsequent cleanup patches.
v3:
- Split out the function moving. This patch is now exclusively
documentation changes.
- Typos and nits (Sam).
v4: Polish suggestions from Noralf.
Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Noralf Trønnes <noralf@tronnes.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Eric Anholt <eric@anholt.net> Cc: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190620124615.24434-1-daniel.vetter@ffwll.ch
Sean Paul [Wed, 19 Jun 2019 18:19:47 +0000 (14:19 -0400)]
drm/self_refresh: Fix possible NULL deref in failure path
If state allocation fails, we still try to give back the reference on
it. Also initialize ret in case the crtc is not enabled and we hit the
eject button.
Fixes: 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers") Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Jose Souza <jose.souza@intel.com> Cc: Zain Wang <wzz@rock-chips.com> Cc: Tomasz Figa <tfiga@chromium.org> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Sean Paul <seanpaul@chromium.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Sean Paul <sean@poorly.run> Cc: David Airlie <airlied@linux.ie> Cc: dri-devel@lists.freedesktop.org Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190619181951.192305-1-sean@poorly.run
Paul Cercueil [Mon, 3 Jun 2019 15:23:31 +0000 (17:23 +0200)]
DRM: Add KMS driver for the Ingenic JZ47xx SoCs
Add a KMS driver for the Ingenic JZ47xx family of SoCs.
This driver is meant to replace the aging jz4740-fb driver.
This driver does not make use of the simple pipe helper, for the reason
that it will soon be updated to support more advanced features like
multiple planes, IPU integration for colorspace conversion and up/down
scaling, support for DSI displays, and TV-out and HDMI outputs.
Notes:
v2: - Remove custom handling of panel. The panel is now discovered using
the standard API.
- Lots of small tweaks suggested by upstream
v3: - Use devm_drm_dev_init()
- Update compatible strings to -lcd instead of -drm
- Add destroy() callbacks to plane and crtc
- The ingenic,lcd-mode is now read from the bridge's DT node
v4: Remove ingenic,lcd-mode property completely. The various modes are now
deduced from the connector type, the pixel format or the bus flags.
v5: - Fix framebuffer size incorrectly calculated for 24bpp framebuffers
- Use 32bpp framebuffer instead of 16bpp, as it'll work with both
16-bit and 24-bit panel
- Get rid of drm_format_plane_cpp() which has been dropped upstream
- Avoid using drm_format_info->depth, which is deprecated.
Merge branch 'topic/remove-fbcon-notifiers' into drm-misc-next
topic/remove-fbcon-notifiers:
- remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon locking
- assorted locking checks in vt/console code
- assorted notifier and cleanups in fbdev and backlight code
This is the pull request that was sent out, plus the compile fix for
sh4 reported by kbuild.
Maxime Ripard [Wed, 19 Jun 2019 10:17:53 +0000 (12:17 +0200)]
drm/vc4: hdmi: Set default state margin at reset
Now that the TV margins are properly parsed and filled into
drm_cmdline_mode, we just need to initialise the first state at reset to
get those values and start using them.
Maxime Ripard [Wed, 19 Jun 2019 10:17:51 +0000 (12:17 +0200)]
drm/modes: Parse overscan properties
Properly configuring the overscan properties might be needed for the
initial setup of the framebuffer for display that still have overscan.
Let's allow for more properties on the kernel command line to setup each
margin.
Maxime Ripard [Wed, 19 Jun 2019 10:17:51 +0000 (12:17 +0200)]
drm/connector: Introduce a TV margins structure
The TV margins has been defined as a structure inside the
drm_connector_state structure so far. However, we will need it in other
structures as well, so let's move that structure definition so that it can
be reused.
Maxime Ripard [Wed, 19 Jun 2019 10:17:51 +0000 (12:17 +0200)]
drm/modes: Allow to specify rotation and reflection on the commandline
Rotations and reflections setup are needed in some scenarios to initialise
properly the initial framebuffer. Some drivers already had a bunch of
quirks to deal with this, such as either a private kernel command line
parameter (omapdss) or on the device tree (various panels).
In order to accomodate this, let's create a video mode parameter to deal
with the rotation and reflexion.
Maxime Ripard [Wed, 19 Jun 2019 10:17:50 +0000 (12:17 +0200)]
drm/modes: Support modes names on the command line
The drm subsystem also uses the video= kernel parameter, and in the
documentation refers to the fbdev documentation for that parameter.
However, that documentation also says that instead of giving the mode using
its resolution we can also give a name. However, DRM doesn't handle that
case at the moment. Even though in most case it shouldn't make any
difference, it might be useful for analog modes, where different standards
might have the same resolution, but still have a few different parameters
that are not encoded in the modes (NTSC vs NTSC-J vs PAL-M for example).
Maxime Ripard [Wed, 19 Jun 2019 10:17:48 +0000 (12:17 +0200)]
drm/client: Restrict the rotation check to the rotation itself
The drm_client_rotation has a check on the rotation value, but the
reflections are also stored in the same variable, and the check doesn't
take this into account.
Therefore, even though we might have a valid rotation, if we're also using
a reflection parameter, the test will fail for no particular reason.
Maxime Ripard [Wed, 19 Jun 2019 10:17:48 +0000 (12:17 +0200)]
drm/client: Restrict the plane_state scope
The drm_client_modeset_commit_atomic function uses two times the
plane_state variable in inner blocks of code, but the variable has a scope
global to this function.
This will lead to inadvertent devs to reuse the variable in the second
block with the value left by the first, without any warning from the
compiler since value would have been initialized.
Fix this by moving the variable declaration to the proper scope.