linux-2.6-microblaze.git
3 years agodrm/ttm: add caching state to ttm_bus_placement
Christian König [Wed, 30 Sep 2020 09:17:44 +0000 (11:17 +0200)]
drm/ttm: add caching state to ttm_bus_placement

And implement setting it up correctly in the drivers.

This allows getting rid of the placement flags for this.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394254/
3 years agodrm/ttm: set the tt caching state at creation time
Christian König [Wed, 30 Sep 2020 08:38:48 +0000 (10:38 +0200)]
drm/ttm: set the tt caching state at creation time

All drivers can determine the tt caching state at creation time,
no need to do this on the fly during every validation.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394253/
3 years agodrm: panel: Add novatek nt36672a panel driver
Sumit Semwal [Wed, 2 Sep 2020 06:44:07 +0000 (12:14 +0530)]
drm: panel: Add novatek nt36672a panel driver

Novatek NT36672a is a generic DSI IC that drives command and video mode
panels. Add the driver for it.

Right now adding support for some Poco F1 phones that have an LCD panel
from Tianma connected with this IC, with a resolution of 1080x2246 that
operates in DSI video mode.

During testing, Benni Steini <bennisteinir@gmail.com> helped us fix
the reset sequence timing (from 10ms to 20ms), to get the bootanimation
to work on Android.

With current AOSP, we need to increase it to 200ms - this seems to be a
safe high value to avoid a white screen occasionally.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benni Steini <bennisteinir@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200902064407.30712-3-sumit.semwal@linaro.org
3 years agodt-bindings: display: panel: Add bindings for Novatek nt36672a
Sumit Semwal [Wed, 2 Sep 2020 06:44:06 +0000 (12:14 +0530)]
dt-bindings: display: panel: Add bindings for Novatek nt36672a

Novatek nt36672a is a display driver IC that can drive DSI panel. It
is also present in the Tianma video mode panel, which is a FHD+ panel
with a resolution of 1080x2246 and 6.18 inches size. It is found in
some of the Poco F1 phones.

This patch adds the display driver for the IC, with support added for
this tianma fhd video mode panel.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200902064407.30712-2-sumit.semwal@linaro.org
3 years agodrm/virtio: Use UUID API for importing the UUID
Andy Shevchenko [Tue, 13 Oct 2020 13:27:14 +0000 (16:27 +0300)]
drm/virtio: Use UUID API for importing the UUID

There is import_uuid() function which imports u8 array to the uuid_t.
Use it instead of open coding variant.

This allows to hide the uuid_t internals.

Reviewed-by: David Stevens <stevensd@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201013132714.70973-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm: shmobile: Reduce include dependencies
Andy Shevchenko [Wed, 22 Apr 2020 12:51:55 +0000 (15:51 +0300)]
drm: shmobile: Reduce include dependencies

This file doesn't need anything provided by <linux/kernel.h>.
All it needs are some types, which are provided by <drm/drm_mode.h>.

Drop unneeded <linux/kernel.h> completely.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200422125201.37618-1-andriy.shevchenko@linux.intel.com
3 years agoMAINTAINERS: Add myself as a maintainer for vc4
Maxime Ripard [Fri, 9 Oct 2020 07:49:52 +0000 (09:49 +0200)]
MAINTAINERS: Add myself as a maintainer for vc4

Eric isn't working on vc4 anymore and I've been working on it, as well as
merging patches for it, recently so let's make it official so I don't miss
patches.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20201009074952.11345-1-maxime@cerno.tech
3 years agodrm/aspeed: Fix Kconfig warning & subsequent build errors
Randy Dunlap [Sun, 11 Oct 2020 23:01:31 +0000 (16:01 -0700)]
drm/aspeed: Fix Kconfig warning & subsequent build errors

Kernel test robot reported build errors (undefined references)
that didn't make much sense. After reproducing them, there is also
a Kconfig warning that is the root cause of the build errors, so
fix that Kconfig problem.

Fixes this Kconfig warning:
WARNING: unmet direct dependencies detected for CMA
  Depends on [n]: MMU [=n]
  Selected by [m]:
  - DRM_ASPEED_GFX [=m] && HAS_IOMEM [=y] && DRM [=m] && OF [=y] && (COMPILE_TEST [=y] || ARCH_ASPEED) && HAVE_DMA_CONTIGUOUS [=y]

and these dependent build errors:
(.text+0x10c8c): undefined reference to `start_isolate_page_range'
microblaze-linux-ld: (.text+0x10f14): undefined reference to `test_pages_isolated'
microblaze-linux-ld: (.text+0x10fd0): undefined reference to `undo_isolate_page_range'

Fixes: 76356a966e33 ("drm: aspeed: Clean up Kconfig options")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: linux-mm@kvack.org
Cc: linux-aspeed@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20201011230131.4922-1-rdunlap@infradead.org
Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agodrm/tilcdc: Remove tilcdc_crtc_max_width(), use private data
Jyri Sarha [Sat, 10 Oct 2020 17:00:59 +0000 (20:00 +0300)]
drm/tilcdc: Remove tilcdc_crtc_max_width(), use private data

We already have a private data member for maximum display width so
let's use it and get rid of the redundant tilcdc_crtc_max_width().

The LCDC version probing is moved to before reading the device tree
properties so that the version information is available when private
data maximum width is initialized, if "max-width" property is not
found.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/73683d2ce151cffb811a756595b02892eeac3d84.1602349100.git.jsarha@ti.com
3 years agodrm/tilcdc: Do not keep vblank interrupts enabled all the time
Jyri Sarha [Sat, 10 Oct 2020 17:00:58 +0000 (20:00 +0300)]
drm/tilcdc: Do not keep vblank interrupts enabled all the time

END_OF_FRAME interrupts have been enabled all the time since the
beginning of this driver. It is about time to add this feature.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/fb87adebaffe8c7cb4fe7e909a45d47af08d7c6e.1602349100.git.jsarha@ti.com
3 years agodrm/fourcc: document modifier uniqueness requirements
Simon Ser [Wed, 24 Jun 2020 13:01:31 +0000 (13:01 +0000)]
drm/fourcc: document modifier uniqueness requirements

There have suggestions to bake pitch alignment, address alignment,
contiguous memory or other placement (hidden VRAM, GTT/BAR, etc)
constraints into modifiers. Last time this was brought up it seemed
like the consensus was to not allow this. Document this in drm_fourcc.h.

There are several reasons for this.

- Encoding all of these constraints in the modifiers would explode the
  search space pretty quickly (we only have 64 bits to work with).
- Modifiers need to be unambiguous: a buffer can only have a single
  modifier.
- Modifier users aren't expected to parse modifiers (except drivers).

v2: add paragraph about aliases (Daniel)

v3: fix unrelated changes sent with the patch

v4: disambiguate users between driver and higher-level programs (Brian,
Daniel)

v5: fix AFBC example (Brian, Daniel)

v6: remove duplicated paragraph (Daniel)

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: Dave Airlie <airlied@gmail.com>
Cc: Marek Olšák <maraeo@gmail.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Michel Dänzer <michel@daenzer.net>
Link: https://patchwork.freedesktop.org/patch/msgid/MGwgeXojKNdNXjCxuMhRlwcJM4vdYph_WJcMeGPPGMcRKtHV41XAXlh2tCc-pPJZCAhS3gwbWMWTd8f03NBA2ZYKfr0QxLhcPivpopr5c6M=@emersion.fr
3 years agodrm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 22 May 2020 13:52:29 +0000 (15:52 +0200)]
drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20200603083132.4610-5-tzimmermann@suse.de
3 years agodrm/atomic: Pass the full state to CRTC atomic enable/disable
Maxime Ripard [Thu, 8 Oct 2020 12:44:08 +0000 (14:44 +0200)]
drm/atomic: Pass the full state to CRTC atomic enable/disable

If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.

In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.

virtual report

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
 {
  <...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
  ...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
 {
  <...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
  ...>
 }

@@
identifier crtc, old_state;
@@

 struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)

@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}

@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@

void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@

void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@

void func(struct drm_crtc *crtc,
-        struct drm_crtc_state *old_state
+        struct drm_atomic_state *state
       )
{ ... }

@ include depends on adds_old_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_old_state @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
3 years agodrm: aspeed: Fix GENMASK misuse
Ondrej Jirman [Sat, 22 Feb 2020 23:51:52 +0000 (00:51 +0100)]
drm: aspeed: Fix GENMASK misuse

Arguments to GENMASK should be msb >= lsb.

Signed-off-by: Ondrej Jirman <megous@megous.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20200222235152.242816-1-megous@megous.com
3 years agodrm/aspeed: Add sysfs for output settings
Joel Stanley [Wed, 16 Sep 2020 08:34:13 +0000 (18:04 +0930)]
drm/aspeed: Add sysfs for output settings

These settings are used by an ASPEED BMC to determine when the host is
trying to drive the display over PCIe (vga_pw) and to switch the
output between PCIe and the internal graphics device (dac_mux).

The valid values for the dac mux are:

 00: VGA mode (default, aka PCIe)
 01: Graphics CRT (aka BMC internal graphics, this driver)
 10: Pass through mode from video input port A
 11: Pass through mode from video input port B

Values for the read-only vga password register are:

 1: Host driving the display
 0: Host not driving the display

Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916083413.777307-1-joel@jms.id.au
3 years agodma-buf: use struct_size macro
Christian König [Thu, 8 Oct 2020 08:03:22 +0000 (10:03 +0200)]
dma-buf: use struct_size macro

Instead of manually calculating the structure size.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/394252/
3 years agodrm/panfrost: Fix job timeout handling
Boris Brezillon [Fri, 2 Oct 2020 12:25:06 +0000 (14:25 +0200)]
drm/panfrost: Fix job timeout handling

If more than two jobs end up timeout-ing concurrently, only one of them
(the one attached to the scheduler acquiring the lock) is fully handled.
The other one remains in a dangling state where it's no longer part of
the scheduling queue, but still blocks something in scheduler, leading
to repetitive timeouts when new jobs are queued.

Let's make sure all bad jobs are properly handled by the thread
acquiring the lock.

v3:
- Add Steven's R-b
- Don't take the sched_lock when stopping the schedulers

v2:
- Fix the subject prefix
- Stop the scheduler before returning from panfrost_job_timedout()
- Call cancel_delayed_work_sync() after drm_sched_stop() to make sure
  no timeout handlers are in flight when we reset the GPU (Steven Price)
- Make sure we release the reset lock before restarting the
  schedulers (Steven Price)

Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201002122506.1374183-1-boris.brezillon@collabora.com
3 years agodrm/atomic: debug output for EBUSY
Daniel Vetter [Fri, 25 Sep 2020 08:46:51 +0000 (10:46 +0200)]
drm/atomic: debug output for EBUSY

Hopefully we'll have the drm crash recorder RSN, but meanwhile
compositors would like to know a bit better why they get an EBUSY.

v2: Move misplaced hunk to the right patch (Pekka)

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Simon Ser <contact@emersion.fr>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925084651.3250104-2-daniel.vetter@ffwll.ch
3 years agodrm/atomic: document and enforce rules around "spurious" EBUSY
Daniel Vetter [Fri, 25 Sep 2020 08:46:50 +0000 (10:46 +0200)]
drm/atomic: document and enforce rules around "spurious" EBUSY

When doing an atomic modeset with ALLOW_MODESET drivers are allowed to
pull in arbitrary other resources, including CRTCs (e.g. when
reconfiguring global resources).

But in nonblocking mode userspace has then no idea this happened,
which can lead to spurious EBUSY calls, both:
- when that other CRTC is currently busy doing a page_flip the
  ALLOW_MODESET commit can fail with an EBUSY
- on the other CRTC a normal atomic flip can fail with EBUSY because
  of the additional commit inserted by the kernel without userspace's
  knowledge

For blocking commits this isn't a problem, because everyone else will
just block until all the CRTC are reconfigured. Only thing userspace
can notice is the dropped frames without any reason for why frames got
dropped.

Consensus is that we need new uapi to handle this properly, but no one
has any idea what exactly the new uapi should look like. Since this
has been shipping for years already compositors need to deal no matter
what, so as a first step just try to enforce this across drivers
better with some checks.

v2: Add comments and a WARN_ON to enforce this only when allowed - we
don't want to silently convert page flips into blocking plane updates
just because the driver is buggy.

v3: Fix inverted WARN_ON (Pekka).

v4: Drop the uapi changes, only add a WARN_ON for now to enforce some
rules for drivers.

v5: Make the WARNING more informative (Daniel)

v6: Add unconditional debug output for compositor hackers to figure
out what's going on when they get an EBUSY (Daniel)

v7: Fix up old/new_crtc_state confusion for real (Pekka/Ville)

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
References: https://lists.freedesktop.org/archives/dri-devel/2018-July/182281.html
Bugzilla: https://gitlab.freedesktop.org/wayland/weston/issues/24#note_9568
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Simon Ser <contact@emersion.fr>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925084651.3250104-1-daniel.vetter@ffwll.ch
3 years agodrm/fb-helper: Add locking to sysrq handling
Daniel Vetter [Wed, 7 Oct 2020 13:30:35 +0000 (15:30 +0200)]
drm/fb-helper: Add locking to sysrq handling

We didn't take the kernel_fb_helper_lock mutex, which protects that
code. While at it, simplify the code
- inline the function (originally shared with kgdb I think)
- drop the error tracking and all the complications
- drop the pointless early out, it served nothing

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201007133036.1541639-1-daniel.vetter@ffwll.ch
3 years agodrm/vkms: update todo
Melissa Wen [Tue, 6 Oct 2020 22:30:06 +0000 (19:30 -0300)]
drm/vkms: update todo

Drop issues already resolved in vkms:

- CRC API Improvements to [1] add igt test to check extreme alpha values
  and [2] alpha blending;
- [3] prime buffer sharing;
- [4] writeback support;

On the other hand, we also found or thought about other improvements since
the last update of this document:

- better support for IGT tests
- improvements to writeback support
- syzbot report

Finally, we reorder items by the assumed complexity.

[1] https://patchwork.freedesktop.org/series/55944/
[2] https://patchwork.freedesktop.org/series/80823/
[3] https://patchwork.freedesktop.org/series/63212/
[4] https://patchwork.freedesktop.org/series/81177/

v2:
- Link to syzbot dashboard

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006223006.gu55pjtuaigkh6il@smtp.gmail.com
3 years agodrm/ttm: move ttm_set_memory.h out of include
Christian König [Tue, 29 Sep 2020 15:39:57 +0000 (17:39 +0200)]
drm/ttm: move ttm_set_memory.h out of include

This is not something drivers should use.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/393430/
3 years agodrm/ttm: remove ttm_bo_unmap_virtual_locked declaration v2
Christian König [Wed, 7 Oct 2020 08:51:29 +0000 (10:51 +0200)]
drm/ttm: remove ttm_bo_unmap_virtual_locked declaration v2

That was missed during the cleanup.

v2: fix comment in vmwgfx as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394092/
3 years agodrm/vmwgfx: move ttm_bo_swapout_all into vmwgfx
Christian König [Thu, 1 Oct 2020 14:22:42 +0000 (16:22 +0200)]
drm/vmwgfx: move ttm_bo_swapout_all into vmwgfx

It is the sole user of this.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/393498/
3 years agodrm/ttm: drop glob parameter from ttm_bo_swapout
Christian König [Thu, 1 Oct 2020 14:17:55 +0000 (16:17 +0200)]
drm/ttm: drop glob parameter from ttm_bo_swapout

We can always access the global state.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/393499/
3 years agodrm/ttm: nuke ttm_bo_evict_mm and rename mgr function v3
Christian König [Thu, 1 Oct 2020 13:21:00 +0000 (15:21 +0200)]
drm/ttm: nuke ttm_bo_evict_mm and rename mgr function v3

Make it more clear what the resource manager function
does and nuke the wrapper function.

v2: nuke the wrapper
v3: fix typo in radeon, rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2)
Link: https://patchwork.freedesktop.org/patch/393914/
3 years agodrm/ttm: cleanup ttm_handle_caching_state_failure
Christian König [Tue, 29 Sep 2020 15:32:35 +0000 (17:32 +0200)]
drm/ttm: cleanup ttm_handle_caching_state_failure

Remove unused parameters, shorten the function name.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/393431/
3 years agodrm/ttm: remove TTM_PAGE_FLAG_WRITE
Christian König [Tue, 29 Sep 2020 15:33:17 +0000 (17:33 +0200)]
drm/ttm: remove TTM_PAGE_FLAG_WRITE

Not used any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/393429/
3 years agodrm/ttm: make move callback compulstory
Dave Airlie [Tue, 6 Oct 2020 00:06:44 +0000 (10:06 +1000)]
drm/ttm: make move callback compulstory

All drivers should have a move callback now so make it compulsory.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-6-airlied@gmail.com
3 years agodrm/vram_helper: implement a ttm move callback.
Dave Airlie [Tue, 6 Oct 2020 00:06:43 +0000 (10:06 +1000)]
drm/vram_helper: implement a ttm move callback.

This will always do memcpy moves.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-5-airlied@gmail.com
3 years agodrm/vmwgfx: add a move callback.
Dave Airlie [Tue, 6 Oct 2020 00:06:42 +0000 (10:06 +1000)]
drm/vmwgfx: add a move callback.

This just copies the fallback to vmwgfx, I'm going to iterate on this
a bit until it's not the same as the fallback path.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-4-airlied@gmail.com
3 years agodrm/vmwgfx: move null mem checks outside move notifies
Dave Airlie [Tue, 6 Oct 2020 00:06:41 +0000 (10:06 +1000)]
drm/vmwgfx: move null mem checks outside move notifies

Both fns checked mem == NULL, just move the check outside.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-3-airlied@gmail.com
3 years agodrm/qxl: drop unused code (v2)
Dave Airlie [Tue, 6 Oct 2020 00:06:40 +0000 (10:06 +1000)]
drm/qxl: drop unused code (v2)

v2: drop the wrapper struct
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-2-airlied@gmail.com
3 years agodrm/nouveau/ttm: memcpy waits for bo already
Dave Airlie [Thu, 24 Sep 2020 05:18:28 +0000 (15:18 +1000)]
drm/nouveau/ttm: memcpy waits for bo already

no need for driver to wait here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200924051845.397177-29-airlied@gmail.com
3 years agodrm/nouveau/ttm: handle ttm moves properly.
Dave Airlie [Thu, 24 Sep 2020 05:18:05 +0000 (15:18 +1000)]
drm/nouveau/ttm: handle ttm moves properly.

The idea is to flip the core over to calling the driver always,
so add support for moves here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200924051845.397177-6-airlied@gmail.com
3 years agodrm/bridge: tc358764: restore connector support
Marek Szyprowski [Wed, 30 Sep 2020 11:40:42 +0000 (13:40 +0200)]
drm/bridge: tc358764: restore connector support

This patch restores DRM connector registration in the TC358764 bridge
driver and restores usage of the old drm_panel_* API, thus allows dynamic
panel registration. This fixes panel operation on Exynos5250-based
Arndale board.

This is equivalent to the revert of the following commits:
1644127f83bc "drm/bridge: tc358764: add drm_panel_bridge support"
385ca38da29c "drm/bridge: tc358764: drop drm_connector_(un)register"
and removal of the calls to drm_panel_attach()/drm_panel_detach(), which
were no-ops and has been removed in meanwhile.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200930114042.5806-1-m.szyprowski@samsung.com
3 years agodrm: bridge: dw-hdmi: Constify dw_hdmi_i2s_ops
Rikard Falkeborn [Sun, 4 Oct 2020 20:06:53 +0000 (22:06 +0200)]
drm: bridge: dw-hdmi: Constify dw_hdmi_i2s_ops

The only usage of dw_hdmi_i2s_ops is to assign its address to the ops
field in the hdmi_codec_pdata struct, which is a const pointer. Make it
const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201004200653.14702-1-rikard.falkeborn@gmail.com
3 years agodrm/gma500: fix double free of gma_connector
Tom Rix [Sat, 3 Oct 2020 19:39:28 +0000 (12:39 -0700)]
drm/gma500: fix double free of gma_connector

clang static analysis reports this problem:

cdv_intel_dp.c:2101:2: warning: Attempt to free released memory
        kfree(gma_connector);
        ^~~~~~~~~~~~~~~~~~~~

In cdv_intel_dp_init() when the call to cdv_intel_edp_panel_vdd_off()
fails, the handler calls cdv_intel_dp_destroy(connector) which does
the first free of gma_connector. So adjust the goto label and skip
the second free.

Fixes: d112a8163f83 ("gma500/cdv: Add eDP support")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201003193928.18869-1-trix@redhat.com
3 years agodrm/sched: Avoid infinite waits in the drm_sched_entity_destroy() path
Boris Brezillon [Fri, 2 Oct 2020 06:55:18 +0000 (08:55 +0200)]
drm/sched: Avoid infinite waits in the drm_sched_entity_destroy() path

If we don't initialize the entity to idle and the entity is never
scheduled before being destroyed we end up with an infinite wait in the
destroy path.

v2:
- Add Steven's R-b

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/393486/
3 years agodrm/tidss: Add prepare_fb to the plane helper funcs
Gowtham Tammana [Wed, 26 Aug 2020 13:44:09 +0000 (16:44 +0300)]
drm/tidss: Add prepare_fb to the plane helper funcs

drm_gem_fb_prepare_fb() extracts fence and attaches to plane state.
The fence info is needed if implicit fencing is used. Add this as
prepare_fb function pointer to plane helper funcs.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200826134409.473554-1-tomi.valkeinen@ti.com
3 years agodt-bindings: display: ti,j721e-dss: add missing properties to dt-schema
Tomi Valkeinen [Wed, 16 Sep 2020 13:10:09 +0000 (16:10 +0300)]
dt-bindings: display: ti,j721e-dss: add missing properties to dt-schema

Add assigned-clocks, assigned-clock-parents and dma-coherent optional
properties.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916131009.221252-3-tomi.valkeinen@ti.com
3 years agodt-bindings: display: ti,am65x-dss: add missing properties to dt-schema
Tomi Valkeinen [Wed, 16 Sep 2020 13:10:08 +0000 (16:10 +0300)]
dt-bindings: display: ti,am65x-dss: add missing properties to dt-schema

Add assigned-clocks, assigned-clock-parents and dma-coherent optional
properties.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916131009.221252-2-tomi.valkeinen@ti.com
3 years agoRevert "gpu/drm: ingenic: Add option to mmap GEM buffers cached"
Paul Cercueil [Sun, 4 Oct 2020 14:17:58 +0000 (16:17 +0200)]
Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached"

This reverts commit 37054fc81443 ("gpu/drm: ingenic: Add option to mmap
GEM buffers cached")

At the very moment this commit was created, the DMA API it relied on was
modified in the DMA tree, which caused the driver to break in
linux-next.

Revert it for now, and it will be resubmitted later to work with the new
DMA API.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201004141758.1013317-1-paul@crapouillou.net
3 years agodrm/atomic: Make the kerneldoc a bit clearer
Daniel Vetter [Fri, 2 Oct 2020 07:56:20 +0000 (09:56 +0200)]
drm/atomic: Make the kerneldoc a bit clearer

Crank up the warning a notch and point at the right set of locking
functions for atomic drivers.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201002075620.4157591-1-daniel.vetter@ffwll.ch
3 years agodrm/panfrost: simplify the return expression of panfrost_devfreq_target()
Qinglang Miao [Mon, 21 Sep 2020 13:10:21 +0000 (21:10 +0800)]
drm/panfrost: simplify the return expression of panfrost_devfreq_target()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921131021.91604-1-miaoqinglang@huawei.com
3 years agodrm/panfrost: simplify the return expression of cz_ih_hw_init()
Qinglang Miao [Mon, 21 Sep 2020 13:10:19 +0000 (21:10 +0800)]
drm/panfrost: simplify the return expression of cz_ih_hw_init()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921131019.91558-1-miaoqinglang@huawei.com
3 years agoMAINTAINERS: mark FRAMEBUFFER LAYER as Orphan
Bartlomiej Zolnierkiewicz [Thu, 24 Sep 2020 11:25:30 +0000 (13:25 +0200)]
MAINTAINERS: mark FRAMEBUFFER LAYER as Orphan

It has been a fun ride since 2017 but unfortunately I don't have
enough time to look after it properly anymore.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7b709254-9412-8473-250c-0c4e006259b3@samsung.com
3 years agovirtio-gpu api: fix 64/32 compat issue with blob implementation
Alistair Delva [Tue, 29 Sep 2020 21:53:33 +0000 (14:53 -0700)]
virtio-gpu api: fix 64/32 compat issue with blob implementation

We encountered this issue when booting blob with a 32-bit kernel.
The implementation doesn't match v6 of the virtio-spec change, so fix
this.

Fixes: ff886cbdcc44 ("virtio-gpu api: blob resources")
Signed-off-by: Alistair Delva <adelva@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200929215333.1241-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/hisilicon: Delete the unused macro
Tian Tao [Tue, 29 Sep 2020 00:45:26 +0000 (08:45 +0800)]
drm/hisilicon: Delete the unused macro

The macro PADDING is no longer used. Delete it.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1601340326-14049-1-git-send-email-tiantao6@hisilicon.com
3 years agodrm/hisilicon: Using the to_hibmc_drm_private to convert
Tian Tao [Mon, 28 Sep 2020 08:49:38 +0000 (16:49 +0800)]
drm/hisilicon: Using the to_hibmc_drm_private to convert

Using the to_hibmc_drm_private to convert over all uses of
dev_private, and fix a little formatting issue.

v2:
fixed the commit message.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1601282978-45534-1-git-send-email-tiantao6@hisilicon.com
3 years agodrm: update todo.rst
Daniel Vetter [Tue, 29 Sep 2020 15:03:33 +0000 (17:03 +0200)]
drm: update todo.rst

- debugfs cleanup has moved forward thanks to the cleanup Wambui has
  done

Acked-by: Melissa Wen <melissa.srw@gmail.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200929150333.3441576-1-daniel.vetter@ffwll.ch
3 years agodrm/qxl: fix usage of ttm_bo_init
Christian König [Tue, 29 Sep 2020 11:21:26 +0000 (13:21 +0200)]
drm/qxl: fix usage of ttm_bo_init

We need to use ttm_bo_init_reserved here to make sure
that the BO is pinned before it becomes visible on the LRU.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392561/?series=82199&rev=1
3 years agodma-buf: Document struct dma_buf_map
Thomas Zimmermann [Fri, 25 Sep 2020 11:56:01 +0000 (13:56 +0200)]
dma-buf: Document struct dma_buf_map

This patch adds struct dma_buf_map and its helpers to the documentation. A
short tutorial is included.

v3:
* update documentation in a separate patch
* expand docs (Daniel)
* carry-over acks from patch 1

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925115601.23955-5-tzimmermann@suse.de
3 years agodma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces
Thomas Zimmermann [Fri, 25 Sep 2020 11:56:00 +0000 (13:56 +0200)]
dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces

This patch updates dma_buf_vunmap() and dma-buf's vunmap callback to
use struct dma_buf_map. The interfaces used to receive a buffer address.
This address is now given in an instance of the structure.

Users of the functions are updated accordingly. This is only an interface
change. It is currently expected that dma-buf memory can be accessed with
system memory load/store operations.

v2:
* include dma-buf-heaps and i915 selftests (kernel test robot)
* initialize cma_obj before using it in drm_gem_cma_free_object()
  (kernel test robot)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925115601.23955-4-tzimmermann@suse.de
3 years agodma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces
Thomas Zimmermann [Fri, 25 Sep 2020 11:55:59 +0000 (13:55 +0200)]
dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces

This patch updates dma_buf_vmap() and dma-buf's vmap callback to use
struct dma_buf_map.

The interfaces used to return a buffer address. This address now gets
stored in an instance of the structure that is given as an additional
argument. The functions return an errno code on errors.

Users of the functions are updated accordingly. This is only an interface
change. It is currently expected that dma-buf memory can be accessed with
system memory load/store operations.

v3:
* update fastrpc driver (kernel test robot)
v2:
* always clear map parameter in dma_buf_vmap() (Daniel)
* include dma-buf-heaps and i915 selftests (kernel test robot)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925115601.23955-3-tzimmermann@suse.de
3 years agodma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr
Thomas Zimmermann [Fri, 25 Sep 2020 11:55:58 +0000 (13:55 +0200)]
dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr

The new type struct dma_buf_map represents a mapping of dma-buf memory
into kernel space. It contains a flag, is_iomem, that signals users to
access the mapped memory with I/O operations instead of regular loads
and stores.

It was assumed that DMA buffer memory can be accessed with regular load
and store operations. Some architectures, such as sparc64, require the
use of I/O operations to access dma-map buffers that are located in I/O
memory. Providing struct dma_buf_map allows drivers to implement this.
This was specifically a problem when refreshing the graphics framebuffer
on such systems. [1]

As the first step, struct dma_buf stores an instance of struct dma_buf_map
internally. Afterwards, dma-buf's vmap and vunmap interfaces are be
converted. Finally, affected drivers can be fixed.

v3:
* moved documentation into separate patch
* test for NULL pointers with !<ptr>

[1] https://lore.kernel.org/dri-devel/20200725191012.GA434957@ravnborg.org/

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925115601.23955-2-tzimmermann@suse.de
3 years agodrm/qxl: simplify the return expression of qxl_plane_prepare_fb()
Qinglang Miao [Mon, 21 Sep 2020 13:10:22 +0000 (21:10 +0800)]
drm/qxl: simplify the return expression of qxl_plane_prepare_fb()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200921131022.91649-1-miaoqinglang@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: advertise features to userspace
Gurchetan Singh [Thu, 24 Sep 2020 00:32:14 +0000 (17:32 -0700)]
drm/virtio: advertise features to userspace

New api changes are now available to userspace. Also, the
comparison to true is redundant, so remove it.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-19-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: resource create blob ioctl
Gerd Hoffmann [Thu, 24 Sep 2020 00:32:13 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: resource create blob ioctl

Implement resource create blob as specified.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-18-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
3 years agodrm/virtio: implement blob resources: report blob mem to userspace
Gurchetan Singh [Thu, 24 Sep 2020 00:32:12 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: report blob mem to userspace

The stride field has never been used, so repurpose it to be
"blob_mem". This way, userspace can know the memory properties
of the blob if it's passed between userspace processes and
no suitable userspace API exists to transmit that knowledge.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-17-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: fix stride discrepancy
Gurchetan Singh [Thu, 24 Sep 2020 00:32:11 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: fix stride discrepancy

The old transfer ioctls may work on blob resources, and there is no
TRANSFER_BLOB hypercall now for simplicity.

The guest may have a image view on the blob resources such that the
stride is not equal to width * bytes_per_pixel.

For host-only blobs, we can repurpose the transfer ioctls to synchronize
caches as well.  For guest-only blobs, these operations are undefined
for now so leave them out.

Also, with seamless Wayland integration between guest/host looking
increasingly attractive, it also makes sense to keep track of
one value for stride.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-16-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: refactor UUID code somewhat
Gurchetan Singh [Thu, 24 Sep 2020 00:32:10 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: refactor UUID code somewhat

For upcoming blob resources, userspace can specify that the
resource will be used for cross-device sharing. This is mainly
for exportable blobs that will only shared with the virtgpu
display but not across devices.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-15-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: blob display integration
Gurchetan Singh [Thu, 24 Sep 2020 00:32:09 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: blob display integration

SCANOUT_BLOB forwards the DRM framebuffer metadata to the host. The
modifier is intentionally left out -- it may be possible to query
the host for that.

We also assume one blob resource per DRM framebuffer.  That too is
an intentional simplification.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-14-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: hypercall interface
Gurchetan Singh [Thu, 24 Sep 2020 00:32:08 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: hypercall interface

This implements the blob hypercall interface.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-13-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: implement vram object
Gerd Hoffmann [Thu, 24 Sep 2020 00:32:07 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: implement vram object

A virtio-gpu vram object is based on range-based allocation.
No guest shmemfs backing, so we call drm_gem_private_object_init.

This is for host memory without any guest backing (atleast initially).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-12-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
3 years agodrm/virtio: implement blob resources: add new fields to internal structs
Gurchetan Singh [Thu, 24 Sep 2020 00:32:06 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: add new fields to internal structs

Useful for upcoming blob resources.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-11-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: expose virtio_gpu_resource_id_get
Gurchetan Singh [Thu, 24 Sep 2020 00:32:05 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: expose virtio_gpu_resource_id_get

VRAM object will need it.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-10-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: implement blob resources: probe for host visible region
Gerd Hoffmann [Thu, 24 Sep 2020 00:32:04 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: probe for host visible region

The availability of the host visible region means host 3D
allocations can be directly mapped in the guest.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-9-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
3 years agodrm/virtio: implement blob resources: probe for the feature.
Gerd Hoffmann [Thu, 24 Sep 2020 00:32:03 +0000 (17:32 -0700)]
drm/virtio: implement blob resources: probe for the feature.

Let's proble for VIRTIO_GPU_F_RESOURCE_BLOB.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-8-gurchetansingh@chromium.org
3 years agodrm/virtgpu api: cross-device feature
Gurchetan Singh [Thu, 24 Sep 2020 00:32:02 +0000 (17:32 -0700)]
drm/virtgpu api: cross-device feature

This feature was recently added to virtio-gpu, lets make
it userspace queryable. It's an error to use
BLOB_FLAG_USE_CROSS_DEVICE when this feature is not present.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-7-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtgpu api: host visible feature
Gurchetan Singh [Thu, 24 Sep 2020 00:32:01 +0000 (17:32 -0700)]
drm/virtgpu api: host visible feature

This exposes the host visible feature to userspace.  Without it,
it is an error to specify BLOB_MEM_HOST3D with
BLOG_FLAG_USE_MAPPABLE.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Lingfeng Yang <lfy@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-6-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtgpu api: blob resources
Gurchetan Singh [Thu, 24 Sep 2020 00:32:00 +0000 (17:32 -0700)]
drm/virtgpu api: blob resources

This makes blob resources available to guest userspace. They are needed
for GL4.5, Vulkan and zero-copy virtio-gpu.

For Mesa, blob resources have been tested with Piglit's ARB_buffer_storage
tests and apitraces.  Apitraces of GL4.5 games show we're between 70%
to 80% of host performance on Iris, based on a apitrace of a 2013 GL4.5
game:

11.204 FPS (guest)
15.947 FPS (host)

This is still better than the status quo, when said game was unplayable
with Virgl due to an inefficient GL4.3 fallback.  But there's still room
for improvement if we want to match HW-assisted virtualization.

For Vulkan, blob resources have been tested with dEQP.vk.memory* and
running Vulkan applications in production with the "Cuttlefish" virtual
Android device.  This has been done with Lingfeng Yang's "gfxstream"
Vulkan implementation, which virtualizes Vulkan across many Google
products.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Lingfeng Yang <lfy@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-5-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agovirtio-gpu api: host visible feature
Gerd Hoffmann [Thu, 24 Sep 2020 00:31:59 +0000 (17:31 -0700)]
virtio-gpu api: host visible feature

This patch adds a new virtgpu feature that allows directly
mapping host allocated resources.

This is based on virtio shared memory regions, which allows
querying for memory regions using PCI transport. Each shared
memory region has an associated "shmid", the meaning of which
is device specific.

For virtio-gpu, we can define the shared memory region with id
VIRTIO_GPU_SHM_ID_HOST_VISIBLE to be the "host visible memory
region".

The presence of the host visible memory region means the following
hypercalls are supported:

1) VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB

This hypercall tells the host to inject the host resource's
mapping in an offset into virtio-gpu's PCI address space.
This is typically done via KVM_SET_USER_MEMORY_REGION on Linux
hosts.

On success, VIRTIO_GPU_RESP_OK_MAP_INFO is returned, which
specifies the host buffer's caching type and possibly in the
future performance hints about the buffer..

2) VIRTIO_GPU_CMD_RESOURCE_UNMAP_BLOB

This hypercall tells the host to remove the host resource's
mapping from the guest VM.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Lingfeng Yang <lfy@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-4-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
3 years agovirtio-gpu api: blob resources
Gerd Hoffmann [Thu, 24 Sep 2020 00:31:58 +0000 (17:31 -0700)]
virtio-gpu api: blob resources

A blob resource is a container for:
   - VIRTIO_GPU_BLOB_MEM_GUEST: a guest memory allocation
     (referred to as a "guest-only blob resource")

   - VIRTIO_GPU_BLOB_MEM_HOST3D: a host3d memory allocation
     (referred to as a "host-only blob resource")

   - VIRTIO_GPU_BLOB_MEM_HOST3D_GUEST: a guest + host3d memory allocation
     (referred to as a "default blob resource").

The memory properties of the blob resource must be described by
`blob_mem`.

For default and guest only blob resources set, `nents` guest system
pages are assigned to the resource.  For default blob resources,
these guest pages are used for transfer operations. Attach/detach is
also possible to allow swap-in/swap-out, but isn't required since it
may not be applicable to future blob mem types
(shared guest/guest vram).

Host allocations depend on whether the 3D is supported. If 3D is not
supported, the only valid field for `blob_mem` is
VIRTIO_GPU_BLOB_MEM_GUEST.

If 3D is supported, the virtio-gpu resource is created from the
context local object identified by the `blob_id`. The actual host
allocation done by the CMD_SUBMIT_3D.

Userspace must specify if the blob resource is intended to be used
for userspace mapping, sharing between virtio-gpu contexts and/or
sharing between virtio devices. This is done via `blob_flags`.

For 3D hosts, both VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D and
VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D may be used to update
the host resource. There is no restriction on the image/buffer
view the guest/host userspace has on the blob resource.

VIRTIO_GPU_CMD_SET_SCANOUT_BLOB / VIRTIO_GPU_CMD_RESOURCE_FLUSH may
be used with blob resources as well.  The modifier is intentionally
left out of SCANOUT_BLOB, and auxilary blobs are also left out
as a simplification.

The use case for blob resources is zero-copy, needed for coherent
memory in virglrenderer. Host only blob resources are not mappable
without the feature described in the next patch, but are shareable.

Future work:
   - Emulated coherent `blob_mem` type for QEMU/vhost-user
   - A `blob_mem` type for guest-only resources imported in
     cache-coherent FOSS GPU/display drivers.
   - Display integration involving the blob model using seamless
     Wayland windows.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Lingfeng Yang <lfy@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-3-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
3 years agodrm/virtio: blob prep: make CPU responses more generic
Gurchetan Singh [Thu, 24 Sep 2020 00:31:57 +0000 (17:31 -0700)]
drm/virtio: blob prep: make CPU responses more generic

RESOURCE_MAP_BLOB / RESOURCE_UNMAP_BLOB can use this.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-2-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: blob prep: refactor getting pages and attaching backing
Gurchetan Singh [Thu, 24 Sep 2020 00:31:56 +0000 (17:31 -0700)]
drm/virtio: blob prep: refactor getting pages and attaching backing

Useful for upcoming blob resources.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/rockchip: Include <drm/drm_gem_cma_helper> for drm_gem_cm_vm_ops
Thomas Zimmermann [Mon, 28 Sep 2020 08:16:43 +0000 (10:16 +0200)]
drm/rockchip: Include <drm/drm_gem_cma_helper> for drm_gem_cm_vm_ops

Include <drm/drm_gem_cma_helper.h> to get drm_gem_cma_vm_ops. Fallout
from the recent conversion to GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 0d590af3140d ("drm/rockchip: Convert to drm_gem_object_funcs")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200928081643.8575-1-tzimmermann@suse.de
3 years agodrm/hisilicon: Deleted the drm_device declaration
Tian Tao [Fri, 25 Sep 2020 07:48:06 +0000 (15:48 +0800)]
drm/hisilicon: Deleted the drm_device declaration

drm_framebuffer.h already declares struct drm_device, so there's no
need to declare it in hibmc_drm_drv.h

v2:
fixed spelling errors in commit message.

v3:
rewrite the commit message.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1601020086-43652-1-git-send-email-tiantao6@hisilicon.com
3 years agodrm/ttm: remove fault callback
Christian König [Fri, 25 Sep 2020 13:45:19 +0000 (15:45 +0200)]
drm/ttm: remove fault callback

Another one bites the dust.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392325/
3 years agodrm/nouveau: stop using TTMs fault callback
Christian König [Fri, 25 Sep 2020 13:42:04 +0000 (15:42 +0200)]
drm/nouveau: stop using TTMs fault callback

We already implemented the fault handler ourself,
just open code what is necessary here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392323/
3 years agodrm/amdgpu: stop using TTMs fault callback
Christian König [Fri, 25 Sep 2020 13:21:49 +0000 (15:21 +0200)]
drm/amdgpu: stop using TTMs fault callback

Implement the fault handler ourself using the provided TTM functions.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392324/
3 years agodrm/radeon: stop using TTMs fault callback
Christian König [Fri, 25 Sep 2020 12:17:09 +0000 (14:17 +0200)]
drm/radeon: stop using TTMs fault callback

We already implemented the fault handler ourself,
just open code what is necessary here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392322/
3 years agodrm/ttm: move SG flag check into ttm_bo_vm_reserve
Christian König [Fri, 25 Sep 2020 10:40:03 +0000 (12:40 +0200)]
drm/ttm: move SG flag check into ttm_bo_vm_reserve

Just check earlier if a BO can be page faulted in the first place.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392321/
3 years agodrm/ingenic: Add support for paletted 8bpp
Paul Cercueil [Sun, 27 Sep 2020 19:36:45 +0000 (21:36 +0200)]
drm/ingenic: Add support for paletted 8bpp

On JZ4725B and newer, the F0 plane supports paletted 8bpp with a
256-entry palette. Add support for it.

v3: Only accept a full 256-entry palette.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200927193645.262612-2-paul@crapouillou.net
3 years agodrm/ingenic: Add support for 24-bit modes
Paul Cercueil [Sat, 26 Sep 2020 17:05:01 +0000 (19:05 +0200)]
drm/ingenic: Add support for 24-bit modes

Starting from the JZ4725B SoC, the primary and overlay planes support
24-bit pixel modes (8 bits per color component, without dummy byte).
Add support for these in the ingenic-drm driver.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-8-paul@crapouillou.net
3 years agodrm/ingenic: Add support for 30-bit modes
Paul Cercueil [Sat, 26 Sep 2020 17:05:00 +0000 (19:05 +0200)]
drm/ingenic: Add support for 30-bit modes

Starting from the JZ4760 SoC, the primary and overlay planes support
30-bit pixel modes (10 bits per color component). Add support for these
in the ingenic-drm driver.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-7-paul@crapouillou.net
3 years agodrm/ingenic: Support handling different pixel formats in F0/F1 planes
Paul Cercueil [Sat, 26 Sep 2020 17:04:58 +0000 (19:04 +0200)]
drm/ingenic: Support handling different pixel formats in F0/F1 planes

Until now the ingenic-drm driver supported the same pixel formats on the
F0 and F1 planes, and across all SoCs. However, the F0 plane does support
paletted 8bpp, while the F1 plane doesn't.

Furthermore, the three SoCs currently supported all have different pixel
formats available; 24bpp was added in JZ4725B, 30bpp was added in
JZ4770.

Prepare the inclusion of paletted 8bpp, 24bpp and 30bpp support by
having separate pixel format lists for F0 and F1 planes.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-5-paul@crapouillou.net
3 years agodrm/ingenic: Alloc F0 and F1 DMA descriptors at once
Paul Cercueil [Sat, 26 Sep 2020 17:04:57 +0000 (19:04 +0200)]
drm/ingenic: Alloc F0 and F1 DMA descriptors at once

Instead of calling dmam_alloc_coherent() once for each 4-bit DMA
hardware descriptor, we can have them both in a physical memory page, as
long as they are aligned to 16 bytes. This reduces memory consumption,
and will make it easier to add more DMA descriptors in the future.

Note that the old code would not create the F0 descriptor on SoCs that
don't support multiple planes. We don't care, because:
- we don't use more memory by allocating two descriptors instead of a
  single one;
- the only SoC that does not support multiple planes (JZ4740) still has
  two independent DMA channels, for an unknown reason.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-4-paul@crapouillou.net
3 years agodrm/ingenic: Add support for reserved memory
Paul Cercueil [Sat, 26 Sep 2020 17:04:56 +0000 (19:04 +0200)]
drm/ingenic: Add support for reserved memory

Add support for static memory reserved from Device Tree. Since we're
using GEM buffers backed by CMA, it is interesting to have an option to
specify the CMA area where the GEM buffers will be allocated.

v2: Don't abort probe if reserved memory cannot be obtained. The driver
    will still work fine provided the kernel configuration is sane.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-3-paul@crapouillou.net
3 years agodrm/ingenic: Reset pixclock rate when parent clock rate changes
Paul Cercueil [Sat, 26 Sep 2020 17:04:55 +0000 (19:04 +0200)]
drm/ingenic: Reset pixclock rate when parent clock rate changes

Old Ingenic SoCs can overclock very well, up to +50% of their nominal
clock rate, whithout requiring overvolting or anything like that, just
by changing the rate of the main PLL. Unfortunately, all clocks on the
system are derived from that PLL, and when the PLL rate is updated, so
is our pixel clock.

To counter that issue, we make sure that the panel is in VBLANK before
the rate change happens, and we will then re-set the pixel clock rate
afterwards, once the PLL has been changed, to be as close as possible to
the pixel rate requested by the encoder.

v2: Add comment about mutex usage

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-2-paul@crapouillou.net
3 years agofbdev: sbuslib: remove compat_alloc_user_space usage
Arnd Bergmann [Fri, 18 Sep 2020 10:09:06 +0000 (12:09 +0200)]
fbdev: sbuslib: remove compat_alloc_user_space usage

This is one of the last users of compat_alloc_user_space()
and copy_in_user(). The actual handler is implemented in the
same file and could be shared, but as I couldn't test this
properly I leave the native case alone and just make a straight
copy of it for the compat case, with a minimum set of
modifications.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200918100926.1447563-3-arnd@arndb.de
3 years agofbdev: sbuslib: remove unused FBIOSCURSOR32 helper
Arnd Bergmann [Fri, 18 Sep 2020 10:09:05 +0000 (12:09 +0200)]
fbdev: sbuslib: remove unused FBIOSCURSOR32 helper

No driver implements FBIOSCURSOR, so this function has no purpose
and can be removed. Apparently it was added in linux-2.1.44 to handle
compatibility for drivers/sbus/char/sunfb.c but lost its purpose when
that driver got rewritten in linux-2.5.63.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200918100926.1447563-2-arnd@arndb.de
3 years agofbdev: simplify fb_getput_cmap()
Arnd Bergmann [Fri, 18 Sep 2020 10:09:04 +0000 (12:09 +0200)]
fbdev: simplify fb_getput_cmap()

This function is one of the remaining users of compat_alloc_user_space()
and copy_in_user().

Clean it up by copying to a local data structure copy instead,
which also leads to more readable code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200918100926.1447563-1-arnd@arndb.de
3 years agodrm/vram-helper: Don't put new BOs into VRAM
Thomas Zimmermann [Tue, 22 Sep 2020 14:57:00 +0000 (16:57 +0200)]
drm/vram-helper: Don't put new BOs into VRAM

Most drivers that use VRAM helpers have only a few MiB of framebuffer
memory available. To reduce fragmentation, new BOs are now put into
system memory by default. Only pin operations are allowed to move BOs
into VRAM.

v2:
* rebased onto latest drm-tip

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200922145700.25413-4-tzimmermann@suse.de
3 years agodrm/vram-helper: Set object function iff they are not provided by driver
Thomas Zimmermann [Tue, 22 Sep 2020 14:56:59 +0000 (16:56 +0200)]
drm/vram-helper: Set object function iff they are not provided by driver

Don't override the GEM object functions unconditionally. If the driver
sets the GEM functions, VRAM helpers will not set them. The idea has been
taken from SHMEM helpers.

v2:
* updated the commit message (Sam)
* document the new feature for drm_gem_vram_create()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200922145700.25413-3-tzimmermann@suse.de
3 years agodrm/vram-helper: Integrate drm_gem_vram_init() into drm_gem_vram_create()
Thomas Zimmermann [Tue, 22 Sep 2020 14:56:58 +0000 (16:56 +0200)]
drm/vram-helper: Integrate drm_gem_vram_init() into drm_gem_vram_create()

The drm_gem_vram_create() function is the only caller of the internal
helper drm_gem_vram_init(). Streamline the code by putting all code into
the create function.

v2:
* rebased onto latest drm-tip
* fixed typo in commit message (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200922145700.25413-2-tzimmermann@suse.de
3 years agodrm: Remove obsolete GEM and PRIME callbacks from struct drm_driver
Thomas Zimmermann [Wed, 23 Sep 2020 10:21:59 +0000 (12:21 +0200)]
drm: Remove obsolete GEM and PRIME callbacks from struct drm_driver

Several GEM and PRIME callbacks have been deprecated in favor of
per-instance GEM object functions. Remove the callbacks as they are
now unused. The only exception is .gem_prime_mmap, which is still
in use by several drivers.

What is also gone is gem_vm_ops in struct drm_driver. All drivers now
use struct drm_gem_object_funcs.vm_ops instead.

While at it, the patch also improves error handling around calls
to .free and .get_sg_table callbacks.

v3:
* restore default call to drm_gem_prime_export() in
  drm_gem_prime_handle_to_fd()
* return -ENOSYS if get_sg_table is not set
* drop all checks for obj->funcs
* clean up TODO list and documentation
v2:
* update related TODO item (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-23-tzimmermann@suse.de
3 years agodrm/xlnx: Initialize DRM driver instance with CMA helper macro
Thomas Zimmermann [Wed, 23 Sep 2020 10:21:58 +0000 (12:21 +0200)]
drm/xlnx: Initialize DRM driver instance with CMA helper macro

The xlnx driver uses CMA helpers with default callback functions.
Initialize the driver structure with the rsp CMA helper macro. The
driver is being converted to use GEM object functions as part of
this change.

Two callbacks, .dumb_destroy and .gem_prime_import, were initialized
to their default implementations, so they are just kept empty now.

v2:
* initialize with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE (Laurent)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-22-tzimmermann@suse.de
3 years agodrm/xen: Introduce GEM object functions
Thomas Zimmermann [Wed, 23 Sep 2020 10:21:57 +0000 (12:21 +0200)]
drm/xen: Introduce GEM object functions

GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in xen. The only exception is gem_prime_mmap,
which is non-trivial to convert.

v2:
* convert xen_drm_drv_free_object_unlocked() to static
  callback (Oleksandr)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-21-tzimmermann@suse.de
3 years agodrm/vkms: Introduce GEM object functions
Thomas Zimmermann [Wed, 23 Sep 2020 10:21:56 +0000 (12:21 +0200)]
drm/vkms: Introduce GEM object functions

GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in vkms.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Melissa Wen <melissa.srw@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-20-tzimmermann@suse.de