Use no_vblank property for drivers without VBLANK
Subsystems (12)
Thomas Zimmermann
maintainerv5 cover Use no_vblank property for drivers without VBLANK
Instead of faking VBLANK events by themselves, drivers without VBLANK support can enable drm_crtc_vblank.no_vblank and let DRM do the rest. The patchset makes this official and converts over drivers.
The current implementation looks at state of a device wrt vblanking. If vblanking has been initialized for the device, the driver is responsible for sending out VBLANK events. Otherwise, DRM will send out the event. The behaviour is selected by initializing no_vblank as part of drm_atomic_helper_check_modeset().
I went through all drivers, looking for those that call send out VBLANK events but do not call drm_vblank_init(). These are converted to the new semantics. This affects tiny drivers; drivers for virtual hardware; and a few others, which do not support interrupts. Xen comes with its own VBLANK logic and now disables no_vblank explicitly.
v5:
* documentation updates in DRM core and xen (Daniel, Emil, Oleksandr)
v4:
* replaced drm_crtc_has_vblank() with drm_dev_has_vblank() (Daniel)
* squashed patches 1 and 2
* moved driver updates into separate patches
v3:
* reorder and squash patches
* set no_vblank in drm_atomic_helper_check_modeset() for *all* drivers (Daniel)
* convert all drivers to new semnatics as necessary
v2:
* document functionality (Daniel)
* cleanup ast (Daniel)
* let simple-kms handle no_vblank where possible
Thomas Zimmermann (15):
drm: Initialize struct drm_crtc_state.no_vblank from device settings drm/arc: Remove sending of vblank event
drm/ast: Don't set struct drm_crtc_state.no_vblank explictly drm/bochs: Remove sending of vblank event
drm/cirrus: Remove sending of vblank event
drm/gm12u320: Remove sending of vblank event
drm/ili9225: Remove sending of vblank event
drm/mipi-dbi: Remove sending of vblank event
drm/qxl: Remove sending of vblank event
drm/repaper: Remove sending of vblank event
drm/st7586: Remove sending of vblank event
drm/udl: Don't set struct drm_crtc_state.no_vblank explictly drm/vboxvideo: Remove sending of vblank event
drm/virtio: Remove sending of vblank event
drm/xen: Explicitly disable automatic sending of vblank event
drivers/gpu/drm/arc/arcpgu_crtc.c | 16 ----------- drivers/gpu/drm/ast/ast_mode.c | 2 -- drivers/gpu/drm/bochs/bochs_kms.c | 9 ------- drivers/gpu/drm/cirrus/cirrus.c | 8 ------ drivers/gpu/drm/drm_atomic_helper.c | 10 ++++++- drivers/gpu/drm/drm_mipi_dbi.c | 9 ------- drivers/gpu/drm/drm_vblank.c | 28 +++++++++++++++++++ drivers/gpu/drm/qxl/qxl_display.c | 14 ---------- drivers/gpu/drm/tiny/gm12u320.c | 9 ------- drivers/gpu/drm/tiny/ili9225.c | 9 ------- drivers/gpu/drm/tiny/repaper.c | 9 ------- drivers/gpu/drm/tiny/st7586.c | 9 ------- drivers/gpu/drm/udl/udl_modeset.c | 11 -------- drivers/gpu/drm/vboxvideo/vbox_mode.c | 12 --------- drivers/gpu/drm/virtio/virtgpu_display.c | 8 ------ drivers/gpu/drm/xen/xen_drm_front_kms.c | 19 +++++++++++++ include/drm/drm_crtc.h | 34 +++++++++++++++++++----- include/drm/drm_simple_kms_helper.h | 7 +++-- include/drm/drm_vblank.h | 1 + 19 files changed, 89 insertions(+), 135 deletions(-)
--
2.25.0
Thomas Zimmermann
maintainerPATCH v5 1/15 drm: Initialize struct drm_crtc_state.no_vblank from device settings
At the end of a commit, atomic helpers can generate a fake VBLANK event automatically. Originally implemented for writeback connectors, the functionality can be used by any driver and/or hardware without proper VBLANK interrupt.
The patch updates the documentation to make this behaviour official:
settings struct drm_crtc_state.no_vblank to true enables automatic generation of fake VBLANK events.
The new interface drm_dev_has_vblank() returns true if vblanking has been initialized for a device, or false otherwise. Atomic helpers use this function when initializing no_vblank in the CRTC state in drm_atomic_helper_check_modeset(). If vblanking has been initialized for a device, no_blank is disabled. Otherwise it's enabled. Hence, atomic helpers will automatically send out fake VBLANK events with any driver that did not initialize vblanking.
v5:
* more precise documentation and commit message
v4:
* replace drm_crtc_has_vblank() with drm_dev_has_vblank()
* add drm_dev_has_vblank() in this patch
* move driver changes into separate patches
v3:
* squash all related changes patches into this patch
--- drivers/gpu/drm/drm_atomic_helper.c | 10 ++++++++- drivers/gpu/drm/drm_vblank.c | 28 ++++++++++++++++++++++++ include/drm/drm_crtc.h | 34 +++++++++++++++++++++++------ include/drm/drm_simple_kms_helper.h | 7 ++++-- include/drm/drm_vblank.h | 1 + 5 files changed, 70 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +9 -1
@@ -583,6 +583,7 @@ mode_valid(struct drm_atomic_state *state)* &drm_crtc_state.connectors_changed is set when a connector is added or * removed from the CRTC. &drm_crtc_state.active_changed is set when * &drm_crtc_state.active changes, which is used for DPMS. +* &drm_crtc_state.no_vblank is set from the result of drm_dev_has_vblank(). * See also: drm_atomic_crtc_needs_modeset() * * IMPORTANT:
@@ -649,6 +650,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,return -EINVAL ; } + +if (drm_dev_has_vblank (dev)) + new_crtc_state->no_vblank = false; +else + new_crtc_state->no_vblank = true; } ret =handle_conflicting_encoders (state, false);
@@ -2215,7 +2221,9 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies);* when a job is queued, and any change to the pipeline that does not touch the * connector is leading to timeouts when calling * drm_atomic_helper_wait_for_vblanks() or -* drm_atomic_helper_wait_for_flip_done(). +* drm_atomic_helper_wait_for_flip_done(). In addition to writeback +* connectors, this function can also fake VBLANK events for CRTCs without +* VBLANK interrupt. * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview.
drivers/gpu/drm/drm_vblank.c +28 -0
@@ -69,6 +69,12 @@* &drm_driver.max_vblank_count. In that case the vblank core only disables the * vblanks after a timer has expired, which can be configured through the * ``vblankoffdelay`` module parameter. +* +* Drivers for hardware without support for vertical-blanking interrupts +* must not call drm_vblank_init(). For such drivers, atomic helpers will +* automatically generate fake vblank events as part of the display update. +* This functionality also can be controlled by the driver by enabling and +* disabling struct drm_crtc_state.no_vblank. */ /* Retry timestamp calculation up to 3 times to satisfy
@@ -501,6 +507,28 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs) }EXPORT_SYMBOL (drm_vblank_init); +/** +* drm_dev_has_vblank - test if vblanking has been initialized for +* a device +* @dev: the device +* +* Drivers may call this function to test if vblank support is +* initialized for a device. For most hardware this means that vblanking +* can also be enabled. +* +* Atomic helpers use this function to initialize +* &drm_crtc_state.no_vblank. See also drm_atomic_helper_check_modeset(). +* +* Returns: +* True if vblanking has been initialized for the given device, false +* otherwise. +*/ +bool drm_dev_has_vblank (const struct drm_device *dev) +{ +return dev->num_crtcs !=0 ; +} +EXPORT_SYMBOL (drm_dev_has_vblank); +/** * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC * @crtc: which CRTC's vblank waitqueue to retrieve
include/drm/drm_crtc.h +27 -7
@@ -174,12 +174,25 @@ struct drm_crtc_state {* @no_vblank: * * Reflects the ability of a CRTC to send VBLANK events. This state -* usually depends on the pipeline configuration, and the main usuage -* is CRTCs feeding a writeback connector operating in oneshot mode. -* In this case the VBLANK event is only generated when a job is queued -* to the writeback connector, and we want the core to fake VBLANK -* events when this part of the pipeline hasn't changed but others had -* or when the CRTC and connectors are being disabled. +* usually depends on the pipeline configuration. If set to true, DRM +* atomic helpers will send out a fake VBLANK event during display +* updates after all hardware changes have been committed. This is +* implemented in drm_atomic_helper_fake_vblank(). +* +* One usage is for drivers and/or hardware without support for VBLANK +* interrupts. Such drivers typically do not initialize vblanking +* (i.e., call drm_vblank_init() with the number of CRTCs). For CRTCs +* without initialized vblanking, this field is set to true in +* drm_atomic_helper_check_modeset(), and a fake VBLANK event will be +* send out on each update of the display pipeline by +* drm_atomic_helper_fake_vblank(). +* +* Another usage is CRTCs feeding a writeback connector operating in +* oneshot mode. In this case the fake VBLANK event is only generated +* when a job is queued to the writeback connector, and we want the +* core to fake VBLANK events when this part of the pipeline hasn't +* changed but others had or when the CRTC and connectors are being +* disabled. * * __drm_atomic_helper_crtc_duplicate_state() will not reset the value * from the current state, the CRTC driver is then responsible for
@@ -335,7 +348,14 @@ struct drm_crtc_state {* - Events for disabled CRTCs are not allowed, and drivers can ignore * that case. * -* This can be handled by the drm_crtc_send_vblank_event() function, +* For very simple hardware without VBLANK interrupt, enabling +* &struct drm_crtc_state.no_vblank makes DRM's atomic commit helpers +* send a fake VBLANK event at the end of the display update after all +* hardware changes have been applied. See +* drm_atomic_helper_fake_vblank(). +* +* For more complex hardware this +* can be handled by the drm_crtc_send_vblank_event() function, * which the driver should call on the provided event upon completion of * the atomic commit. Note that if the driver supports vblank signalling * and timestamping the vblank counters and timestamps must agree with
include/drm/drm_simple_kms_helper.h +5 -2
@@ -100,8 +100,11 @@ struct drm_simple_display_pipe_funcs {* This is the function drivers should submit the * &drm_pending_vblank_event from. Using either * drm_crtc_arm_vblank_event(), when the driver supports vblank -* interrupt handling, or drm_crtc_send_vblank_event() directly in case -* the hardware lacks vblank support entirely. +* interrupt handling, or drm_crtc_send_vblank_event() for more +* complex case. In case the hardware lacks vblank support entirely, +* drivers can set &struct drm_crtc_state.no_vblank in +* &struct drm_simple_display_pipe_funcs.check and let DRM's +* atomic helper fake a vblank event. */ void (*update)(struct drm_simple_display_pipe *pipe,struct drm_plane_state *old_plane_state);
include/drm/drm_vblank.h +1 -0
@@ -206,6 +206,7 @@ struct drm_vblank_crtc { };int drm_vblank_init (struct drm_device *dev,unsigned int num_crtcs); +bool drm_dev_has_vblank (const struct drm_device *dev);u64 drm_crtc_vblank_count (struct drm_crtc *crtc);u64 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc,ktime_t *vblanktime);
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 2/15 drm/arc: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/arc/arcpgu_crtc.c | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/gpu/drm/arc/arcpgu_crtc.c +0 -16
@@ -9,7 +9,6 @@#include <drm/drm_device.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> -#include <drm/drm_vblank.h> #include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> #include <linux/clk.h>
@@ -138,24 +137,9 @@ static void arc_pgu_crtc_atomic_disable(struct drm_crtc *crtc, ~ARCPGU_CTRL_ENABLE_MASK); } -static void arc_pgu_crtc_atomic_begin (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -struct drm_pending_vblank_event *event = crtc->state->event; - -if (event) { - crtc->state->event =NULL ; - -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, event); -spin_unlock_irq (&crtc->dev->event_lock); - } -} -static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = { .mode_valid = arc_pgu_crtc_mode_valid, .mode_set_nofb = arc_pgu_crtc_mode_set_nofb, - .atomic_begin = arc_pgu_crtc_atomic_begin, .atomic_enable = arc_pgu_crtc_atomic_enable, .atomic_disable = arc_pgu_crtc_atomic_disable, };
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 3/15 drm/ast: Don't set struct drm_crtc_state.no_vblank explictly
In reply to Thomas ZimmermannAs ast does not initialize vblanking, atomic helpers initialize the value of struct drm_crtc_state.no_vblank to be true. No need to set it from within the driver.
--- drivers/gpu/drm/ast/ast_mode.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +0 -2
@@ -833,8 +833,6 @@ static void ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,struct ast_vbios_mode_info *vbios_mode_info;struct drm_display_mode *adjusted_mode; - crtc->state->no_vblank = true; - ast_state =to_ast_crtc_state (crtc->state); format = ast_state->format;
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 4/15 drm/bochs: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/bochs/bochs_kms.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/bochs/bochs_kms.c +0 -9
@@ -7,7 +7,6 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_vblank.h> #include "bochs.h"
@@ -57,16 +56,8 @@ static void bochs_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) {struct bochs_device *bochs = pipe->crtc.dev->dev_private; -struct drm_crtc *crtc = &pipe->crtc;bochs_plane_update (bochs, pipe->plane.state); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); - crtc->state->event =NULL ; -spin_unlock_irq (&crtc->dev->event_lock); - } }static const struct drm_simple_display_pipe_funcs bochs_pipe_funcs = {
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 5/15 drm/cirrus: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/cirrus/cirrus.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/cirrus/cirrus.c +0 -8
@@ -38,7 +38,6 @@#include <drm/drm_modeset_helper_vtables.h> #include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h> -#include <drm/drm_vblank.h> #define DRIVER_NAME "cirrus"#define DRIVER_DESC "qemu cirrus vga"
@@ -434,13 +433,6 @@ static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe,if (drm_atomic_helper_damage_merged (old_state, state, &rect))cirrus_fb_blit_rect (pipe->plane.state->fb, &rect); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); - crtc->state->event =NULL ; -spin_unlock_irq (&crtc->dev->event_lock); - } }static const struct drm_simple_display_pipe_funcs cirrus_pipe_funcs = {
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 6/15 drm/gm12u320: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/tiny/gm12u320.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/tiny/gm12u320.c +0 -9
@@ -22,7 +22,6 @@#include <drm/drm_modeset_helper_vtables.h> #include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h> -#include <drm/drm_vblank.h> static bool eco_mode;module_param (eco_mode, bool,0644 );
@@ -610,18 +609,10 @@ static void gm12u320_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) {struct drm_plane_state *state = pipe->plane.state; -struct drm_crtc *crtc = &pipe->crtc;struct drm_rect rect;if (drm_atomic_helper_damage_merged (old_state, state, &rect))gm12u320_fb_mark_dirty (pipe->plane.state->fb, &rect); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); - crtc->state->event =NULL ; -spin_unlock_irq (&crtc->dev->event_lock); - } }static const struct drm_simple_display_pipe_funcs gm12u320_pipe_funcs = {
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 7/15 drm/ili9225: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/tiny/ili9225.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/tiny/ili9225.c +0 -9
@@ -26,7 +26,6 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_mipi_dbi.h> #include <drm/drm_rect.h> -#include <drm/drm_vblank.h> #define ILI9225_DRIVER_READ_CODE 0x00#define ILI9225_DRIVER_OUTPUT_CONTROL 0x01
@@ -165,18 +164,10 @@ static void ili9225_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) {struct drm_plane_state *state = pipe->plane.state; -struct drm_crtc *crtc = &pipe->crtc;struct drm_rect rect;if (drm_atomic_helper_damage_merged (old_state, state, &rect))ili9225_fb_dirty (state->fb, &rect); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); -spin_unlock_irq (&crtc->dev->event_lock); - crtc->state->event =NULL ; - } } static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 8/15 drm/mipi-dbi: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/drm_mipi_dbi.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/drm_mipi_dbi.c +0 -9
@@ -24,7 +24,6 @@#include <drm/drm_modes.h> #include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> -#include <drm/drm_vblank.h> #include <video/mipi_display.h> #define MIPI_DBI_MAX_SPI_READ_SPEED 2000000/* 2MHz */
@@ -312,18 +311,10 @@ void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) {struct drm_plane_state *state = pipe->plane.state; -struct drm_crtc *crtc = &pipe->crtc;struct drm_rect rect;if (drm_atomic_helper_damage_merged (old_state, state, &rect))mipi_dbi_fb_dirty (state->fb, &rect); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); -spin_unlock_irq (&crtc->dev->event_lock); - crtc->state->event =NULL ; - } }EXPORT_SYMBOL (mipi_dbi_pipe_update);
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 9/15 drm/qxl: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/qxl/qxl_display.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +0 -14
@@ -31,7 +31,6 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_vblank.h> #include "qxl_drv.h" #include "qxl_object.h"
@@ -372,19 +371,6 @@ static void qxl_crtc_update_monitors_config(struct drm_crtc *crtc,static void qxl_crtc_atomic_flush (struct drm_crtc *crtc,struct drm_crtc_state *old_crtc_state) { -struct drm_device *dev = crtc->dev; -struct drm_pending_vblank_event *event; -unsigned long flags; - -if (crtc->state && crtc->state->event) { - event = crtc->state->event; - crtc->state->event =NULL ; - -spin_lock_irqsave (&dev->event_lock, flags); -drm_crtc_send_vblank_event (crtc, event); -spin_unlock_irqrestore (&dev->event_lock, flags); - } -qxl_crtc_update_monitors_config (crtc,"flush" ); }
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 10/15 drm/repaper: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/tiny/repaper.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/tiny/repaper.c +0 -9
@@ -33,7 +33,6 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_modes.h> #include <drm/drm_rect.h> -#include <drm/drm_vblank.h> #include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h>
@@ -856,18 +855,10 @@ static void repaper_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) {struct drm_plane_state *state = pipe->plane.state; -struct drm_crtc *crtc = &pipe->crtc;struct drm_rect rect;if (drm_atomic_helper_damage_merged (old_state, state, &rect))repaper_fb_dirty (state->fb); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); -spin_unlock_irq (&crtc->dev->event_lock); - crtc->state->event =NULL ; - } }static const struct drm_simple_display_pipe_funcs repaper_pipe_funcs = {
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 11/15 drm/st7586: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/tiny/st7586.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/tiny/st7586.c +0 -9
@@ -23,7 +23,6 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_mipi_dbi.h> #include <drm/drm_rect.h> -#include <drm/drm_vblank.h> /* controller-specific commands */ #define ST7586_DISP_MODE_GRAY 0x38
@@ -159,18 +158,10 @@ static void st7586_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) {struct drm_plane_state *state = pipe->plane.state; -struct drm_crtc *crtc = &pipe->crtc;struct drm_rect rect;if (drm_atomic_helper_damage_merged (old_state, state, &rect))st7586_fb_dirty (state->fb, &rect); - -if (crtc->state->event) { -spin_lock_irq (&crtc->dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); -spin_unlock_irq (&crtc->dev->event_lock); - crtc->state->event =NULL ; - } } static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 12/15 drm/udl: Don't set struct drm_crtc_state.no_vblank explictly
In reply to Thomas ZimmermannAs udl does not initialize vblanking, atomic helpers initialize the value of struct drm_crtc_state.no_vblank to be true. No need to set it from within the driver.
--- drivers/gpu/drm/udl/udl_modeset.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/gpu/drm/udl/udl_modeset.c +0 -11
@@ -375,8 +375,6 @@ udl_simple_display_pipe_enable(struct drm_simple_display_pipe *pipe,char *wrptr;int color_depth =UDL_COLOR_DEPTH_16BPP ; - crtc_state->no_vblank = true; - buf = (char *)udl->mode_buf;/* This first section has to do with setting the base address on the
@@ -428,14 +426,6 @@ udl_simple_display_pipe_disable(struct drm_simple_display_pipe *pipe)udl_submit_urb (dev, urb, buf - (char *)urb->transfer_buffer); } -static int -udl_simple_display_pipe_check (struct drm_simple_display_pipe *pipe, -struct drm_plane_state *plane_state, -struct drm_crtc_state *crtc_state) -{ -return 0 ; -} -static void udl_simple_display_pipe_update (struct drm_simple_display_pipe *pipe,struct drm_plane_state *old_plane_state)
@@ -457,7 +447,6 @@ struct drm_simple_display_pipe_funcs udl_simple_display_pipe_funcs = { .mode_valid = udl_simple_display_pipe_mode_valid, .enable = udl_simple_display_pipe_enable, .disable = udl_simple_display_pipe_disable, - .check = udl_simple_display_pipe_check, .update = udl_simple_display_pipe_update, .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb, };
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 13/15 drm/vboxvideo: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/vboxvideo/vbox_mode.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/gpu/drm/vboxvideo/vbox_mode.c +0 -12
@@ -18,7 +18,6 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_vblank.h> #include "hgsmi_channels.h" #include "vbox_drv.h"
@@ -226,17 +225,6 @@ static void vbox_crtc_atomic_disable(struct drm_crtc *crtc,static void vbox_crtc_atomic_flush (struct drm_crtc *crtc,struct drm_crtc_state *old_crtc_state) { -struct drm_pending_vblank_event *event; -unsigned long flags; - -if (crtc->state && crtc->state->event) { - event = crtc->state->event; - crtc->state->event =NULL ; - -spin_lock_irqsave (&crtc->dev->event_lock, flags); -drm_crtc_send_vblank_event (crtc, event); -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); - } }static const struct drm_crtc_helper_funcs vbox_crtc_helper_funcs = {
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 14/15 drm/virtio: Remove sending of vblank event
In reply to Thomas ZimmermannThe 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
--- drivers/gpu/drm/virtio/virtgpu_display.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +0 -8
@@ -30,7 +30,6 @@#include <drm/drm_fourcc.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_vblank.h> #include "virtgpu_drv.h"
@@ -121,13 +120,6 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,static void virtio_gpu_crtc_atomic_flush (struct drm_crtc *crtc,struct drm_crtc_state *old_state) { -unsigned long flags; - -spin_lock_irqsave (&crtc->dev->event_lock, flags); -if (crtc->state->event) -drm_crtc_send_vblank_event (crtc, crtc->state->event); - crtc->state->event =NULL ; -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); }static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
Signature · 1 line
2.25.0
Thomas Zimmermann
maintainerPATCH v5 15/15 drm/xen: Explicitly disable automatic sending of vblank event
In reply to Thomas ZimmermannThe atomic helpers automatically send out fake VBLANK events if no vblanking has been initialized. This would apply to xen, but xen has its own vblank logic. To avoid interfering with the atomic helpers, disable automatic vblank events explicitly.
v5:
* update comment
v4:
* separate commit from core vblank changes
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/xen/xen_drm_front_kms.c +19 -0
@@ -220,6 +220,24 @@ static bool display_send_page_flip(struct drm_simple_display_pipe *pipe,return false; } +static int display_check (struct drm_simple_display_pipe *pipe, +struct drm_plane_state *plane_state, +struct drm_crtc_state *crtc_state) +{ +/* +* Xen doesn't initialize vblanking via drm_vblank_init(), so +* DRM helpers assume that it doesn't handle vblanking and start +* sending out fake VBLANK events automatically. +* +* As xen contains it's own logic for sending out VBLANK events +* in send_pending_event(), disable no_vblank (i.e., the xen +* driver has vblanking support). +*/ + crtc_state->no_vblank = false; + +return 0 ; +} +static void display_update (struct drm_simple_display_pipe *pipe,struct drm_plane_state *old_plane_state) {
@@ -284,6 +302,7 @@ static const struct drm_simple_display_pipe_funcs display_funcs = { .enable = display_enable, .disable = display_disable, .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb, + .check = display_check, .update = display_update, };
Signature · 1 line
2.25.0
Re: [PATCH v5 15/15] drm/xen: Explicitly disable automatic sending of vblank event
Quoted 5 lines · Thomas Zimmermann
The atomic helpers automatically send out fake VBLANK events if no vblanking has been initialized. This would apply to xen, but xen has its own vblank logic. To avoid interfering with the atomic helpers, disable automatic vblank events explicitly.
Quoted 8 lines
v5:
* update comment
v4:
* separate commit from core vblank changesSigned-off-by Thomas Zimmermann <[email protected]>Acked-by Gerd Hoffmann <[email protected]>Reviewed-by Daniel Vetter <[email protected]>
Thank you for your work,
Quoted 34 lines
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/xen/xen_drm_front_kms.c +18
-0@@ -220,6 +220,24 @@ static bool display_send_page_flip(struct drm_simple_display_pipe *pipe,return false; } +static int display_check (struct drm_simple_display_pipe *pipe, +struct drm_plane_state *plane_state, +struct drm_crtc_state *crtc_state) +{ +/* +* Xen doesn't initialize vblanking via drm_vblank_init(), so +* DRM helpers assume that it doesn't handle vblanking and start +* sending out fake VBLANK events automatically. +* +* As xen contains it's own logic for sending out VBLANK events +* in send_pending_event(), disable no_vblank (i.e., the xen +* driver has vblanking support). +*/ + crtc_state->no_vblank = false; + +return 0 ; +} +static void display_update (struct drm_simple_display_pipe *pipe,struct drm_plane_state *old_plane_state) {
drivers/gpu/drm/xen/xen_drm_front_kms.c static const struct drm_simple_display_pipe_funcs display_funcs = { · line 308
Quoted 7 lines
drivers/gpu/drm/xen/xen_drm_front_kms.c +1
-0@@ -284,6 +302,7 @@ static const struct drm_simple_display_pipe_funcs display_funcs = { .enable = display_enable, .disable = display_disable, .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb, + .check = display_check, .update = display_update, };
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel