Liu Zixian
194d250cdc
drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes
...
drm_cvt_mode may return NULL and we should check it.
This bug is found by syzkaller:
FAULT_INJECTION stacktrace:
[ 168.567394] FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 1
[ 168.567403] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90-vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1
[ 168.567406] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
[ 168.567408] Call trace:
[ 168.567414] dump_backtrace+0x0/0x310
[ 168.567418] show_stack+0x28/0x38
[ 168.567423] dump_stack+0xec/0x15c
[ 168.567427] should_fail+0x3ac/0x3d0
[ 168.567437] __should_failslab+0xb8/0x120
[ 168.567441] should_failslab+0x28/0xc0
[ 168.567445] kmem_cache_alloc_trace+0x50/0x640
[ 168.567454] drm_mode_create+0x40/0x90
[ 168.567458] drm_cvt_mode+0x48/0xc78
[ 168.567477] virtio_gpu_conn_get_modes+0xa8/0x140 [virtio_gpu]
[ 168.567485] drm_helper_probe_single_connector_modes+0x3a4/0xd80
[ 168.567492] drm_mode_getconnector+0x2e0/0xa70
[ 168.567496] drm_ioctl_kernel+0x11c/0x1d8
[ 168.567514] drm_ioctl+0x558/0x6d0
[ 168.567522] do_vfs_ioctl+0x160/0xf30
[ 168.567525] ksys_ioctl+0x98/0xd8
[ 168.567530] __arm64_sys_ioctl+0x50/0xc8
[ 168.567536] el0_svc_common+0xc8/0x320
[ 168.567540] el0_svc_handler+0xf8/0x160
[ 168.567544] el0_svc+0x10/0x218
KASAN stacktrace:
[ 168.567561] BUG: KASAN: null-ptr-deref in virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu]
[ 168.567565] Read of size 4 at addr 0000000000000054 by task syz/6425
[ 168.567566]
[ 168.567571] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90-vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1
[ 168.567573] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
[ 168.567575] Call trace:
[ 168.567578] dump_backtrace+0x0/0x310
[ 168.567582] show_stack+0x28/0x38
[ 168.567586] dump_stack+0xec/0x15c
[ 168.567591] kasan_report+0x244/0x2f0
[ 168.567594] __asan_load4+0x58/0xb0
[ 168.567607] virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu]
[ 168.567612] drm_helper_probe_single_connector_modes+0x3a4/0xd80
[ 168.567617] drm_mode_getconnector+0x2e0/0xa70
[ 168.567621] drm_ioctl_kernel+0x11c/0x1d8
[ 168.567624] drm_ioctl+0x558/0x6d0
[ 168.567628] do_vfs_ioctl+0x160/0xf30
[ 168.567632] ksys_ioctl+0x98/0xd8
[ 168.567636] __arm64_sys_ioctl+0x50/0xc8
[ 168.567641] el0_svc_common+0xc8/0x320
[ 168.567645] el0_svc_handler+0xf8/0x160
[ 168.567649] el0_svc+0x10/0x218
Signed-off-by: Liu Zixian <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2022-03-25 12:28:27 +01:00
Jing Xiangfeng
a63f393dd7
drm/virtio: fix the missed drm_gem_object_put() in virtio_gpu_user_framebuffer_create()
...
virtio_gpu_user_framebuffer_create() misses to call drm_gem_object_put()
in an error path. Add the missed function call to fix it.
Signed-off-by: Jing Xiangfeng <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2021-10-11 11:16:45 +02:00
Maxime Ripard
253f28b623
drm: Use state helper instead of CRTC state pointer
...
Many drivers reference the crtc->pointer in order to get the current CRTC
state in their atomic_begin or atomic_flush hooks, which would be the new
CRTC state in the global atomic state since _swap_state happened when those
hooks are run.
Use the drm_atomic_get_new_crtc_state helper to get that state to make it
more obvious.
This was made using the coccinelle script below:
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)
@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct tegra_dc_state *crtc_state = e;
+ struct tegra_dc_state *dc_state = e;
<+...
- crtc_state
+ dc_state
...+>
}
@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct mtk_crtc_state *crtc_state = e;
+ struct mtk_crtc_state *mtk_crtc_state = e;
<+...
- crtc_state
+ mtk_crtc_state
...+>
}
@ replaces_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- struct drm_crtc_state *crtc_state = crtc->state;
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
- crtc->state
+ crtc_state
...
}
@ adds_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
...
- crtc->state
+ crtc_state
...
}
@ include depends on adds_new_state || replaces_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && (adds_new_state || replaces_new_state) @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Suggested-by: Ville Syrjälä <[email protected] >
Signed-off-by: Maxime Ripard <[email protected] >
Reviewed-by: Ville Syrjälä <[email protected] >
Acked-by: Thomas Zimmermann <[email protected] >
Cc: "James (Qian) Wang" <[email protected] >
Cc: Liviu Dudau <[email protected] >
Cc: Mihail Atanassov <[email protected] >
Cc: Brian Starkey <[email protected] >
Cc: Russell King <[email protected] >
Cc: Paul Cercueil <[email protected] >
Cc: Chun-Kuang Hu <[email protected] >
Cc: Philipp Zabel <[email protected] >
Cc: Sandy Huang <[email protected] >
Cc: "Heiko Stübner" <[email protected] >
Cc: Thierry Reding <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-11-10 12:41:06 +01:00
Maxime Ripard
f6ebe9f9c9
drm/atomic: Pass the full state to CRTC atomic begin and flush
...
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_begin and atomic_flush.
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 old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_begin(crtc, old_crtc_state);
+ FUNCS->atomic_begin(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@
f(struct drm_crtc_state *old_crtc_state)
{
...
struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_flush(crtc, old_crtc_state);
+ FUNCS->atomic_flush(crtc, old_state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_begin(crtc, crtc_state);
+ FUNCS->atomic_begin(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state, ...)
{
<...
- FUNCS->atomic_flush(crtc, crtc_state);
+ FUNCS->atomic_flush(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = 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
...+>
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@@
identifier old_state;
identifier crtc;
@@
void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
);
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{
...
}
@@
identifier old_state;
identifier crtc;
@@
void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *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 <[email protected] >
Reviewed-by: Ville Syrjälä <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Acked-by: Thomas Zimmermann <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-11-02 12:37:49 +01:00
Maxime Ripard
29b77ad7b9
drm/atomic: Pass the full state to CRTC atomic_check
...
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.
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;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@
f(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
}
@@
identifier crtc, new_state;
@@
struct drm_crtc_helper_funcs {
...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
{
... when != new_state
}
@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@
int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
int func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
int func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@
int func(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{ ... }
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
)
{
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
}
@@
identifier new_state;
identifier crtc;
@@
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
- struct drm_crtc_state *new_state
+ struct drm_atomic_state *state
);
@ include depends on adds_new_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_new_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <[email protected] >
Reviewed-by: Ville Syrjälä <[email protected] >
Acked-by: Thomas Zimmermann <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-11-02 12:34:49 +01:00
Maxime Ripard
351f950db4
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 <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-09 09:55:59 +02:00
Gerd Hoffmann
d6005d3dde
drm/virtio: use drmm_mode_config_init
...
Use managed init call to simplify cleanup.
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-09-15 09:42:28 +02:00
Gerd Hoffmann
1174c8a0f3
drm/virtio: drop virtio_gpu_output->enabled
...
Not needed, already tracked by drm_crtc_state->active.
Signed-off-by: Gerd Hoffmann <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-09-02 08:09:57 +02:00
Gerd Hoffmann
1bc371cd0e
drm/virtio: fix unblank
...
When going through a disable/enable cycle without changing the
framebuffer the optimization added by commit 3954ff10e0 ("drm/virtio:
skip set_scanout if framebuffer didn't change") causes the screen stay
blank. Add a bool to force an update to fix that.
v2: use drm_atomic_crtc_needs_modeset() (Daniel).
Cc: [email protected]
Fixes: 3954ff10e0 ("drm/virtio: skip set_scanout if framebuffer didn't change")
Signed-off-by: Gerd Hoffmann <[email protected] >
Tested-by: Jiri Slaby <[email protected] >
Tested-by: Diego Viola <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-09-02 08:09:57 +02:00
Colin Ian King
d4c5c2f331
drm/virtgpu: remove redundant assignments to width and height
...
Variables width and height are being assigned values that are never
read. The assignments are redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2020-08-17 09:36:35 +02:00
Daniel Vetter
73f15a9392
drm/virtio: Remove open-coded commit-tail function
...
Exactly matches the one in the helpers.
This avoids me having to roll out dma-fence critical section
annotations to this copy.
Reviewed-by: Sam Ravnborg <[email protected] >
Acked-by: Gerd Hoffmann <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Cc: David Airlie <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Cc: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-07-14 10:47:16 +02:00
Emil Velikov
969397eb9a
drm/virtio: remove _unlocked suffix in drm_gem_object_put_unlocked
...
Spelling out _unlocked for each and every driver is a annoying.
Especially if we consider how many drivers, do not know (or need to)
about the horror stories involving struct_mutex.
Just drop the suffix. It makes the API cleaner.
Done via the following script:
__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done
Cc: David Airlie <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Cc: Daniel Vetter <[email protected] >
Signed-off-by: Emil Velikov <[email protected] >
Acked-by: Sam Ravnborg <[email protected] >
Acked-by: Gerd Hoffmann <[email protected] >
Acked-by: Thomas Zimmermann <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-05-19 22:31:36 +01:00
Thomas Zimmermann
35b9df3cde
drm/virtgpu: Use simple encoder
...
The virtgpu driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <[email protected] >
Reviewed-by: Laurent Pinchart <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-04-02 14:16:46 +02:00
Gerd Hoffmann
790bcd7914
drm/virtio: batch plane updates (pageflip)
...
Move virtio_gpu_notify() to higher-level functions for
virtio_gpu_cmd_resource_flush(), virtio_gpu_cmd_set_scanout() and
virtio_gpu_cmd_transfer_to_host_{2d,3d}().
virtio_gpu_primary_plane_update() will notify only once for a series
of commands (restores plane update command batching).
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Chia-I Wu <[email protected] >
Reviewed-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17 14:50:49 +01:00
Gerd Hoffmann
b1df3a2b24
drm/virtio: add drm_driver.release callback.
...
Split virtio_gpu_deinit(), move the drm shutdown and release to
virtio_gpu_release(). Drop vqs_ready variable, instead use
drm_dev_{enter,exit,unplug} to avoid touching hardware after
device removal. Tidy up here and there.
v4: add changelog.
v3: use drm_dev_*().
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-12 10:24:08 +01:00
Gerd Hoffmann
fda1572114
drm/virtio: fix vblank handling
...
virtio has its own commit fail function. Add the
drm_atomic_helper_fake_vblank() call there.
Fixes: 2a735ad3d2 ("drm/virtio: Remove sending of vblank event")
Signed-off-by: Gerd Hoffmann <[email protected] >
Acked-by: Thomas Zimmermann <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-05 11:47:47 +01:00
Thomas Zimmermann
2a735ad3d2
drm/virtio: Remove sending of vblank event
...
The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.
v4:
* separate commit from core vblank changes
Signed-off-by: Thomas Zimmermann <[email protected] >
Acked-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-01-30 09:00:50 +01:00
Gurchetan Singh
570c815698
drm/virtio: move drm_connector_to_virtio_gpu_output to virtgpu_display
...
That's the only file that uses it.
Signed-off-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2019-12-19 07:13:46 +01:00
Gurchetan Singh
9567728ae2
drm/virtio: static-ify virtio_gpu_framebuffer_init
...
Not used anywhere else.
Signed-off-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2019-12-19 07:13:45 +01:00
Sam Ravnborg
a3d639776e
drm/virtgpu: drop use of drmP.h
...
Drop use of the deprecated drmP.h header file.
Fix fallout by adding missing include files.
Signed-off-by: Sam Ravnborg <[email protected] >
Acked-by: Gerd Hoffmann <[email protected] >
Acked-by: Emil Velikov <[email protected] >
Cc: David Airlie <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-07-15 18:11:31 +02:00
Gerd Hoffmann
b07baa0393
drm/virtio: drop framebuffer dirty tracking code
...
No need to have our own implementation,
atomic helpers can do it for us.
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-13 08:47:15 +02:00
Gerd Hoffmann
7ff8a316d1
drm/virtio: add missing drm_atomic_helper_shutdown() call.
...
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-04-02 11:00:45 +02:00
Daniel Vetter
fcd70cd36b
drm: Split out drm_probe_helper.h
...
Having the probe helper stuff (which pretty much everyone needs) in
the drm_crtc_helper.h file (which atomic drivers should never need) is
confusing. Split them out.
To make sure I actually achieved the goal here I went through all
drivers. And indeed, all atomic drivers are now free of
drm_crtc_helper.h includes.
v2: Make it compile. There was so much compile fail on arm drivers
that I figured I'll better not include any of the acks on v1.
v3: Massive rebase because i915 has lost a lot of drmP.h includes, but
not all: Through drm_crtc_helper.h > drm_modeset_helper.h -> drmP.h
there was still one, which this patch largely removes. Which means
rolling out lots more includes all over.
This will also conflict with ongoing drmP.h cleanup by others I
expect.
v3: Rebase on top of atomic bochs.
v4: Review from Laurent for bridge/rcar/omap/shmob/core bits:
- (re)move some of the added includes, use the better include files in
other places (all suggested from Laurent adopted unchanged).
- sort alphabetically
v5: Actually try to sort them, and while at it, sort all the ones I
touch.
v6: Rebase onto i915 changes.
v7: Rebase once more.
Acked-by: Harry Wentland <[email protected] >
Acked-by: Sam Ravnborg <[email protected] >
Cc: Sam Ravnborg <[email protected] >
Cc: Jani Nikula <[email protected] >
Cc: Laurent Pinchart <[email protected] >
Acked-by: Rodrigo Vivi <[email protected] >
Acked-by: Benjamin Gaignard <[email protected] >
Acked-by: Jani Nikula <[email protected] >
Acked-by: Neil Armstrong <[email protected] >
Acked-by: Oleksandr Andrushchenko <[email protected] >
Acked-by: CK Hu <[email protected] >
Acked-by: Alex Deucher <[email protected] >
Acked-by: Sam Ravnborg <[email protected] >
Reviewed-by: Laurent Pinchart <[email protected] >
Acked-by: Liviu Dudau <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-01-24 13:20:42 +01:00
Ezequiel Garcia
d516e75c71
drm/virtio: Drop deprecated load/unload initialization
...
Move the code around so the driver is probed the bus
.probe and removed from the bus .remove callbacks.
This commit is just a cleanup and shouldn't affect
functionality.
Signed-off-by: Ezequiel Garcia <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2019-01-09 09:38:49 +01:00
Ezequiel Garcia
29cd2e2dac
drm/virtio: Remove incorrect kfree()
...
The virtio_gpu_output is a member of struct virtio_gpu_device
and is not a dynamically-allocated chunk, so it's wrong to kfree() it.
Removing it fixes a memory corruption BUG() that can be triggered
when the virtio-gpu driver is removed.
Signed-off-by: Ezequiel Garcia <[email protected] >
Signed-off-by: Gerd Hoffmann <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-01-08 11:45:19 +01:00
Gerd Hoffmann
48a77d66cb
drm/virtio: switch to generic fbdev emulation
...
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Dave Airlie <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-12-14 09:40:27 +01:00
Gerd Hoffmann
b4b01b4995
drm/virtio: add edid support
...
linux guest driver implementation of the VIRTIO_GPU_F_EDID feature.
Signed-off-by: Gerd Hoffmann <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-11-21 12:06:59 +01:00
Gerd Hoffmann
42fd9e6c29
drm/virtio: fix DRM_FORMAT_* handling
...
Use DRM_FORMAT_HOST_XRGB8888, so we are using the correct format code
on bigendian machines. Also set the quirk_addfb_prefer_host_byte_order
mode_config bit so drm_mode_addfb() asks for the correct format code.
Both DRM_FORMAT_* and VIRTIO_GPU_FORMAT_* are defined to be little
endian, so using a different mapping on bigendian machines is wrong.
It's there because of broken drm_mode_addfb() behavior. So with
drm_mode_addfb() being fixed we can fix this too.
While wading through the code I've noticed we have a little issue in
virtio: We attach a format to the bo when it is created
(DRM_IOCTL_MODE_CREATE_DUMB), not when we map it as framebuffer
(DRM_IOCTL_MODE_ADDFB). Easy way out: Support a single format only.
Pick DRM_FORMAT_HOST_XRGB8888, it is the only one actually used in
practice. Drop unused mappings in virtio_gpu_translate_format().
With this patch applied both ADDFB and ADDFB2 ioctls work correctly in
the virtio-gpu.ko driver on big endian machines. Without the patch only
ADDFB (which still seems to be used by the majority of userspace) works
correctly.
Signed-off-by: Gerd Hoffmann <[email protected] >
Acked-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-25 14:49:49 +02:00
YueHaibing
ea4584c2f2
drm/virtio: Remove set but not used variable 'bo'
...
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/virtio/virtgpu_display.c: In function 'virtio_gpu_framebuffer_init':
drivers/gpu/drm/virtio/virtgpu_display.c:78:28: warning:
variable 'bo' set but not used [-Wunused-but-set-variable]
struct virtio_gpu_object *bo;
^
Signed-off-by: YueHaibing <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2018-09-10 07:10:36 +02:00
Gerd Hoffmann
6c19787e10
drm/virtio: track virtual output state
...
Track whenever an virtual output (crtc) is enabled or disabled.
On atomic updates check for both framebuffer being present and crtc
being enabled to figure whenever the output is active or not.
Signed-off-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Dave Airlie <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-05 08:26:24 +02:00
Daniel Vetter
cde4c44d87
drm: drop _mode_ from drm_mode_connector_attach_encoder
...
Again to align with the usual prefix of just drm_connector_. Again
done with sed + manual fixup for indent issues.
Reviewed-by: Sean Paul <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-07-13 18:40:27 +02:00
Ville Syrjälä
50dcd55418
drm/virtio: Stop updating plane->crtc
...
We want to get rid of plane->crtc on atomic drivers. Stop setting it.
v2: s/fb/crtc/ in the commit message (Gerd)
Cc: David Airlie <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Cc: [email protected]
Signed-off-by: Ville Syrjälä <[email protected] >
Reviewed-by: Maarten Lankhorst <[email protected] >
Reviewed-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Sinclair Yeh <[email protected] >
2018-06-11 20:22:44 +03:00
Daniel Stone
3823da3aeb
drm/virtio: Place GEM BOs in drm_framebuffer
...
Since drm_framebuffer can now store GEM objects directly, place them
there rather than in our own subclass. As this makes the framebuffer
create_handle and destroy functions the same as the GEM framebuffer
helper, we can reuse those.
Signed-off-by: Daniel Stone <[email protected] >
Reviewed-by: Thierry Reding <[email protected] >
Cc: Dave Airlie <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Cc: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-05-18 14:52:33 +01:00
Luc Van Oostenryck
16d25ea094
drm/virtio: fix mode_valid's return type
...
The method struct drm_connector_helper_funcs::mode_valid is defined
as returning an 'enum drm_mode_status' but the driver implementation
for this method uses an 'int' for it.
Fix this by using 'enum drm_mode_status' in the driver too.
Signed-off-by: Luc Van Oostenryck <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Cc: David Airlie <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Cc: [email protected]
2018-04-25 10:21:19 +02:00
Rodrigo Siqueira
dc31b3b76c
drm/virtio: Replace 'unsigned' for 'unsigned int'
...
This patch fixes the checkpatch.pl warning:
drivers/gpu/drm/virtio/virtgpu_display.c:64: WARNING: Prefer 'unsigned
int' to bare use of 'unsigned'
...
Signed-off-by: Rodrigo Siqueira <[email protected] >
Reviewed-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/ac9c4110785e6519801d44c57d4f05c3e0cdad53.1519343668.git.rodrigosiqueiramelo@gmail.com
Signed-off-by: Gerd Hoffmann <[email protected] >
2018-02-27 08:40:41 +01:00
Rodrigo Siqueira
9d492b6bec
drm/virtio: Add blank line after variable declarations
...
This patch fixes the checkpatch.pl warnings:
virtgpu_drv.c:57: WARNING: Missing a blank line after declarations
virtgpu_display.c:99: WARNING: Missing a blank line after declarations
...
Signed-off-by: Rodrigo Siqueira <[email protected] >
Reviewed-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/41767852ff9dc584c825e32db6222b9a311603b9.1519343668.git.rodrigosiqueiramelo@gmail.com
Signed-off-by: Gerd Hoffmann <[email protected] >
2018-02-27 08:40:37 +01:00
Rodrigo Siqueira
1858b85606
drm/virtio: Add tabs at the start of a line
...
This patch fixes the checkpatch.pl errors:
drivers/gpu/drm/virtio/virtgpu_drv.h:371: ERROR: code indent should use
tabs where possible
...
Signed-off-by: Rodrigo Siqueira <[email protected] >
Reviewed-by: Gurchetan Singh <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/1c77c233d4454ee2bdb85beaf17d413e310fac0a.1519343668.git.rodrigosiqueiramelo@gmail.com
Signed-off-by: Gerd Hoffmann <[email protected] >
2018-02-27 08:40:35 +01:00
Lepton Wu
7bac534e02
drm/virtio: add create_handle support.
...
Add create_handle support to virtio fb. Without this, screenshot tool
in chromium OS can't work.
Signed-off-by: Lepton Wu <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected] >
2017-11-10 12:45:34 +01:00
Srishti Sharma
1af0838de6
drm/virtio: Replace instances of reference/unreference with get/put
...
Replace reference/unreference with get/put as it is consistent
with the kernel coding style. Done using the following semantic
patch by coccinelle.
@r@
expression e;
@@
-drm_gem_object_unreference_unlocked(e);
+drm_gem_object_put_unlocked(e);
Signed-off-by: Srishti Sharma <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-10-02 09:48:54 +02:00
Daniel Vetter
7d902c05b4
drm: Nuke drm_atomic_helper_connector_dpms
...
It's dead code, the core handles all this directly now.
The only special case is nouveau and tda988x which used one function
for both legacy modeset code and -nv50 atomic world instead of 2
vtables. But amounts to exactly the same.
v2: Rebase over the panel/brideg refactorings in stm/ltdc.
Signed-off-by: Daniel Vetter <[email protected] >
Cc: Archit Taneja <[email protected] >
Cc: Andrzej Hajda <[email protected] >
Cc: Laurent Pinchart <[email protected] >
Cc: Peter Senna Tschudin <[email protected] >
Cc: Martin Donnelly <[email protected] >
Cc: Martyn Welch <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Jani Nikula <[email protected] >
Cc: Sean Paul <[email protected] >
Cc: David Airlie <[email protected] >
Cc: Inki Dae <[email protected] >
Cc: Joonyoung Shim <[email protected] >
Cc: Seung-Woo Kim <[email protected] >
Cc: Kyungmin Park <[email protected] >
Cc: Kukjin Kim <[email protected] >
Cc: Krzysztof Kozlowski <[email protected] >
Cc: Stefan Agner <[email protected] >
Cc: Alison Wang <[email protected] >
Cc: Russell King <[email protected] >
Cc: Philipp Zabel <[email protected] >
Cc: CK Hu <[email protected] >
Cc: Matthias Brugger <[email protected] >
Cc: Neil Armstrong <[email protected] >
Cc: Carlo Caione <[email protected] >
Cc: Kevin Hilman <[email protected] >
Cc: Marek Vasut <[email protected] >
Cc: Ben Skeggs <[email protected] >
Cc: Tomi Valkeinen <[email protected] >
Cc: Eric Anholt <[email protected] >
Cc: Mark Yao <[email protected] >
Cc: Heiko Stuebner <[email protected] >
Cc: Benjamin Gaignard <[email protected] >
Cc: Vincent Abriou <[email protected] >
Cc: Yannick Fertre <[email protected] >
Cc: Philippe Cornu <[email protected] >
Cc: Maxime Ripard <[email protected] >
Cc: Chen-Yu Tsai <[email protected] >
Cc: Thierry Reding <[email protected] >
Cc: Jonathan Hunter <[email protected] >
Cc: Jyri Sarha <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Cc: Shawn Guo <[email protected] >
Cc: John Stultz <[email protected] >
Cc: Lars-Peter Clausen <[email protected] >
Cc: Sergei Shtylyov <[email protected] >
Cc: Jeffy Chen <[email protected] >
Cc: Tomeu Vizoso <[email protected] >
Cc: Yakir Yang <[email protected] >
Cc: Marek Szyprowski <[email protected] >
Cc: Jose Abreu <[email protected] >
Cc: Romain Perier <[email protected] >
Cc: Kieran Bingham <[email protected] >
Cc: Xinliang Liu <[email protected] >
Cc: Alexey Brodkin <[email protected] >
Cc: Alex Deucher <[email protected] >
Cc: Rongrong Zou <[email protected] >
Cc: Rob Clark <[email protected] >
Cc: Hai Li <[email protected] >
Cc: "Noralf Trønnes" <[email protected] >
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: zain wang <[email protected] >
Cc: Baoyou Xie <[email protected] >
Cc: Boris Brezillon <[email protected] >
Reviewed-by: Maarten Lankhorst <[email protected] >
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Acked-by: Neil Armstrong <[email protected] >
Reviewed-by: Neil Armstrong <[email protected] >
Acked-by: Philipp Zabel <[email protected] >
Acked-by: Archit Taneja <[email protected] >
Tested-by: Philippe Cornu <[email protected] > (on stm)
Reviewed-by: Laurent Pinchart <[email protected] >
Acked-by: Shawn Guo <[email protected] >
Acked-by: Shawn Guo <[email protected] >
Acked-by: Noralf Trønnes <[email protected] >
Acked-by: Vincent Abriou <[email protected] >
2017-08-08 14:48:48 +02:00
Laurent Pinchart
64581714b5
drm: Convert atomic drivers from CRTC .disable() to .atomic_disable()
...
The CRTC .disable() helper operation is deprecated for atomic drivers,
the new .atomic_disable() helper operation being preferred. Convert all
atomic drivers to .atomic_disable() to avoid cargo-cult use of
.disable() in new drivers.
Signed-off-by: Laurent Pinchart <[email protected] >
Acked-by: Maxime Ripard <[email protected] > # for sun4i
Acked-by: Philipp Zabel <[email protected] > # for mediatek
Acked-by: Alexey Brodkin <[email protected] > # for arcpgu
Acked-by: Boris Brezillon <[email protected] > # for atmel-hlcdc
Tested-by: Philippe Cornu <[email protected] > # for stm
Acked-by: Philippe Cornu <[email protected] > # for stm
Acked-by: Vincent Abriou <[email protected] > # for sti
Reviewed-by: Thomas Hellstrom <[email protected] > # for vmwgfx
Signed-off-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-06-30 14:53:15 +02:00
Laurent Pinchart
0b20a0f8c3
drm: Add old state pointer to CRTC .enable() helper function
...
The old state is useful for drivers that need to perform operations at
enable time that depend on the transition between the old and new
states.
While at it, rename the operation to .atomic_enable() to be consistent
with .atomic_disable(), as the .enable() operation is used by atomic
helpers only.
Signed-off-by: Laurent Pinchart <[email protected] >
Acked-by: Maxime Ripard <[email protected] > # for sun4i
Acked-by: Philipp Zabel <[email protected] > # for imx-drm and mediatek
Acked-by: Alexey Brodkin <[email protected] > # for arcpgu
Acked-by: Boris Brezillon <[email protected] > # for atmel-hlcdc
Acked-by: Liviu Dudau <[email protected] > # for hdlcd and mali-dp
Acked-by: Stefan Agner <[email protected] > # for fsl-dcu
Tested-by: Philippe Cornu <[email protected] > # for stm
Acked-by: Philippe Cornu <[email protected] > # for stm
Acked-by: Vincent Abriou <[email protected] > # for sti
Reviewed-by: Thomas Hellstrom <[email protected] > # for vmwgfx
Signed-off-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-06-30 14:53:14 +02:00
Laurent Pinchart
a4b10ccead
drm: Constify drm_mode_config atomic helper private pointer
...
The drm_mode_config helper private field points to a structure of
function pointers that don't need to be modified at runtime. Make it
const.
Signed-off-by: Laurent Pinchart <[email protected] >
Reviewed-by: Gabriel Krisman Bertazi <[email protected] >
Acked-by: Brian Starkey <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-02-12 12:05:23 +01:00
Ville Syrjälä
9d020467a1
drm/virtio: Call drm_helper_mode_fill_fb_struct() before drm_framebuffer_init()
...
We want framebuffers to be mostly useable already before
drm_framebuffer_init() get called, and so we will start demanding that
all the interesting format/size/etc. information be filled in before
drm_framebuffer_init(). drm_helper_mode_fill_fb_struct() will do that
for us, so let's make sure it gets called before drm_framebuffer_init().
Cc: Dave Airlie <[email protected] >
Cc: Gerd Hoffmann <[email protected] >
Signed-off-by: Ville Syrjälä <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Daniel Vetter <[email protected] >
2016-12-15 14:55:28 +02:00
Ville Syrjälä
a3f913ca98
drm: Pass 'dev' to drm_helper_mode_fill_fb_struct()
...
Pass the drm_device to drm_helper_mode_fill_fb_struct() so that we can
populate fb->dev early. Will make it easier to use the fb before we
register it.
@@
identifier fb, mode_cmd;
@@
void drm_helper_mode_fill_fb_struct(
+ struct drm_device *dev,
struct drm_framebuffer *fb,
const struct drm_mode_fb_cmd2 *mode_cmd
);
@@
identifier fb, mode_cmd;
@@
void drm_helper_mode_fill_fb_struct(
+ struct drm_device *dev,
struct drm_framebuffer *fb,
const struct drm_mode_fb_cmd2 *mode_cmd
)
{ ... }
@@
function func;
identifier dev;
expression E1, E2;
@@
func(struct drm_device *dev, ...)
{
...
drm_helper_mode_fill_fb_struct(
+ dev,
E1, E2);
...
}
@@
expression E1, E2;
@@
drm_helper_mode_fill_fb_struct(
+ dev,
E1, E2);
v2: Rerun spatch due to code changes
Signed-off-by: Ville Syrjälä <[email protected] >
Reviewed-by: Laurent Pinchart <[email protected] >
Reviewed-by: Alex Deucher <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-15 14:03:30 +02:00
Gerd Hoffmann
eed6f0eda0
virtio-gpu: fix vblank events
...
virtio-gpu sends vblank events in virtio_gpu_crtc_atomic_flush, and
because of that it must be called for disabled planes too. Ask
drm_atomic_helper_commit_planes to do that.
v2: update to use new drm_atomic_helper_commit_planes() API.
Signed-off-by: Gerd Hoffmann <[email protected] >
Signed-off-by: Gustavo Padovan <[email protected] >
Signed-off-by: Dave Airlie <[email protected] >
2016-11-03 10:14:19 +10:00
Liu Ying
2b58e98d42
drm/atomic-helper: Add NO_DISABLE_AFTER_MODESET flag support for plane commit
...
Drivers may set the NO_DISABLE_AFTER_MODESET flag in the 'flags' parameter
of the helper drm_atomic_helper_commit_planes() if the relevant display
controllers(e.g., IPUv3 for imx-drm) require to disable a CRTC's planes
when the CRTC is disabled. The helper would skip the ->atomic_disable
call for a plane if the CRTC of the old plane state needs a modesetting
operation. Of course, the drivers need to disable the planes in their CRTC
disable callbacks since no one else would do that.
Suggested-by: Daniel Vetter <[email protected] >
Cc: Philipp Zabel <[email protected] >
Cc: David Airlie <[email protected] >
Cc: Russell King <[email protected] >
Cc: Peter Senna Tschudin <[email protected] >
Cc: Lucas Stach <[email protected] >
Signed-off-by: Liu Ying <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-08-29 11:29:37 +02:00
Wei Yongjun
a9853117d8
drm/virtio: Fix non static symbol warning
...
Fixes the following sparse warning:
drivers/gpu/drm/virtio/virtgpu_display.c:349:37: warning:
symbol 'virtio_mode_config_helpers' was not declared. Should it be static?
Signed-off-by: Wei Yongjun <[email protected] >
Signed-off-by: Sean Paul <[email protected] >
2016-07-19 15:44:10 -04:00
Markus Elfring
5345a5ab51
drm/virtgpu: Delete unnecessary checks before drm_gem_object_unreference_unlocked()
...
The drm_gem_object_unreference_unlocked() function tests whether
its argument is NULL and then returns immediately.
Thus the test around the calls is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-07-18 09:11:29 +02:00
Daniel Vetter
0d841ac0ec
drm/virtio: Don't reinvent a flipping wheel
...
Now that the core helpers support nonblocking atomic commits there's
no need to invent that wheel separately (instead of fixing the bug in
the atomic implementation of virtio, as it should have been done!).
v2: Rebased on top of
commit e7cf0963f8
Author: Gerd Hoffmann <[email protected] >
Date: Tue May 31 08:50:47 2016 +0200
virtio-gpu: add atomic_commit function
Cc: Gerd Hoffmann <[email protected] >
Tested-by: Gerd Hoffmann <[email protected] >
Reviewed-by: Gerd Hoffmann <[email protected] >
Signed-off-by: Daniel Vetter <[email protected] >
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-06-14 16:32:47 +02:00