OSDN Git Service

android-x86/kernel.git
5 years agodrm: Add per-plane pixel blend mode property
Lowry Li [Thu, 23 Aug 2018 08:30:19 +0000 (16:30 +0800)]
drm: Add per-plane pixel blend mode property

Pixel blend modes represent the alpha blending equation
selection, describing how the pixels from the current
plane are composited with the background.

Adds a pixel_blend_mode to drm_plane_state and a
blend_mode_property to drm_plane, and related support
functions.

Defines three blend modes in drm_blend.h.

Changes since v1:
 - Moves the blending equation into the DOC comment
 - Refines the comments of drm_plane_create_blend_mode_property to not
   enumerate the #defines, but instead the string values
 - Uses fg.* instead of pixel.* and plane_alpha instead of plane.alpha
Changes since v2:
 - Refines the comments of drm_plane_create_blend_mode_property:
      1) Puts the descriptions (after the ":") on a new line
      2) Adds explaining why @supported_modes need PREMUL as default
Changes since v3:
 - Refines drm_plane_create_blend_mode_property(). drm_property_add_enum()
   can calculate the index itself just fine, so no point in having the
   caller pass it in.
 - Since the current DRM assumption is that alpha is premultiplied
   as default, define DRM_MODE_BLEND_PREMULTI as 0 will be better.
 - Refines some comments.
Changes since v4:
 - Adds comments in drm_blend.h.
 - Removes setting default value in drm_plane_create_blend_mode_property()
   as it is already in __drm_atomic_helper_plane_reset().
 - Fixes to use state->pixel_blend_mode instead of using
   plane->state->pixel_blend_mode in reset function.
 - Rebases on drm-misc-next.

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Lowry Li <lowry.li@arm.com>
Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/245734/
5 years agodrm/sun4i: tcon-top: Use struct_size() in devm_kzalloc()
Gustavo A. R. Silva [Fri, 24 Aug 2018 01:05:21 +0000 (20:05 -0500)]
drm/sun4i: tcon-top: Use struct_size() in devm_kzalloc()

One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
int stuff;
        void *entry[];
};

instance = devm_kzalloc(dev, sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL);

This issue was detected with the help of Coccinelle.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180824010521.GA25451@embeddedor.com
5 years agodrm/syncobj: Drop add/remove_callback from driver interface
Daniel Vetter [Wed, 22 Aug 2018 09:29:05 +0000 (11:29 +0200)]
drm/syncobj: Drop add/remove_callback from driver interface

This is used for handling future fences. Currently no driver use
these, and I think given the new timeline fence proposed by KHR it
would be better to have a more abstract interface for future fences.
Could be something simple like a struct dma_future_fence plus a
function to add a callback or wait for the fence to materialize.

Then syncobj (and anything else really) could grow new functions to
expose these two drivers. Normal dma_fence would then keep the nice
guarantee that they will always signal (and through ordering, be
deadlock free). dma_future_fence would then be the tricky one.

This also fixes sphinx complaining about the kerneldoc.

Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180822092905.19884-1-daniel.vetter@ffwll.ch
5 years agoRevert "drm: crc: Wait for a frame before returning from open()"
Mahesh Kumar [Tue, 21 Aug 2018 08:38:57 +0000 (14:08 +0530)]
Revert "drm: crc: Wait for a frame before returning from open()"

This reverts commit e8fa5671183c80342d520ad81d14fa79a9d4a680.

Don't wait for first CRC during crtc_crc_open. It avoids one frame wait
during open. If application want to wait after read call, it can use
poll/read blocking read() call.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180821083858.26275-4-mahesh1.kumar@intel.com
5 years agodrm/crc: Cleanup crtc_crc_open function
Mahesh Kumar [Tue, 21 Aug 2018 08:38:56 +0000 (14:08 +0530)]
drm/crc: Cleanup crtc_crc_open function

This patch make changes to allocate crc-entries buffer before
enabling CRC generation.
It moves all the failure check early in the function before setting
the source or memory allocation.
Now set_crc_source takes only two variable inputs, values_cnt we
already gets as part of verify_crc_source.

Changes since V1:
 - refactor code to use single spin lock
Changes since V2:
 - rebase
Changes since V3:
 - rebase on top of VKMS driver

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Leo Li <sunpeng.li@amd.com> (V2)
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (V3)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180821083858.26275-3-mahesh1.kumar@intel.com
5 years agodrm/vkms/crc: Implement verify_crc_source callback
Mahesh Kumar [Tue, 21 Aug 2018 08:38:55 +0000 (14:08 +0530)]
drm/vkms/crc: Implement verify_crc_source callback

This patch implements "verify_crc_source" callback function for
Virtual KMS drm driver.

Changes Since V1:
- update values_cnt in verify_crc_source
Changes Since V2:
- don't return early from set_crc_source to keep behavior same (Haneen)

Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180821083858.26275-2-mahesh1.kumar@intel.com
5 years agodrm/fourcc: Add DOC: overview comment
Brian Starkey [Tue, 21 Aug 2018 16:16:11 +0000 (17:16 +0100)]
drm/fourcc: Add DOC: overview comment

There's a number of things which haven't previously been documented
around the usage of format modifiers. Capture the current
understanding in an overview comment and add it to the rst
documentation.

Ideally, the generated documentation would also include documentation
of all of the #defines, but the kernel-doc system doesn't currently
support kernel-doc comments on #define constants.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180821161611.10424-1-brian.starkey@arm.com
5 years agodrm: Use horizontal and vertical chroma subsampling factor while calculating offsets...
Ayan Kumar Halder [Fri, 17 Aug 2018 16:54:00 +0000 (17:54 +0100)]
drm: Use horizontal and vertical chroma subsampling factor while calculating offsets in the physical address of framebuffer

For multi-planar formats, while calculating offsets in planes with index greater than 0
(ie second plane, third plane, etc), one needs to divide (src_x * cpp) with horizontal
chroma subsampling factor and (src_y * pitch) with vertical chroma subsampling factor.

The reason being that the planes contain subsampled (ie reduced) data (by a factor of 2) and thus
while calculating the byte position coresponding to the x and y co-ordinates, one needs to
divide it with the sampling factor.

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.kernel.org/patch/10569263/
5 years agodrm/vgem: Remove unecessary dma_fence_ops
Daniel Vetter [Thu, 9 Aug 2018 12:45:44 +0000 (14:45 +0200)]
drm/vgem: Remove unecessary dma_fence_ops

dma_fence_default_wait is the default now, same for the trivial
enable_signaling implementation.

Also remove the ->signaled callback, vgem can't peek ahead with a
fastpath, returning false is the default implementation.

v2: Protect the meaningful space! (Chris)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Kees Cook <keescook@chromium.org>
Cc: Cihangir Akturk <cakturk@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180809124544.9250-1-daniel.vetter@ffwll.ch
5 years agodrm/nouveau: Remove unecessary dma_fence_ops
Daniel Vetter [Wed, 4 Jul 2018 09:29:07 +0000 (11:29 +0200)]
drm/nouveau: Remove unecessary dma_fence_ops

dma_fence_default_wait is the default now.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20180704092909.6599-4-daniel.vetter@ffwll.ch
5 years agodrm/msm: Remove unecessary dma_fence_ops
Daniel Vetter [Wed, 4 Jul 2018 09:29:06 +0000 (11:29 +0200)]
drm/msm: Remove unecessary dma_fence_ops

dma_fence_default_wait is the default now, same for the trivial
enable_signaling implementation.

v2: Also remove the relase hook, dma_fence_free is the default.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robdclark@gmail.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20180704092909.6599-3-daniel.vetter@ffwll.ch
5 years agodrm/i915: Remove unecessary dma_fence_ops
Daniel Vetter [Wed, 4 Jul 2018 09:29:05 +0000 (11:29 +0200)]
drm/i915: Remove unecessary dma_fence_ops

dma_fence_default_wait is the default now, same for the trivial
enable_signaling implementation.

v2: Also remove the relase hook, dma_fence_free is the default.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20180704092909.6599-2-daniel.vetter@ffwll.ch
5 years agodrm/gma500: Do not include <drm/drm_global.h>
Thomas Zimmermann [Fri, 17 Aug 2018 08:21:38 +0000 (10:21 +0200)]
drm/gma500: Do not include <drm/drm_global.h>

The gma500 driver has no dependencies on drm_global.h. Remove the include
statement.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180817082138.26628-1-tzimmermann@suse.de
5 years agodrm/panel: Fix sphinx warning
Sean Paul [Wed, 15 Aug 2018 20:38:28 +0000 (16:38 -0400)]
drm/panel: Fix sphinx warning

Resolves the following warnings.
../drivers/gpu/drm/drm_panel.c:158: WARNING: Unexpected indentation.
../drivers/gpu/drm/drm_panel.c:159: WARNING: Block quote ends without a blank line; unexpected unindent.

Fixes: c59eb3cfde1f ("drm/panel: Let of_drm_find_panel() return -ENODEV when the panel is disabled")
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180815203833.210143-1-sean@poorly.run
5 years agodrm/bridge: ti-sn65dsi86: Fix 0-day build error
Guenter Roeck [Wed, 15 Aug 2018 19:49:14 +0000 (15:49 -0400)]
drm/bridge: ti-sn65dsi86: Fix 0-day build error

0day reports:

>> drivers/gpu/drm/bridge/ti-sn65dsi86.o: In function
mipi_dsi_detach'
>> drivers/gpu/drm/bridge/ti-sn65dsi86.c:630: undefined reference to
ti_sn_bridge_attach':
>> drivers/gpu/drm/bridge/ti-sn65dsi86.c:249: undefined reference to
mipi_dsi_device_register_full'
>> drivers/gpu/drm/bridge/ti-sn65dsi86.c:276: undefined reference to
mipi_dsi_device_unregister'

Quite obviously the driver depends on DRM_MIPI_DSI.
We can not use depends since the driver configuration uses select,
so we'll have to select the missing dependency instead.

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180815194923.3258-1-sean@poorly.run
5 years agodrm: Add kerneldoc description for "link"-member in struct drm_panel
Jyri Sarha [Wed, 15 Aug 2018 17:03:31 +0000 (20:03 +0300)]
drm: Add kerneldoc description for "link"-member in struct drm_panel

Add kerneldoc description for "struct device_link *link"-member in
struct drm_panel.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1534352611-19074-1-git-send-email-jsarha@ti.com
5 years agodrm/dp: add extended receiver capability field present bit
Matt Atwood [Mon, 23 Jul 2018 21:27:34 +0000 (14:27 -0700)]
drm/dp: add extended receiver capability field present bit

This bit was added to DP Training Aux RD interval with DP 1.3. Via
descriptiion of the spec this field indicates the panels true
capabilities are described in DPCD address space 02200h through 022FFh.

v2: version comment update
v3: version comment correction, commit message update
v4: white space correction

Signed-off-by: Matt Atwood <matthew.s.atwood@intel.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
[manasi: fixup whitespace per Rodrigo's comment]
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180723212735.23893-1-matthew.s.atwood@intel.com
5 years agodrm/bridge: ti-sn65dsi86: Poll for training complete
Sean Paul [Mon, 13 Aug 2018 21:30:45 +0000 (17:30 -0400)]
drm/bridge: ti-sn65dsi86: Poll for training complete

Instead of just waiting 20ms for training to complete, actually poll the
status to ensure training is finished.

Changes in v3:
- Added to the set

Cc: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180813213058.184821-7-sean@poorly.run
5 years agodrm/bridge: ti-sn65dsi86: Poll for DP PLL Lock
Sean Paul [Mon, 13 Aug 2018 21:30:44 +0000 (17:30 -0400)]
drm/bridge: ti-sn65dsi86: Poll for DP PLL Lock

Instead of just waiting and hoping, actually poll for the pll lock to be
acquired. As a bonus, this should be significantly faster than the
sleep.

Changes in v3:
- Added to the set

Cc: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180813213058.184821-6-sean@poorly.run
5 years agodrm/bridge: ti-sn65dsi86: Move panel_prepare() to pre_enable()
Sean Paul [Mon, 13 Aug 2018 21:30:43 +0000 (17:30 -0400)]
drm/bridge: ti-sn65dsi86: Move panel_prepare() to pre_enable()

prepare() is the old-timey way to say pre_enable(). It should be called
before modeset. This fixes an issue where the panel on cheza must have
the regulator always-on/boot-on for it to work.

Changes in v3:
- Added to the set

Cc: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180813213058.184821-5-sean@poorly.run
5 years agodrm/bridge: ti-sn65dsi86: Implement AUX channel
Sean Paul [Mon, 13 Aug 2018 21:30:42 +0000 (17:30 -0400)]
drm/bridge: ti-sn65dsi86: Implement AUX channel

This was hand-rolled in the first version, and will surely be useful as
we expand the driver to support more varied use cases.

Changes in v2:
- Change subject prefix s/panel/bridge/
- Downgrade warning in poll function to error message
- Fix DP_EDP_CONFIGURATION_SET write value (Sandeep)
- Mask upper 8 bits of msg->address (Sandeep)
- Check aux cmd status for errors after completing the send (Sandeep)
- Remove length check since it's covered in the aux status
- Flip the READ check in transfer to WRITE check + early exit
Changes in v3:
- Added to the set
- Wrapped (x) in WDATA/RDATA #defines
- Replace readx_poll* with regmap_read_poll*

Cc: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180813213058.184821-4-sean@poorly.run
5 years agodrm/bridge: ti-sn65dsi86: Fixup register names
Sean Paul [Mon, 13 Aug 2018 21:30:41 +0000 (17:30 -0400)]
drm/bridge: ti-sn65dsi86: Fixup register names

Order registers by offset and rename bits & masks to match the
datasheet. This makes the driver a bit easier to grok and
cross-reference with the datasheet.

Changes in v3:
- Added to the set

Cc: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180813213058.184821-3-sean@poorly.run
5 years agodrm/rcar-du/crc: Implement get_crc_sources callback
Mahesh Kumar [Wed, 8 Aug 2018 15:26:30 +0000 (20:56 +0530)]
drm/rcar-du/crc: Implement get_crc_sources callback

This patch implements get_crc_sources callback, which returns list of
all the crc sources supported by driver in current platform.

Changes Since V1:
 - move sources list per-crtc
 - init sources-list only for gen3
Changes Since V2:
 - Adopt to driver style
 - Address other review comments from Laurent Pinchart
Changes Since V3/4/5: (Laurent Pinchart review)
 - s/rcar_du_crtc_crc_sources_list_init/rcar_du_crtc_crc_init
 - s/rcar_du_crtc_crc_sources_list_uninit/rcar_du_crtc_crc_cleanup
 - other cleanup

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180808152630.6563-1-mahesh1.kumar@intel.com
5 years agodrm/i915/crc: implement get_crc_sources callback
Mahesh Kumar [Fri, 13 Jul 2018 13:59:39 +0000 (19:29 +0530)]
drm/i915/crc: implement get_crc_sources callback

This patch implements get_crc_sources callback, which returns list of
all the valid crc sources supported by driver in current platform.

Changes since V1:
 - Return array of crc sources

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-8-mahesh1.kumar@intel.com
5 years agodrm/i915/crc: implement verify_crc_source callback
Mahesh Kumar [Fri, 13 Jul 2018 13:59:38 +0000 (19:29 +0530)]
drm/i915/crc: implement verify_crc_source callback

This patch implements verify_crc_source callback function introduced
earlier in this series.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-7-mahesh1.kumar@intel.com
5 years agodrm/rcar-du/crc: Implement verify_crc_source callback
Mahesh Kumar [Mon, 23 Jul 2018 10:38:24 +0000 (16:08 +0530)]
drm/rcar-du/crc: Implement verify_crc_source callback

This patch implements "verify_crc_source" callback function for
rcar drm driver.

Changes Since V1:
 - avoid duplication of code
Changes Since V2:
 - further optimize the code
Changes Since V3:
 - Adopt to driver style
 - Address review comments from Laurent Pinchart

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180723103824.21734-1-mahesh1.kumar@intel.com
5 years agodrm/amdgpu_dm/crc: Implement verify_crc_source callback
Mahesh Kumar [Fri, 13 Jul 2018 13:59:36 +0000 (19:29 +0530)]
drm/amdgpu_dm/crc: Implement verify_crc_source callback

This patch implements "verify_crc_source" callback function for
AMD drm driver.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-5-mahesh1.kumar@intel.com
5 years agodrm/rockchip/crc: Implement verify_crc_source callback
Mahesh Kumar [Fri, 13 Jul 2018 13:59:35 +0000 (19:29 +0530)]
drm/rockchip/crc: Implement verify_crc_source callback

This patch implements "verify_crc_source" callback function for
rockchip drm driver.

Changes since V1:
 - simplify the verification (Jani N)

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-4-mahesh1.kumar@intel.com
5 years agodrm: crc: Introduce get_crc_sources callback
Mahesh Kumar [Fri, 13 Jul 2018 13:59:34 +0000 (19:29 +0530)]
drm: crc: Introduce get_crc_sources callback

This patch introduce a callback function "get_crc_sources" which
will be called during read of control node. It is an optional
callback function and if driver implements this callback, driver
should return a constant pointer to an array of crc sources list
and update count according to the number of source in the list.

Changes Since V1: (Daniel)
 - return const pointer to an array of crc sources list
 - do validation of sources in CRC-core
Changes Since V2:
 - update commit message
 - update callback documentation
 - print one source name per line

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-3-mahesh1.kumar@intel.com
5 years agodrm: crc: Introduce verify_crc_source callback
Mahesh Kumar [Fri, 13 Jul 2018 13:59:33 +0000 (19:29 +0530)]
drm: crc: Introduce verify_crc_source callback

This patch adds a new callback function "verify_crc_source" which will
be used during setting the crc source in control node. This will help
in avoiding setting of wrong string for source.

Changes since V1:
 - do not yet verify_crc_source during open.
Changes since V1:
 - improve callback description

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-2-mahesh1.kumar@intel.com
5 years agodrm/virtio: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Mon, 16 Jul 2018 07:49:40 +0000 (09:49 +0200)]
drm/virtio: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20180716074940.8691-1-tzimmermann@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm: qxl: Fix NULL pointer dereference at qxl_alloc_client_monitors_config
Anton Vasilyev [Fri, 27 Jul 2018 15:30:58 +0000 (18:30 +0300)]
drm: qxl: Fix NULL pointer dereference at qxl_alloc_client_monitors_config

If qxl_alloc_client_monitors_config() fails to allocate
client_monitors_config then NULL pointer dereference occurs
in function qxl_display_copy_rom_client_monitors_config() after
qxl_alloc_client_monitors_config() call.

The patch adds return error from qxl_alloc_client_monitors_config()
and additional status for qxl_display_copy_rom_client_monitors_config
return value.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Link: http://patchwork.freedesktop.org/patch/msgid/20180727153058.23620-1-vasilyev@ispras.ru
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm: qxl: Fix error handling at qxl_device_init
Anton Vasilyev [Fri, 27 Jul 2018 11:54:40 +0000 (14:54 +0300)]
drm: qxl: Fix error handling at qxl_device_init

If qxl_device_init fails on creating resources and does not report it,
then qxl module will catch null pointer exception on remove, or on
probe's error path.

The patch adds error path with resources release into qxl_device_init.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Link: http://patchwork.freedesktop.org/patch/msgid/20180727115440.11112-1-vasilyev@ispras.ru
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/qxl: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Fri, 13 Jul 2018 12:03:18 +0000 (14:03 +0200)]
drm/qxl: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20180713120318.32195-1-tzimmermann@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/cirrus: flip default from 24bpp to 16bpp
Gerd Hoffmann [Wed, 8 Aug 2018 11:13:11 +0000 (13:13 +0200)]
drm/cirrus: flip default from 24bpp to 16bpp

The problem with 24bpp is that it is a rather unusual depth these days,
cirrus is pretty much the only relevant device still using that, and it
is a endless source of issues.  Wayland doesn't support it at all.  Bugs
in Xorg keep showing up.

Typically either 32bpp or 16bpp are used.  Using 32bpp would limit the
resolution to 800x600 due to hardware constrains.  So lets go with 16bpp.

Also use the default depth for the framebuffer console and
mode_info->preferred_depth.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20180808111311.30311-1-kraxel@redhat.com
5 years agodrm/cirrus: Use drm_framebuffer_put to avoid kernel oops in clean-up
Thomas Zimmermann [Fri, 20 Jul 2018 11:27:43 +0000 (13:27 +0200)]
drm/cirrus: Use drm_framebuffer_put to avoid kernel oops in clean-up

In the Cirrus driver, the regular clean-up code also performs the clean-up
of a failed initialization. If the fbdev's framebuffer was not initialized,
the clean-up will fail within drm_framebuffer_unregister_private. Booting
with cirrus.bpp=16 triggers this bug.

The framebuffer is currently stored directly within struct cirrus_fbdev. To
fix the bug, we turn it into a pointer that is only set for initialized
framebuffers. The fbdev's clean-up code skips uninitialized framebuffers.

The memory for struct drm_framebuffer is allocated dynamically. This requires
additional error handling within cirrusfb_create. The framebuffer clean-up is
now performed by drm_framebuffer_put, which also frees the data strcuture's
memory.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1101822
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20180720112743.27159-1-tzimmermann@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodma-buf: Remove requirement for ops->map() from dma_buf_export
Chris Wilson [Tue, 7 Aug 2018 18:36:47 +0000 (19:36 +0100)]
dma-buf: Remove requirement for ops->map() from dma_buf_export

Since commit 9ea0dfbf972 ("dma-buf: make map_atomic and map function
pointers optional"), the core provides the no-op functions when map and
map_atomic are not provided, so we no longer need assert that are
supplied by a dma-buf exporter.

Fixes: 09ea0dfbf972 ("dma-buf: make map_atomic and map function pointers optional")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20180807183647.22626-1-chris@chris-wilson.co.uk
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/vgem: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Mon, 16 Jul 2018 07:46:24 +0000 (09:46 +0200)]
drm/vgem: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180716074624.7931-1-tzimmermann@suse.de
5 years agodrm/vmwgfx: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:30 +0000 (17:15 +0100)]
drm/vmwgfx: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Acked-by: Sinclair Yeh <syeh@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-11-alexandru-cosmin.gheorghe@arm.com
5 years agodrm/vc4: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:29 +0000 (17:15 +0100)]
drm/vc4: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Acked-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-10-alexandru-cosmin.gheorghe@arm.com
5 years agodrm/doc: clarify how to acquire required vblank event reference
Stefan Agner [Tue, 7 Aug 2018 20:11:43 +0000 (22:11 +0200)]
drm/doc: clarify how to acquire required vblank event reference

As a driver write it is not entirely obvious that a reference to
the event e mentioned in the doc can be obtained via
drm_crtc_vblank_get(). Clarify how to obtain the reference.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180807201143.7446-1-stefan@agner.ch
5 years agodrm/vkms: Fix vmap_count increment position
Haneen Mohammed [Wed, 1 Aug 2018 09:08:07 +0000 (12:08 +0300)]
drm/vkms: Fix vmap_count increment position

Move vmap_count out of the conditional statement since it needs
to be updated for every successful call to vkms_gem_vmap.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Fixes: bb112b14af8d ("drm/vkms: Add functions to map/unmap GEM backing storage")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180801090807.GA4611@haneenDRM
5 years agogpu: drm: virtio: code cleanup
Souptick Joarder [Tue, 3 Jul 2018 15:33:53 +0000 (21:03 +0530)]
gpu: drm: virtio: code cleanup

The fault handler code is commented since v4.2.
If there is no plan to enable the fault handler
code in future, we can remove this dead code.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20180703153353.GA3375@jordon-HP-15-Notebook-PC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm: Remove drm_fbdev_cma_set_suspend()
Souptick Joarder [Mon, 30 Jul 2018 19:23:26 +0000 (00:53 +0530)]
drm: Remove drm_fbdev_cma_set_suspend()

drm_fbdev_cma_set_suspend() is not getting called from
any other places. If there is no plan to use it in future
we can remove this API.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180730192326.GA31354@jordon-HP-15-Notebook-PC
5 years agodrm/tinydrm: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Fri, 13 Jul 2018 13:46:01 +0000 (15:46 +0200)]
drm/tinydrm: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713134601.14391-1-tzimmermann@suse.de
5 years agodrm/sti: do not remove the drm_bridge that was never added
Peter Rosin [Mon, 6 Aug 2018 06:19:09 +0000 (08:19 +0200)]
drm/sti: do not remove the drm_bridge that was never added

Removing the drm_bridge_remove call should avoid a NULL dereference
during list processing in drm_bridge_remove if the error path is ever
taken.

The more natural approach would perhaps be to add a drm_bridge_add,
but there are several other bridges that never call drm_bridge_add.
Just removing the drm_bridge_remove is the easier fix.

Fixes: 84601dbdea36 ("drm: sti: rework init sequence")
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180806061910.29914-2-peda@axentia.se
5 years agodrm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:27 +0000 (17:15 +0100)]
drm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-8-alexandru-cosmin.gheorghe@arm.com
5 years agodrm/sun4i: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:28 +0000 (17:15 +0100)]
drm/sun4i: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-9-alexandru-cosmin.gheorghe@arm.com
5 years agodrm/imx: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:26 +0000 (17:15 +0100)]
drm/imx: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-7-alexandru-cosmin.gheorghe@arm.com
5 years agodrm: atmel-hlcdc: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:24 +0000 (17:15 +0100)]
drm: atmel-hlcdc: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-5-alexandru-cosmin.gheorghe@arm.com
5 years agodrm: mali-dp: Use __drm_atomic_helper_plane_reset instead of copying the logic
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:23 +0000 (17:15 +0100)]
drm: mali-dp: Use __drm_atomic_helper_plane_reset instead of copying the logic

A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Reviewed-by: Ayan Kumar halder <ayan.halder@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-4-alexandru-cosmin.gheorghe@arm.com
5 years agodrm/atomic: Add __drm_atomic_helper_plane_reset
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:21 +0000 (17:15 +0100)]
drm/atomic: Add __drm_atomic_helper_plane_reset

There are a lot of drivers that subclass drm_plane_state, all of them
duplicate the code that links together the plane with plane_state.

On top of that, drivers that enable core properties also have to
duplicate the code for initializing the properties to their default
values, which in all cases are the same as the defaults from core.

Change since v1:
- Make it consistent with the other helpers and require that both
  plane and state not be NULL, suggested by Boris Brezillon and
  Philipp Zabel.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-2-alexandru-cosmin.gheorghe@arm.com
5 years agodrm/vkms: Release pages_lock before return
Haneen Mohammed [Fri, 3 Aug 2018 20:11:42 +0000 (23:11 +0300)]
drm/vkms: Release pages_lock before return

Release pages_lock before return when vkms_obj->vaddr is NULL.
This patch fixes: 6c234fe37c57 ("drm/vkms: Implement CRC debugfs API").

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180803201142.GA2206@haneenDRM
5 years agodrm/vkms: Implement CRC debugfs API
Haneen Mohammed [Thu, 2 Aug 2018 01:10:26 +0000 (04:10 +0300)]
drm/vkms: Implement CRC debugfs API

This patch implement the necessary functions to compute and add CRCs
entries:

- Implement the set_crc_source() callback.
- Compute CRC using crc32 on the visible part of the framebuffer.
- Use ordered workqueue per output to compute and add CRC at the end
  of a vblank.
- Use appropriate synchronization methods since the CRC computation must
  be atomic wrt the generated vblank event for a given atomic update, by
  using spinlock across atomic_begin/atomic_flush to wrap the event
  handling code completely and match the flip event with the CRC.

Since vkms_crc_work_handle() can sleep, spinlock can't be acquired
while accessing vkms_output->primary_crc to compute CRC.
To make sure the data is updated and released without conflict with
the vkms_crc_work_handle(), the work_struct is flushed @crtc_destroy
and the data is updated before scheduling the work handle again, as
follow:

* CRC data update:
1- store vkms_crc_data {fb, src} per plane_state
2- @plane_duplicate_state -> allocate vkms_crc_data
3- during atomic commit (@atomic_update) ->
a) copy {fb, src} to plane_state->crc_data
b) get reference to fb,
3- @plane_destroy_state -> a) if (fb refcount) remove reference to fb
   b) deallocate crc_data

* Atomic Commit:
1- vkms_plane_atomic_check
2- vkms_prepare_fb -> vmap vkms_gem_obj->vaddr
3- atomic_begin -> hold crc spinlock
4- atomic_plane_update -> a) update vkms_output->primary_crc
  b) get reference to fb
5- atomic_flush -> a) send vblank event while holding event_lock
   b) release crc spinlock

* hrtimer regular callback:
1- hold crc spinlock
2- drm_crtc_handle_vblank()
3- queue vkms_crc_work_handle
4- release crc spinlock

* cleanup:
1- @cleanup_fb ->vunmap vkms_gem_obj->vaddr
2- @crtc_destroy -> flush work struct
3- @plane_destroy -> a) if (fb refcount) remove reference to fb
     b) deallocate crc_data

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
[seanpaul fixed typo in vkms_crtc s/vblamk/vblank/]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/b948327f48c3e70ab232b4a0848ee6d033b26484.1533171495.git.hamohammed.sa@gmail.com
5 years agodrm/vkms: Subclass plane state
Haneen Mohammed [Thu, 2 Aug 2018 01:08:22 +0000 (04:08 +0300)]
drm/vkms: Subclass plane state

Subclass plane state struct to enable storing driver's private
state. This patch only adds the base drm_plane_state struct and
the atomic functions that handle it.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/c35c512c8987a7255aac94a9eb985d2dd3e6c90d.1533171495.git.hamohammed.sa@gmail.com
5 years agodrm/rockchip: vop: add px30 vop support
Sandy Huang [Tue, 26 Jun 2018 08:53:35 +0000 (16:53 +0800)]
drm/rockchip: vop: add px30 vop support

PX30 have vop big and vop lite, just like rk3036 and rk3126
the max input and output resolution is 1920x1080, the main
difference between the two vop is:

vop big:
    win0 support yuv and rgb format;
    win1 and win2 support rgb format;
vop lit:
    win1 support rgb format;

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1530003215-46593-3-git-send-email-hjc@rock-chips.com
5 years agodt-bindings: display: rockchip: add document for px30 vop
Sandy Huang [Tue, 26 Jun 2018 08:53:34 +0000 (16:53 +0800)]
dt-bindings: display: rockchip: add document for px30 vop

Add the compatible values for the px30 display controllers.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
[added commit message]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1530003215-46593-2-git-send-email-hjc@rock-chips.com
5 years agodrm/dp: add missing ')' to I2C nack debug message
Paulo Zanoni [Fri, 27 Jul 2018 20:33:31 +0000 (13:33 -0700)]
drm/dp: add missing ')' to I2C nack debug message

 "(an unmatched left parenthesis
  creates an unresolved tension
  that will stay with you all day."
               -- Randall Munroe

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180727203331.27778-1-paulo.r.zanoni@intel.com
5 years agodrm/rockchip: Convert drm_atomic_helper_suspend/resume()
Souptick Joarder [Tue, 31 Jul 2018 20:34:30 +0000 (02:04 +0530)]
drm/rockchip: Convert drm_atomic_helper_suspend/resume()

convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().

With this conversion, rockchip_drm_fb_resume() and
rockchip_drm_fb_suspend() will not be used anymore.
Both of these functions can be removed.

Also, in struct rockchip_drm_private state will not be
used anymore. So this can be removed forever.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Co-Developed-by: Ajit Negi <ajitn.linux@gmail.com>
[changed to Co-Developed-by, according to process/submitting-patches.rst]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180731203430.GA30136@jordon-HP-15-Notebook-PC
5 years agodrm/bridge/ti-sn65dsi86: Fix implicit declaration to drm_mode_connector_attach_encoder
Sean Paul [Mon, 30 Jul 2018 17:42:21 +0000 (13:42 -0400)]
drm/bridge/ti-sn65dsi86: Fix implicit declaration to drm_mode_connector_attach_encoder

This function name was changed to drm_connector_attach_encoder().
Unfortunately this driver was posted on the list before that change, and
applied after

Fixes: a095f15c00e2 ("drm/bridge: add support for sn65dsi86 bridge
driver")
Cc: Sandeep Panda <spanda@codeaurora.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Reviewed-by: Sandeep Panda <spanda@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180730174225.257255-1-seanpaul@chromium.org
5 years agodrm/vkms: Use new return type vm_fault_t
Souptick Joarder [Thu, 26 Jul 2018 14:45:49 +0000 (20:15 +0530)]
drm/vkms: Use new return type vm_fault_t

Use new return type vm_fault_t for fault handler.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180726144549.GA9434@jordon-HP-15-Notebook-PC
5 years agodrm/bridge/tc358764: fix drm helper name
Andrzej Hajda [Fri, 27 Jul 2018 09:48:59 +0000 (11:48 +0200)]
drm/bridge/tc358764: fix drm helper name

Recently drm_mode_connector_attach_encoder changed it's name. The change
was not noticed by bridge author, as a result gcc reports compile error
on next branch.

Fixes: f38b7cca6d0e ("drm/bridge: tc358764: Add DSI to LVDS bridge driver")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180727094859.27727-1-a.hajda@samsung.com
5 years agodrm/vkms: subclass CRTC state
Haneen Mohammed [Tue, 24 Jul 2018 16:31:05 +0000 (19:31 +0300)]
drm/vkms: subclass CRTC state

Subclass CRTC state struct to enable storing driver's private
state. This patch only adds the base drm_crtc_state struct and
the atomic functions that handle it.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1f3564a5a0a6c4410c5d383c86a572ddda4818a8.1532446182.git.hamohammed.sa@gmail.com
5 years agodrm/vkms: Add atomic_helper_check_plane_state
Haneen Mohammed [Tue, 24 Jul 2018 16:30:22 +0000 (19:30 +0300)]
drm/vkms: Add atomic_helper_check_plane_state

Call atomic_helper_check_plane_state to clip plane coordinates.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/b8c1bfed8b5720cc4794ace41cf49af66c99a48c.1532446182.git.hamohammed.sa@gmail.com
5 years agodrm/vkms: map/unmap buffers in [prepare/cleanup]_fb hooks
Haneen Mohammed [Tue, 24 Jul 2018 16:29:23 +0000 (19:29 +0300)]
drm/vkms: map/unmap buffers in [prepare/cleanup]_fb hooks

This patch map/unmap GEM backing memory to kernel address space
in prepare/cleanup_fb respectively and cache the virtual address
for later use.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/17d19f61b6539ce1b614c59762d04d816261b307.1532446182.git.hamohammed.sa@gmail.com
5 years agodrm/vkms: Add functions to map/unmap GEM backing storage
Haneen Mohammed [Tue, 24 Jul 2018 16:26:59 +0000 (19:26 +0300)]
drm/vkms: Add functions to map/unmap GEM backing storage

This patch add the necessary functions to map/unmap GEM
backing memory to the kernel's virtual address space.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/4b6563ae4f4337a5fd51f872424addf64e8d59a6.1532446182.git.hamohammed.sa@gmail.com
5 years agodrm/bridge/synopsys: remove commented-out flag in Makefile
Masahiro Yamada [Wed, 25 Jul 2018 05:25:48 +0000 (14:25 +0900)]
drm/bridge/synopsys: remove commented-out flag in Makefile

Please do not comment out unneeded code.  Remove.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1532496348-11589-1-git-send-email-yamada.masahiro@socionext.com
5 years agodrm/bridge: tc358764: Add DSI to LVDS bridge driver
Andrzej Hajda [Wed, 25 Jul 2018 15:46:40 +0000 (17:46 +0200)]
drm/bridge: tc358764: Add DSI to LVDS bridge driver

Add a drm_bridge driver for the Toshiba TC358764 DSI to LVDS bridge.

Changes in v4:
- removed license blob,
- ordered includes,
- added error handling,
- fixed reset GPIO handling,
- added missing calls to the panel,
- custom OF graph code replaced with helpers,
- removed tc358764_poweroff from remove callback.
v5:
- fixed supply names,
- fixed broken console - added connector to fb_helper,
- added detach callback - unbinding works,
- fixed typo in error checking code,
- removed sparse bridge->encoder check - core does it already.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Maciej Purski <m.purski@samsung.com>
[ a.hajda@samsung.com: v4, v5 ]
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180725154644.25412-6-a.hajda@samsung.com
5 years agodt-bindings: tc358754: add DT bindings
Andrzej Hajda [Wed, 25 Jul 2018 15:46:39 +0000 (17:46 +0200)]
dt-bindings: tc358754: add DT bindings

The patch adds bindings to Toshiba DSI/LVDS bridge TC358764.
Bindings describe power supplies, reset gpio and video interfaces.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Maciej Purski <m.purski@samsung.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180725154644.25412-5-a.hajda@samsung.com
5 years agodrm/bridge: add support for sn65dsi86 bridge driver
Sandeep Panda [Fri, 20 Jul 2018 06:54:02 +0000 (12:24 +0530)]
drm/bridge: add support for sn65dsi86 bridge driver

Add support for TI's sn65dsi86 dsi2edp bridge chip.
The chip converts DSI transmitted signal to eDP signal,
which is fed to the connected eDP panel.

This chip can be controlled via either i2c interface or
dsi interface. Currently in driver all the control registers
are being accessed through i2c interface only.
Also as of now HPD support has not been added to bridge
chip driver.

Changes in v1:
 - Split the dt-bindings and the driver support into separate patches
   (Andrzej Hajda).
 - Use of gpiod APIs to parse and configure gpios instead of obsolete ones
   (Andrzej Hajda).
 - Use macros to define the register offsets (Andrzej Hajda).

Changes in v2:
 - Separate out edp panel specific HW resource handling from bridge
   driver and create a separate edp panel drivers to handle panel
   specific mode information and HW resources (Sean Paul).
 - Replace pr_* APIs to DRM_* APIs to log error or debug information
   (Sean Paul).
 - Remove some of the unnecessary structure/variable from driver (Sean
   Paul).
 - Rename the function and structure prefix "sn65dsi86" to "ti_sn_bridge"
   (Sean Paul / Rob Herring).
 - Remove most of the hard-coding and modified the bridge init sequence
   based on current mode (Sean Paul).
 - Remove the existing function to retrieve the EDID data and
   implemented this as an i2c_adapter and use drm_get_edid() (Sean Paul).
 - Remove the dummy irq handler implementation, will add back the
   proper irq handling later (Sean Paul).
 - Capture the required enable gpios in a single array based on dt entry
   instead of having individual descriptor for each gpio (Sean Paul).

Changes in v3:
 - Remove usage of irq_gpio and replace it as "interrupts" property (Rob
   Herring).
 - Remove the unnecessary header file inclusions (Sean Paul).
 - Rearrange the header files in alphabetical order (Sean Paul).
 - Use regmap interface to perform i2c transactions.
 - Update Copyright/License field and address other review comments
   (Jordan Crouse).

Changes in v4:
 - Update License/Copyright (Sean Paul).
 - Add Kconfig and Makefile changes (Sean Paul).
 - Drop i2c gpio handling from this bridge driver, since i2c sda/scl gpios
   will be handled by i2c master.
 - Update required supplies names.
 - Remove unnecessary goto statements (Sean Paul).
 - Add mutex lock to power_ctrl API to avoid race conditions (Sean
   Paul).
 - Add support to parse reference clk frequency from dt(optional).
 - Update the bridge chip enable/disable sequence.

Changes in v5:
 - Fixed Kbuild test service reported warnings.

Changes in v6:
 - Use PM runtime based ref-counting instead of local ref_count mechanism
   (Stephen Boyd).
 - Clean up some debug logs and indentations (Sean Paul).
 - Simplify dp rate calculation (Sean Paul).
 - Add support to configure refclk based on input REFCLK pin or DACP/N
   pin (Stephen Boyd).

Changes in v7:
 - Use static supply entries instead of dynamic allocation (Andrzej
   Hajda).
 - Defer bridge driver probe if panel is not probed (Andrzej Hajda).
 - Update of_graph APIs for correct node reference management. (Andrzej
   Hajda).
 - Remove local display_mode object (Andrzej Hajda).
 - Remove version id check function from driver.

Changes in v8:
 - Move dsi register/attach function to bridge driver probe (Andrzej
   Hajda).
 - Introduce a new helper function to write 16bit words into consecutive
   registers (Andrzej Hajda).
 - Remove unnecessary macros (Andrzej Hajda).

Changes in v9:
 - Remove dsi register/attach from bridge probe, since dsi dev register
   completion also waits for any panel or bridge to get added. This creates
   deadlock situation when bridge driver calls dsi dev register and
   attach before bridge add, in its probe function.
 - Fix issues faced during testing of bridge driver on actual HW.
 - Remove unnecessary initializations (Stephen Boyd).
 - Use local refclk lut size instead of global macro (Sean Paul).

Changes in v10:
 - Use refclk to determine if continuous dsi clock is needed or not.

Changes in v11:
 - Read DPPLL_SRC register to determine continuous clock instead of
   using refclk handle (Stephen Boyd).

Changes in v12:
 - Explain in comment as in why dsi dev registration is done in
   bridge_attach (Andrzej Hajda).
 - Move HPD disable to bridge_pre_enable (Andrzej Hajda).
 - Make panel/DDC exclusive until HPD support is added (Andrzej Hajda).

Changes in v13:
 - eDP panels report EDID via DP-AUX channel, so remove support for
   dedicated DDC line (Andrzej Hajda).

Changes in v14:
 - Remove unnecessary drm_panel checks (Andrzej Hajda).

Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1532069642-21392-1-git-send-email-spanda@codeaurora.org
5 years agodt-bindings: drm/bridge: Document sn65dsi86 bridge bindings
Sandeep Panda [Mon, 16 Jul 2018 08:43:30 +0000 (14:13 +0530)]
dt-bindings: drm/bridge: Document sn65dsi86 bridge bindings

Document the bindings used for the sn65dsi86 DSI to eDP bridge.

Changes in v1:
 - Rephrase the dt-binding descriptions to be more inline with existing
   bindings (Andrzej Hajda).
 - Add missing dt-binding that are parsed by corresponding driver
   (Andrzej Hajda).

Changes in v2:
 - Remove edp panel specific dt-binding entries. Only keep bridge
   specific entries (Sean Paul).
 - Remove custom-modes dt entry since its usage is removed from driver also (Sean Paul).
 - Remove is-pluggable dt entry since this will not be needed anymore (Sean Paul).

Changes in v3:
 - Remove irq-gpio dt entry and instead populate is an interrupt
   property (Rob Herring).

Changes in v4:
 - Add link to bridge chip datasheet (Stephen Boyd)
 - Add vpll and vcc regulator supply bindings (Stephen Boyd)
 - Add ref clk optional dt binding (Stephen Boyd)
 - Add gpio-controller optional dt binding (Stephen Boyd)

Changes in v5:
 - Use clock property to specify the input refclk (Stephen Boyd).
 - Update gpio cell and pwm cell numbers (Stephen Boyd).

Changes in v6:
 - Add property to mention the lane mapping scheme and polarity inversion
   (Stephen Boyd).

Changes in v7:
 - Detail description of lane mapping scheme dt property (Andrzej
   Hajda/ Rob Herring).
 - Removed HDP gpio binding, since the bridge uses IRQ signal to
   determine HPD, and IRQ property is already documented in binding.

Changes in v8:
 - Removed unnecessary explanation of lane mapping and polarity dt
   property, since these are already explained in media/video-interface
   dt binidng (Rob Herring).

Changes in v9:
 - Avoid putting re-definition of lane mapping and polarity dt binding
   (Rob Herring).

Changes in v10:
 - Use interrupts-extended property instead of interrupts to specify
   interrupt line (Andrzej Hajda).
 - Move data-lanes and lane-polarity property example to proper place (Andrzej Hajda).

Changes in v11:
 - Add a property for suspend gpio function of GPIO1 pin on bridge chip
   (Stephen Boyd).

Changes in v12:
 - Remove binding for dedicated DDC line (Andrzej Hajda).

Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180716084330.26698-3-spanda@codeaurora.org
5 years agodt-bindings: mipi-dsi: Add dual-channel DSI related info
Archit Taneja [Mon, 9 Jul 2018 09:07:51 +0000 (14:37 +0530)]
dt-bindings: mipi-dsi: Add dual-channel DSI related info

Add binding info for peripherals that support dual-channel DSI. Add
corresponding optional bindings for DSI host controllers that may
be configured in this mode. Add an example of an I2C controlled
device operating in dual-channel DSI mode.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709090751.10221-3-architt@codeaurora.org
5 years agodt-bindings: mipi-dsi: Add info about peripherals with non-DSI control bus
Archit Taneja [Mon, 9 Jul 2018 09:07:50 +0000 (14:37 +0530)]
dt-bindings: mipi-dsi: Add info about peripherals with non-DSI control bus

Add a section that describes dt-bindings for peripherals that support
MIPI DSI, but have a different bus as the primary control bus, or no
control bus at all. Add an example for a peripheral with a non-DSI
control bus.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709090751.10221-2-architt@codeaurora.org
5 years agodrm/sun4i: tcon: Add support for R40 TCON
Jernej Skrabec [Tue, 10 Jul 2018 20:35:06 +0000 (22:35 +0200)]
drm/sun4i: tcon: Add support for R40 TCON

R40 TV TCON is basically the same as on A83T. However, it needs special
handling, because it has to set up TCON TOP muxes at runtime.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-14-jernej.skrabec@siol.net
5 years agodrm/sun4i: tcon: Add another way for matching mixers with tcon
Jernej Skrabec [Tue, 10 Jul 2018 20:35:05 +0000 (22:35 +0200)]
drm/sun4i: tcon: Add another way for matching mixers with tcon

Till now, new way of matching engines with TCONs was reading their
respective ids and match them by those ids. However, with introduction
of TCON TOP, that might not be so straightforward anymore.
- there might be more TCONs that engines (mixers)
- TCON ids might have non-consecutive ids

Workaround that by matching mixer id with TCON index from TCON list.

For example, R40 has 2 mixers and 4 TCONs. Board designer can choose
2 outputs, which are connected to any of those 4 TCONs. As long as there
are only 2 TCONs enabled in DT, using index in list as alternative id,
will allow to match them with mixer 0 and 1.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-13-jernej.skrabec@siol.net
5 years agodrm/sun4i: Use (struct drm_format_info) fields to determine if a format is yuv and...
Ayan Kumar Halder [Mon, 23 Jul 2018 08:57:00 +0000 (09:57 +0100)]
drm/sun4i: Use (struct drm_format_info) fields to determine if a format is yuv and multi planar or not.

We do not need sun4i_backend_format_is_packed_yuv422() /
sun4i_backend_format_is_planar_yuv() to determine if the format is yuv multi planar
or not. (struct drm_format_info *)->is_yuv tells if the format is yuv or not.
And (struct drm_format_info *)->num_planes denotes the number of planes.

This issue was identified during a review on a previous patch:-
https://lists.freedesktop.org/archives/dri-devel/2018-July/183840.html

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1532336220-3791-1-git-send-email-ayan.halder@arm.com
5 years agodrm/rockchip: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 11:09:27 +0000 (13:09 +0200)]
drm/rockchip: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717110927.30776-1-tzimmermann@suse.de
5 years agodrm: Replace NULL with error value in drm_prime_pages_to_sg
Oleksandr Andrushchenko [Thu, 19 Jul 2018 09:37:13 +0000 (12:37 +0300)]
drm: Replace NULL with error value in drm_prime_pages_to_sg

Dan Carpenter has reported that there is the following static checker
warning:
drivers/gpu/drm/drm_prime.c:317 drm_gem_map_dma_buf()
warn: 'sgt' can also be NULL

314 sgt = obj->dev->driver->gem_prime_get_sg_table(obj);
315
316 if (!IS_ERR(sgt)) {
317 if (!dma_map_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir,

Problematic functions are xen_drm_front_gem_get_sg_table and
drm_gem_cma_prime_get_sg_table. Fix those by replacing NULL with error value.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180719093713.3643-1-andr2000@gmail.com
6 years agodrm/print: Fix DRM_DEBUG_DP macro
Lyude Paul [Wed, 18 Jul 2018 21:57:16 +0000 (17:57 -0400)]
drm/print: Fix DRM_DEBUG_DP macro

This isn't supposed to take dev as an argument, I guess no one noticed!

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180718215716.5784-1-lyude@redhat.com
6 years agodrm/sun4i: sun4i: Introduce a quirk for lowest plane alpha support
Paul Kocialkowski [Thu, 19 Jul 2018 08:08:38 +0000 (10:08 +0200)]
drm/sun4i: sun4i: Introduce a quirk for lowest plane alpha support

Not all sunxi platforms with the first version of the Display Engine
support an alpha component on the plane with the lowest z position
(as in: lowest z-pos), that gets blended with the background color.

In particular, the A13 is known to have this limitation. However, it was
recently discovered that the A20 and A33 are capable of having alpha on
their lowest plane.

Thus, this introduces a specific quirk to indicate such support,
per-platform. Since this was not tested on sun4i and sun6i platforms, a
conservative approach is kept and this feature is not supported.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180719080838.31598-2-paul.kocialkowski@bootlin.com
6 years agodrm/sun4i: sun4i: Register quirks with the backend structure
Paul Kocialkowski [Thu, 19 Jul 2018 08:08:37 +0000 (10:08 +0200)]
drm/sun4i: sun4i: Register quirks with the backend structure

In prevision for introducing a new quirk that will be used at atomic
plane check time, register the quirks structure with the backend
structure. This way, it can easily be grabbed where needed.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180719080838.31598-1-paul.kocialkowski@bootlin.com
6 years agodrm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE checking if panel is used.
Giulio Benetti [Wed, 18 Jul 2018 14:23:57 +0000 (16:23 +0200)]
drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE checking if panel is used.

Handle both positive and negative dclk polarity,
according to bus_flags, taking care of this:

On A20 and similar SoCs, the only way to achieve Positive Edge
(Rising Edge), is setting dclk clock phase to 2/3(240°).
By default TCON works in Negative Edge(Falling Edge), this is why phase
is set to 0 in that case.
Unfortunately there's no way to logically invert dclk through IO_POL
register.
The only acceptable way to work, triple checked with scope,
is using clock phase set to 0° for Negative Edge and set to 240° for
Positive Edge.
On A33 and similar SoCs there would be a 90° phase option, but it divides
also dclk by 2.
This patch is a way to avoid quirks all around TCON and DOTCLOCK drivers
for using A33 90° phase divided by 2 and consequently increase code
complexity.

Check if panel is used. TCON can also handle VGA DAC, then panel could
be empty.

Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180718142357.120998-1-giulio.benetti@micronovasrl.com
6 years agodrm/sun4i: Substitute sun4i_backend_format_is_yuv() with format->is_yuv
Ayan Kumar Halder [Tue, 17 Jul 2018 17:13:46 +0000 (18:13 +0100)]
drm/sun4i: Substitute sun4i_backend_format_is_yuv() with format->is_yuv

drm_format_info table has a field 'is_yuv' to denote if the format
is yuv or not. The driver is expected to use this instead of
having a function for the same purpose.

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1531847626-22248-5-git-send-email-ayan.halder@arm.com
6 years agodrm/rockchip: Substitute is_yuv_support() with format->is_yuv
Ayan Kumar Halder [Tue, 17 Jul 2018 17:13:44 +0000 (18:13 +0100)]
drm/rockchip: Substitute is_yuv_support() with format->is_yuv

drm_format_info table has a field 'is_yuv' to denote if the format
is yuv or not. The driver is expected to use this instead of
having a function for the same purpose.

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1531847626-22248-3-git-send-email-ayan.halder@arm.com
6 years agodrm/i915: Substitute intel_format_is_yuv() with format->is_yuv
Ayan Kumar Halder [Tue, 17 Jul 2018 17:13:43 +0000 (18:13 +0100)]
drm/i915: Substitute intel_format_is_yuv() with format->is_yuv

drm_format_info table has a field 'is_yuv' to denote if the format
is yuv or not. The driver is expected to use this instead of
having a function for the same purpose.

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1531847626-22248-2-git-send-email-ayan.halder@arm.com
6 years agodrm/fourcc: Add is_yuv field to drm_format_info to denote if the format is yuv
Ayan Kumar Halder [Tue, 17 Jul 2018 17:13:42 +0000 (18:13 +0100)]
drm/fourcc: Add is_yuv field to drm_format_info to denote if the format is yuv

A lot of drivers duplicate the function to check if a format is yuv or not.
If we add a field (to denote whether the format is yuv or not) in the
drm_format_info table, all the drivers can use this field and it will
prevent duplication of similar logic.

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1531847626-22248-1-git-send-email-ayan.halder@arm.com
6 years agodrm/pl111: Use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Wed, 4 Jul 2018 14:22:55 +0000 (09:22 -0500)]
drm/pl111: Use 64-bit arithmetic instead of 32-bit

Add suffix ULL to constant 1000 in order to give the compiler complete
information about the proper arithmetic to use.

Notice that such constant is used in a context that expects an
expression of type u64 (64 bits, unsigned) and the following
expression is currently being evaluated using 32-bit arithmetic:

mode->clock * 1000

Addresses-Coverity-ID: 1466139 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704142255.GA8614@embeddedor.com
6 years agodrm/pl111: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 08:36:57 +0000 (10:36 +0200)]
drm/pl111: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717083657.16262-1-tzimmermann@suse.de
6 years agodrm/vc4: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 08:54:28 +0000 (10:54 +0200)]
drm/vc4: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717085428.18500-1-tzimmermann@suse.de
6 years agodrm/sun4i: sun8i: Avoid clearing blending order at each atomic commit
Paul Kocialkowski [Tue, 17 Jul 2018 12:25:22 +0000 (14:25 +0200)]
drm/sun4i: sun8i: Avoid clearing blending order at each atomic commit

Blending order is set based on the z position of each DRM plane. The
blending order register is currently cleared at each atomic DRM commit,
with the intent that each committed plane will set the appropriate
bits (based on its z-pos) when enabling the plane.

However, it sometimes happens that a particular plane is left unchanged
by an atomic commit and thus will not be configured again. In that
scenario, blending order is cleared and only the bits relevant for the
planes affected by the commit are set. This leaves the planes that did
not change without their blending order set in the register, leading
to that plane not being displayed.

Instead of clearing the blending order register at every atomic commit,
this change moves the register's initial clear at bind time and only
clears the bits for a specific plane when disabling it or changing its
zpos.

This way, planes that are left untouched by a DRM atomic commit are
no longer disabled.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717122522.11327-1-paul.kocialkowski@bootlin.com
6 years agodrm/sun4i: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 08:48:14 +0000 (10:48 +0200)]
drm/sun4i: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717084814.18091-1-tzimmermann@suse.de
6 years agodrm/connector: Fix typo in drm_connector_list_iter_next()
Lyude Paul [Mon, 16 Jul 2018 17:17:11 +0000 (13:17 -0400)]
drm/connector: Fix typo in drm_connector_list_iter_next()

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180716171711.413-1-lyude@redhat.com
6 years agodrm/dp_helper: Add DP aux channel tracing
Lyude Paul [Mon, 16 Jul 2018 15:44:32 +0000 (11:44 -0400)]
drm/dp_helper: Add DP aux channel tracing

This is something we've needed for a very long time now, as it makes
debugging issues with faulty MST hubs along with debugging issues
regarding us interfacing with hubs correctly vastly easier to debug.
Currently this can actually be done if you trace the i2c devices for DP
using ftrace but that's significantly less useful for a couple of
reasons:

- Tracing the i2c devices through ftrace means all of the traces are
  going to contain a lot of "garbage" output that we're sending over the
  i2c line. Most of this garbage comes from retrying transactions, DRM's
  helper library adding extra transactions to work around bad hubs, etc.
- Having a user set up ftrace so that they can provide debugging
  information is a lot more difficult then being able to say "just boot
  with drm.debug=0x100"
- We can potentially expand upon this tracing in the future to print
  debugging information in regards to other DP transactions like MST
  sideband transactions

This is inspired by a patch Rob Clark sent to do this a long time back.
Neither of us could find the patch however, so we both assumed it would
probably just be easier to rewrite it anyway.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180716154432.13433-1-lyude@redhat.com
6 years agodrm: writeback: Fix doc that says connector should be disconnected
Alexandru Gheorghe [Fri, 13 Jul 2018 15:10:58 +0000 (16:10 +0100)]
drm: writeback: Fix doc that says connector should be disconnected

During iteration process one of the proposed mechanism for not
breaking existing userspace was to report writeback connectors as
disconnected, however the final version used
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS for that purpose.

Change-Id: I2319d099f7669094c8530f1521abdbca08e76486
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/238399/
6 years agodma-buf: Move BUG_ON from _add_shared_fence to _add_shared_inplace
Michel Dänzer [Wed, 4 Jul 2018 15:14:05 +0000 (17:14 +0200)]
dma-buf: Move BUG_ON from _add_shared_fence to _add_shared_inplace

Fixes the BUG_ON spuriously triggering under the following
circumstances:

* reservation_object_reserve_shared is called with shared_count ==
  shared_max - 1, so obj->staged is freed in preparation of an in-place
  update.

* reservation_object_add_shared_fence is called with the first fence,
  after which shared_count == shared_max.

* reservation_object_add_shared_fence is called with a follow-up fence
  from the same context.

In the second reservation_object_add_shared_fence call, the BUG_ON
triggers. However, nothing bad would happen in
reservation_object_add_shared_inplace, since both fences are from the
same context, so they only occupy a single slot.

Prevent this by moving the BUG_ON to where an overflow would actually
happen (e.g. if a buggy caller didn't call
reservation_object_reserve_shared before).

v2:
* Fix description of breaking scenario (Christian König)
* Add bugzilla reference

Cc: stable@vger.kernel.org
Bugzilla: https://bugs.freedesktop.org/106418
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v1
Reviewed-by: Christian König <christian.koenig@amd.com> # v1
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704151405.10357-1-michel@daenzer.net
6 years agodrm/meson: Make DMT timings parameters and pixel clock generic
Neil Armstrong [Mon, 16 Jul 2018 07:40:14 +0000 (09:40 +0200)]
drm/meson: Make DMT timings parameters and pixel clock generic

Remove the modes timings tables for DMT modes and calculate the HW
paremeters from the modes timings.

Switch the DMT modes pixel clock calculation out of the static frequency
list to a generic calculation from a range of possible PLL dividers.

This patch is an intermediate step towards usage of the Common Clock
Framwework for PLL setup, by reworking the code to have common
sel_pll() function called by the CEA (HDMI) freq setup and the generic
DMT frequencies setup, we should be able to simply call clk_set_rate()
on the PLL clock handle in a near future.

The CEA (HDMI) and CVBS modes needs very specific clock paths that CCF will
never be able to determine by itself, so there is still some work to do for
a full handoff to CCF handling the clocks.

This setup permits setting non-CEA modes like :
- 1600x900-60Hz
- 1280x1024-75Hz
- 1280x1024-60Hz
- 1440x900-60Hz
- 1366x768-60Hz
- 1280x800-60Hz
- 1152x864-75Hz
- 1024x768-75Hz
- 1024x768-70Hz
- 1024x768-60Hz
- 832x624-75Hz
- 800x600-75Hz
- 800x600-72Hz
- 800x600-60Hz
- 640x480-75Hz
- 640x480-73Hz
- 640x480-67Hz

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Jerome Brunet <jbrunet@baylibre.com>
[narmstrong: fixed trivial checkpatch issues]
Link: https://patchwork.freedesktop.org/patch/msgid/1531726814-14638-1-git-send-email-narmstrong@baylibre.com
6 years agodrm/doc: use inline kerneldoc style for drm_crtc_state
Daniel Vetter [Mon, 9 Jul 2018 08:40:15 +0000 (10:40 +0200)]
drm/doc: use inline kerneldoc style for drm_crtc_state

Lots of added text here since I think the various control flow bits
are worth explaining a bit better.

v2: Fix conflict with Boris' no_vblank addition.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-15-daniel.vetter@ffwll.ch
6 years agodrm/doc: Include drm_of.c helpers
Daniel Vetter [Mon, 9 Jul 2018 08:40:14 +0000 (10:40 +0200)]
drm/doc: Include drm_of.c helpers

Fixes a dead link I spotted in the struct drm_crtc docs. Comments
themselves are in a surprisingly good state.

v2: Fix subject typo (Sean).

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-14-daniel.vetter@ffwll.ch
6 years agodrm/doc: Group the fb gem helpers better
Daniel Vetter [Mon, 9 Jul 2018 08:40:13 +0000 (10:40 +0200)]
drm/doc: Group the fb gem helpers better

Instead of spreading them all over the place.

Cc: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-13-daniel.vetter@ffwll.ch
6 years agodrm/doc: move struct drm_crtc to in-line comments
Daniel Vetter [Mon, 9 Jul 2018 08:40:12 +0000 (10:40 +0200)]
drm/doc: move struct drm_crtc to in-line comments

And clean them up a bit, as usual.

v2: Fix nits (Sean).

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-12-daniel.vetter@ffwll.ch