Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:43 +0000 (16:05 +0800)]
drm/sun4i: Add backend and tcon pointers to sun4i_crtc
sun4i_crtc controls the backend and tcon hardware blocks of the display
pipeline. Instead of doing so through the master drm structure, leave
pointers to the corresponding backend and tcon in itself.
Also drop the drm_device pointer, since it is no longer needed.
The next step forward would be to pass the pointers in through
sun4i_crtc_init as parameters. This would make it easier to support
multiple display pipelines layer on.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:42 +0000 (16:05 +0800)]
drm/sun4i: Add backend pointer to sun4i_layer
sun4i_layer only controls the backend hardware block of the display
pipeline. Instead of getting a pointer to the underlying backend
through the drm_device structure, leave one in itself.
Also drop the drm_device pointer, since it is no longer needed.
The next step forward would be to pass the pointer in through
sun4i_layers_init as a parameter. This would make it easier to support
multiple display pipelines layer on.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:41 +0000 (16:05 +0800)]
drm/sun4i: rgb: Pass tcon pointer when initializing RGB encoder
The RGB encoder represents channel 0 of the TCON. Instead of fetching
the pointer to its TCON from the main sun4i_drv structure, pass it in
as part of the init call, save it, and use it directly in the encoder
and connector callbacks.
We can also drop the otherwise unused sun4i_drv pointer.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:40 +0000 (16:05 +0800)]
drm/sun4i: tv: Switch to drm_of_find_possible_crtcs
Now that the crtcs have their .port field set properly, we can use
drm_of_find_possible_crtcs to find the connected crtcs, instead of
hardcoding the first crtc as usable. The new code also defers binding
when the upstream crtc hasn't been registered yet.
This makes it easier to support multiple tcons/crtcs.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:39 +0000 (16:05 +0800)]
drm/sun4i: Drop hardcoded .possible_crtcs values from layers
To support multiple display pipelines, we would have multiple crtcs,
with one or more planes bound to them. Obviously having hardcoded
values for the drm_plane .possible_crtcs field is not going to work.
For primary and cursor planes, the value is set by
drm_crtc_init_with_planes. We just need to set it for overlay planes.
We also fix the value set for the RGB encoder, by referencing the
crtc set in sun4i_drv.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:38 +0000 (16:05 +0800)]
drm/sun4i: Drop primary layer pointer from sun4i_drv
The current layer init code keeps a pointer to the primary plane layer
in sun4i_drv. When we eventually support multiple display pipelines,
this would force us to keep track of primary planes for all crtcs. And
these pointers only get used at bind time.
Instead, have the crtc init code iterate through the returned layers
to find the primary and cursor layers. And drop the pointer from the
sun4i_drv structure.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:37 +0000 (16:05 +0800)]
drm/sun4i: Initialize crtc from tcon bind function
The tcon provides part of the functionality of the crtc, and also
provides the device node for the output port of the crtc. To be able
to use drm_of_find_possible_crtcs(), all crtc must be initialized before
any downstream encoders. The other part of the crtc is the display
backend.
The Rockchip DRM driver does this by first binding all vops, which is
their crtc, and this step also creates the crtc objects. Then all
remaining hardware components are bound. With the Allwinner display
pipeline, we have multiple components comprising the crtc, and varying
depths of the display pipeline. Since components are added with a depth
first search of the of_graph, we can initialize the crtc object within
the tcon bind function. Since the backend precedes the tcon, and the
backends cannot be muxed or switched around, we can be sure that the
associated backend is already initialized.
This patch also moves the crtc pointer from the main drm_device data to
the tcon device data. Besides the crtc callbacks, the crtc structure is
only used within the tcon driver to signal vblank events from its
interrupt handler.
As the crtc and layer bits are now called from the tcon bits, we must
move them from the sun4i-drm module to the sun4i-tcon module to avoid
circular dependencies between the two modules. This is because sun4i-drm
also calls into sun4i-tcon.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:36 +0000 (16:05 +0800)]
drm/sun4i: Move layers from sun4i_drv to sun4i_crtc
This patch moves the sun4i_layers_init call from sun4i_drv_bind to
sun4i_crtc_init, and the layers pointer from struct sun4i_drv to
struct sun4i_crtc.
The layers are bound to a specific crtc, and they are not directly
used once initiated. They are used through their included drm_plane
structures.
Moving the layers into the crtc facilitates binding them to the crtc
explicitly, by setting the corresponding bit in their .possible_crtcs
fields right after the crtc is initialized. This is done in a later
patch.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:35 +0000 (16:05 +0800)]
drm/sun4i: Add end of list element for sun4i_layers_init's returned list
The number of defined planes in sun4i_layer is unknown to other parts
of the sun4i drm driver. Since the return value of sun4i_layers_init
is a list of layers, make it return 1 more empty layer as an end of
list guard value.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Thu, 23 Feb 2017 08:05:34 +0000 (16:05 +0800)]
drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node
The way drm_of_find_possible_crtcs works is it tries to match the
remote-endpoint of the given node's various endpoints to all the
crtc's .port field. Thus we need to set drm_crtc.port to the output
port node of the underlying TCON.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:29 +0000 (11:13 +0800)]
drm/sun4i: Save newly created layer in layers array in sun4i_layers_init
sun4i_layers_init allocates an array to store pointers to newly created
layers returned by sun4i_layer_init_one(), but fails to actually store
them. But it actually returns the empty array to unsuspecting users.
Save the pointers in the array, so that they may be used later.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:26 +0000 (11:13 +0800)]
drm/sun4i: Check return value of drm_vblank_init
drm_vblank_init can fail due to insufficient memory. Ignoring the error
and proceeding may cause the kernel to dereference an invalid pointer
when vblank is enabled.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:25 +0000 (11:13 +0800)]
drm/sun4i: Fix up error path cleanup for master bind function
The master bind function calls numerous drm functions which initialize
underlying structures. It also tries to bind the various components
of the display pipeline, some of which may add additional drm objects.
This patch adds proper cleanup functions in the error path of the
master bind function.
This requires the patch "drm/sun4i: Move drm_mode_config_cleanup call
to main driver", which splits out drm_mode_config_cleanup from
sun4i_framebuffer_free so we can call it separately.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Chen-Yu Tsai [Fri, 17 Feb 2017 03:13:24 +0000 (11:13 +0800)]
drm/sun4i: Move drm_mode_config_cleanup call to main driver
drm_mode_config_cleanup is the complement of drm_mode_config_init, which
is called in the bind function of sun4i_drv. drm_mode_config_cleanup
should be put in the unbind function to match.
Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Eric Anholt [Wed, 1 Mar 2017 18:56:02 +0000 (10:56 -0800)]
drm/vc4: Fix OOPSes from trying to cache a partially constructed BO.
If a CMA allocation failed, the partially constructed BO would be
unreferenced through the normal path, and we might choose to put it in
the BO cache. If we then reused it before it expired from the cache,
the kernel would OOPS.
Eric Anholt [Wed, 1 Mar 2017 18:56:01 +0000 (10:56 -0800)]
drm/vc4: Fulfill user BO creation requests from the kernel BO cache.
The from_cache flag was actually "the BO is invisible to userspace",
so we can repurpose it to just zero out a cached BO and return it to
userspace.
Improves wall time for a loop of 5 glsl-algebraic-add-add-1 by
-1.44989% +/- 0.862891% (n=28, 1 outlier removed from each that
appeared to be other system noise)
Note that there's an intel-gpu-tools test to check for the proper
zeroing behavior here, which we continue to pass.
Maxime Ripard [Tue, 28 Feb 2017 15:36:51 +0000 (16:36 +0100)]
drm/fb-helper: implement ioctl FBIO_WAITFORVSYNC
Implement legacy framebuffer ioctl FBIO_WAITFORVSYNC in the generic
framebuffer emulation driver. Legacy framebuffer users like non kms/drm
based OpenGL(ES)/EGL implementations may require the ioctl to
synchronize drawing or buffer flip for double buffering. It is tested on
the i.MX6.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Tested-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Commit be7f735cd5ea ("drm: Rely on mode_config data for fb_helper
initialization") dropped the num_crtc argument. Update the
documentation to reflect that and prevent the kernel-doc warnings below:
./drivers/gpu/drm/drm_fb_cma_helper.c:557: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'
./drivers/gpu/drm/drm_fb_cma_helper.c:558: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'
Chris Zhong [Mon, 20 Feb 2017 08:02:22 +0000 (16:02 +0800)]
drm/rockchip/dsi: fix insufficient bandwidth of some panel
Set the lanes bps to 1 / 0.9 times of pclk, the margin is not enough
for some panel, it will cause the screen display is not normal, so
increases the badnwidth to 1 / 0.8.
Chris Zhong [Mon, 20 Feb 2017 08:02:18 +0000 (16:02 +0800)]
drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi
The vopb/vopl switch register of RK3399 mipi is different from RK3288,
the default setting for mipi dsi mode is different too, so add a
of_device_id structure to distinguish them, and make sure set the
correct mode before mipi phy init.
John Keeping [Fri, 24 Feb 2017 12:55:04 +0000 (12:55 +0000)]
drm/rockchip: dw-mipi-dsi: defer probe if panel is not loaded
This ensures that the output resolution is known before fbcon loads.
mipi_dsi_host_register() is moved above dw_mipi_dsi_register() to
simplify error cleanup since the order of these operations does not
matter.
John Keeping [Fri, 24 Feb 2017 12:55:03 +0000 (12:55 +0000)]
drm/rockchip: vop: test for P{H,V}SYNC
When connected to the MIPI DSI output, we need to use N{H,V}SYNC for the
internal connection but these flags are meaningless for DSI panels.
Switch the test so that we do not set the P{H,V}SYNC bits unless the
mode requires it.
Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Mark Yao <mark.yao@rock-chips.com> Reviewed-by: Sean Paul <seanpaul@chromium.org>
[seanpaul resolved conflict using macros instead of hardcoded values] Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20170224125506.21533-21-john@metanate.com
The multiplication ratio for the PLL is required to be even due to the
use of a "by 2 pre-scaler". Currently we are likely to end up with an
odd multiplier even though there is an equivalent set of parameters with
an even multiplier.
For example, using the 324MHz bit rate with a reference clock of 24MHz
we end up with M = 27, N = 2 whereas the example in the PHY databook
gives M = 54, N = 4 for this bit rate and reference clock.
By walking down through the available multiplier instead of up we are
more likely to hit an even multiplier. With the above example we do now
get M = 54, N = 4 as given by the databook.
While doing this, change the loop limits to encode the actual limits on
the divisor, which are:
These values are specified as constant time periods but the PHY
configuration is in terms of the current lane byte clock so using
constant values guarantees that the timings will be outside the
specification with some display configurations.
Derive the necessary configuration from the byte clock in order to
ensure that the PHY configuration is correct.
John Keeping [Fri, 24 Feb 2017 12:54:57 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: ensure PHY is reset
Also don't power up the DSI host at this point since this is not
necessary in order to configure the PHY and we do so later when
selecting video or command mode.
John Keeping [Fri, 24 Feb 2017 12:54:56 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: fix escape clock rate
This clock rate is derived from the PHY PLL, so it should be calculated
dynamically. This calculation is the same as that used by the vendor
kernel and ensures that the escape clock runs at <20MHz as required by
the MIPI specification.
John Keeping [Fri, 24 Feb 2017 12:54:55 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: allow commands in panel_disable
Panel drivers may want to sent commands during the disable function, for
example MIPI_DCS_SET_DISPLAY_OFF before the video signal ends. In order
to send commands we need to write to registers, so pclk must be enabled.
While changing this, remove the unnecessary code after the panel
unprepare call which seems to be a workaround for a specific panel and
thus belongs in the panel driver.
John Keeping [Fri, 24 Feb 2017 12:54:54 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: prepare panel after phy init
Some panels need to be configured with commands sent over the MIPI link,
which they will do in the prepare hook. Call this after the PHY has
been initialized so that we are able to send commands to the panel.
John Keeping [Fri, 24 Feb 2017 12:54:53 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: don't assume buffer is aligned
By dereferencing the MIPI command buffer as a u32* we rely on it being
correctly aligned on ARM, but this may not be the case. Copy it into a
stack variable that will be correctly aligned.
John Keeping [Fri, 24 Feb 2017 12:54:52 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: only request HS clock when required
Requesting the HS clock from the PHY before we initialize it causes an
invalid signal to be sent out since the input clock is not yet
configured. The PHY databook suggests only asserting this signal when
performing HS transfers, so let's do that.
John Keeping [Fri, 24 Feb 2017 12:54:51 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: respect message flags
Instead of always sending commands in LP mode, respect the
MIPI_DSI_MSG_USE_LPM flag to decide how to send each message. Also
request acks if MIPI_DSI_MSG_REQ_ACK is set.
John Keeping [Fri, 24 Feb 2017 12:54:48 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: fix generic packet status check
We want to check that both the GEN_CMD_EMPTY and GEN_PLD_W_EMPTY bits
are set so we can't just check "val & mask" because that will be true if
either bit is set.
In a couple of places here we use "val" for the value that is about to
be written to a register but then reuse the same variable for the value
of a status register before we get around to writing it. Rename the
value to be written to so that we write the value we intend to and not
what we have just read from the status register.
John Keeping [Fri, 24 Feb 2017 12:54:44 +0000 (12:54 +0000)]
drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI
With atomic modesetting the hardware will be powered off when the
mode_set function is called. We should configure the hardware in the
enable function, which is the atomic version of "commit" so let's use
the enable hook rather than commit while we're at it.
Manasi Navare [Fri, 16 Dec 2016 10:29:07 +0000 (12:29 +0200)]
drm/i915: Implement Link Rate fallback on Link training failure
If link training at a link rate optimal for a particular
mode fails during modeset's atomic commit phase, then we
let the modeset complete and then retry. We save the link rate
value at which link training failed, update the link status property
to "BAD" and use a lower link rate to prune the modes. It will redo
the modeset on the current mode at lower link rate or if the current
mode gets pruned due to lower link constraints then, it will send a
hotplug uevent for userspace to handle it.
This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4,
4.3.1.6.
v9:
* Use the trimmed max values of link rate/lane count based on
link train fallback (Daniel Vetter)
v8:
* Set link_status to BAD first and then call mode_valid (Jani Nikula)
v7:
Remove the redundant variable in previous patch itself
v6:
* Obtain link rate index from fallback_link_rate using
the helper intel_dp_link_rate_index (Jani Nikula)
* Include fallback within intel_dp_start_link_train (Jani Nikula)
v5:
* Move set link status to drm core (Daniel Vetter, Jani Nikula)
v4:
* Add fallback support for non DDI platforms too
* Set connector->link status inside set_link_status function
(Jani Nikula)
v3:
* Set link status property to BAd unconditionally (Jani Nikula)
* Dont use two separate variables link_train_failed and link_status
to indicate same thing (Jani Nikula)
v2:
* Squashed a few patches (Jani Nikula)
Acked-by: Tony Cheng <tony.cheng@amd.com> Acked-by: Harry Wentland <Harry.wentland@amd.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/d796cc0c2814d668a47ef43c464f9a4089d46d64.1481883920.git.jani.nikula@intel.com
Manasi Navare [Wed, 1 Mar 2017 14:45:10 +0000 (06:45 -0800)]
drm: Fix the kernel doc warning for drm_link_status
This fixes the kernel doc warning that was introduced in
the 'commit 40ee6fbef75fe6 ("drm: Add a new connector
atomic property for link status")'. Description has
been added for the enum values.
Noralf Trønnes [Thu, 26 Jan 2017 22:56:11 +0000 (23:56 +0100)]
drm/msm: Remove drm_debugfs_remove_files() calls
drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so it's not necessary to call
drm_debugfs_remove_files(). Additionally it uses
debugfs_remove_recursive() to clean up the debugfs files, so no need
to do that.
Noralf Trønnes [Thu, 26 Jan 2017 22:56:21 +0000 (23:56 +0100)]
drm/i915: Remove i915_debugfs_unregister()
drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so no need to do this explicitly. Additionally it
uses debugfs_remove_recursive() to clean up the debugfs files,
so no need for adding fake drm_info_node entries.
Noralf Trønnes [Thu, 26 Jan 2017 22:56:12 +0000 (23:56 +0100)]
drm/nouveau: Remove nouveau_drm_debugfs_cleanup()
drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so the drm_driver.debugfs_cleanup callback is not
needed. Additionally it uses debugfs_remove_recursive() to clean
up the debugfs files, so no need for adding fake drm_info_node
entries.
Noralf Trønnes [Thu, 26 Jan 2017 22:56:07 +0000 (23:56 +0100)]
drm/armada: Remove armada_drm_debugfs_cleanup()
drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so no need to do this explicitly. Additionally it
uses debugfs_remove_recursive() to clean up the debugfs files,
so no need for adding fake drm_info_node entries.
And finally there's no need to clean up on error,
drm_debugfs_cleanup() is called in the error path.
Joan Jani [Tue, 28 Feb 2017 18:59:52 +0000 (18:59 +0000)]
drivers:gpu: vga :vga_switcheroo.c : Fixed some coding style issues
Fixed the following style issues
drivers/gpu/vga/vga_switcheroo.c:98: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:99: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:102: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:103: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:129: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:135: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:217: WARNING: line over 80 characters
drivers/gpu/vga/vga_switcheroo.c:218: WARNING: line over 80 characters
drivers/gpu/vga/vga_switcheroo.c:308: WARNING: please, no space before tabs
drivers/gpu/vga/vga_switcheroo.c:340: WARNING: line over 80 characters
drivers/gpu/vga/vga_switcheroo.c:1087: WARNING: Block comments use * on subsequent lines
drivers/gpu/vga/vga_switcheroo.c:1087: WARNING: Block comments use a trailing */ on a separate line
Daniel Vetter [Tue, 28 Feb 2017 19:36:57 +0000 (20:36 +0100)]
MAINTAINERS: Update git entries for drivers in drm-misc
It's still just an experiment, but one lesson learned from drm-misc is
that not updating MAINTAINERS just leads to confusion. And this is
easy to revert.
Cc: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Mark Yao <mark.yao@rock-chips.com> Cc: Eric Anholt <eric@anholt.net> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Shawn Guo <shawnguo@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170228193657.3559-1-daniel.vetter@ffwll.ch
Eric Anholt [Mon, 27 Feb 2017 20:11:43 +0000 (12:11 -0800)]
drm/vc4: Extend and edit documentation for output from the RST
I had written most of my comments as if I was describing the
individual code files the way I used to for doxygen, while for RST we
want to describe things in a more chapter/section way where there's no
obvious relation to .c files.
Additionally, several of the files had stub descriptions that I've
taken this opportunity to extend.
Michael Zoran [Fri, 24 Feb 2017 01:54:31 +0000 (17:54 -0800)]
drm/vc4: Don't wait for vblank when updating the cursor
Commonly used desktop environments such as xfce4 and gnome
on debian sid can flood the graphics drivers with cursor
updates. Because the current implementation is waiting
for a vblank between cursor updates, this will cause the
display to hang for a long time since a typical refresh
rate is only 60Hz.
This is unnecessary and unexpected by user mode software,
so simply swap out the cursor frame buffer without waiting.
In the qxl atomic model, the primary doesn't stay pinned all the time,
instead it is only pinned/unpinned between prepare_fb and cleanup_fb.
So, we no longer need a final unpin of the primary framebuffer when
disabling the crtc.
Every attempt to pin/unpin objects in memory requires
qxl_bo_reserve/unreserve calls around the pinning operation to protect
the object from concurrent access, which causes that call sequence to be
reproduced every place where pinning is needed. In some cases, that
sequence was not executed correctly, resulting in potential unprotected
pinning operations.
This commit encapsulates the reservation inside a new wrapper to make
sure it is always handled properly. In cases where reservation must be
done beforehand, for some reason, one can use the unprotected version
__qxl_bo_pin/unpin.
Thierry Reding [Tue, 28 Feb 2017 14:46:43 +0000 (15:46 +0100)]
drm: Rename connector list iterator API
Currently the functions that initialize and tear down a connector
iterator use the _get() and _put() suffixes. However, these suffixes
are typically used by reference counting functions.
Make these function names a little more consistent by changing the
suffixes to _begin() and _end(), which is a fairly common pattern in
the rest of the Linux kernel.
Thierry Reding [Tue, 28 Feb 2017 14:46:42 +0000 (15:46 +0100)]
drm: Introduce drm_property_blob_{get,put}()
For consistency with other reference counting APIs in the kernel, add
drm_property_blob_get() and drm_property_blob_put() to reference count
DRM blob properties.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
A semantic patch is provided that can be used to convert all drivers to
the new helpers.
Thierry Reding [Tue, 28 Feb 2017 14:46:41 +0000 (15:46 +0100)]
drm: Introduce drm_gem_object_{get,put}()
For consistency with other reference counting APIs in the kernel, add
drm_gem_object_get() and drm_gem_object_put(), as well as an unlocked
variant of the latter, to reference count GEM buffer objects.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
The existing semantic patch for the DRM subsystem-wide conversion is
extended to account for these new helpers.
Thierry Reding [Tue, 28 Feb 2017 14:46:40 +0000 (15:46 +0100)]
drm: Introduce drm_framebuffer_{get,put}()
For consistency with other reference counting APIs in the kernel, add
drm_framebuffer_get() and drm_framebuffer_put() to reference count DRM
framebuffers.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
The existing semantic patch for the DRM subsystem-wide conversion is
extended to account for these new helpers.
Thierry Reding [Tue, 28 Feb 2017 14:46:39 +0000 (15:46 +0100)]
drm: Introduce drm_connector_{get,put}()
For consistency with other reference counting APIs in the kernel, add
drm_connector_get() and drm_connector_put() functions to reference count
connectors.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
The existing semantic patch for mode object reference count conversion
is extended for these new helpers.
Thierry Reding [Tue, 28 Feb 2017 14:46:38 +0000 (15:46 +0100)]
drm: Introduce drm_mode_object_{get,put}()
For consistency with other reference counting APIs in the kernel, add
drm_mode_object_get() and drm_mode_object_put() to reference count DRM
mode objects.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
A semantic patch is provided that can be used to convert all drivers to
the new helpers.
Thierry Reding [Tue, 28 Feb 2017 14:46:37 +0000 (15:46 +0100)]
drm: Rename drm_mode_object_get()
Subsequent patches will introduce reference counting APIs that are more
consistent with similar APIs throughout the Linux kernel. These APIs use
the _get() and _put() suffixes and will collide with this existing
function.
Rename the function to drm_mode_object_add() which is a slightly more
accurate description of what it does. Also the kerneldoc for this
function gives an indication that it's badly named because it doesn't
actually acquire a reference to anything.
drm: Convert drm_framebuffer_remove to atomic, v4.
Instead of trying to do everything in 1 go, just do a basic safe
conversion first. We've been bitten by too many regressions in the
past.
This patch only converts drm_framebuffer_remove to atomic. The
regression sensitive part is split out to a separate patch.
v2:
- Remove plane->fb assignment, done by drm_atomic_clean_old_fb.
- Add WARN_ON when atomic_remove_fb fails.
- Always call drm_atomic_state_put.
v3:
- Use drm_drv_uses_atomic_modeset
- Handle the case where the first plane-disable-only commit fails
with -EINVAL. Some drivers do not support this, fall back to
disabling all crtc's in this case.
v4:
- Solve vmwgfx compatibility issue in their driver, was fixed in this
patch by v3.
- Move only disabling primary to a separate patch.
Boris Brezillon [Mon, 6 Feb 2017 17:57:19 +0000 (18:57 +0100)]
drm/atmel-hlcdc: Simplify the HLCDC layer logic
An HLCDC layers in Atmel's nomenclature is either a DRM plane or a 'Post
Processing Layer' which can be used to output the results of the HLCDC
composition in a memory buffer.
atmel_hlcdc_layer.c was designed to be generic enough to be re-usable in
both cases, but we're not exposing the post-processing layer yet, and
even if we were, I'm not sure the code would provide the necessary tools
to manipulate this kind of layer.
Moreover, the code in atmel_hlcdc_{plane,layer}.c was designed before the
atomic modesetting API, and was trying solve the
check-setting/commit-if-ok/rollback-otherwise problem, which is now
entirely solved by the existing core infrastructure.
And finally, the code in atmel_hlcdc_layer.c is over-complicated compared
to what we really need. This rework is a good excuse to simplify it. Note
that this rework solves an existing resource leak (leading to a -EBUSY
error) which I failed to clearly identify.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Eric Anholt <eric@anholt.net> Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Lorenzo Stoakes [Mon, 27 Feb 2017 21:50:08 +0000 (21:50 +0000)]
drm/via: use get_user_pages_unlocked()
Moving from get_user_pages() to get_user_pages_unlocked() simplifies the code
and takes advantage of VM_FAULT_RETRY functionality when faulting in pages.