omapdrm: fences and zpos
Subsystems (3)
cover omapdrm: fences and zpos
Hello,
This patch series contains two completely unrelated features that just happen to have been developed one right after the other.
Patches 1/5 to 3/5 implement explicit fences support. The first patch fixes event handling in the omapdrm driver as required by the atomic commit helper (and the DRM atomic update API). The second patch replace the hand-rolled atomic commit handler with the DRM core atomic commit helper, bringing fences support as a bonus. The third patch then removes the omapdrm custom sync support that has no user in the mainline kernel.
Patches 4/5 and 5/5 clean up zpos handling by switching to the standard zpos property implemented in the DRM core. The omapdrm-specific zorder property is kept for backward compatibility as an alias and should be removed later after a long enough grace period for userspace to be updated.
As fence support is implemented completely inside the atomic commit helper I have only tested it lightly using the sw-sync driver. No issue has been noticed.
The patches are based on top of my previous omapdrm series that has been fully acked and should thus be merged in v4.11. It also requires the "drm: Constify drm_mode_config atomic helper private pointer" patch that I have sent to the dri-devel mailing list today.
Laurent Pinchart (5):
drm: omapdrm: Handle events when enabling/disabling CRTCs
drm: omapdrm: Use DRM core's atomic commit helper
drm: omapdrm: Remove legacy buffer synchronization support
drm: omapdrm: Store the Z order in the plane state zpos field
drm: omapdrm: Add zpos property
drivers/gpu/drm/omapdrm/omap_crtc.c | 30 +++-- drivers/gpu/drm/omapdrm/omap_drv.c | 163 ++++---------------------- drivers/gpu/drm/omapdrm/omap_drv.h | 14 +-- drivers/gpu/drm/omapdrm/omap_gem.c | 215 ----------------------------------- drivers/gpu/drm/omapdrm/omap_plane.c | 74 ++---------- include/uapi/drm/omap_drm.h | 4 +- 6 files changed, 55 insertions(+), 445 deletions(-)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 drm: omapdrm: Handle events when enabling/disabling CRTCs
The driver currently handles vblank events only when updating planes on an already enabled CRTC. The atomic update API however allows requesting an event when enabling or disabling a CRTC. This currently leads to event objects being leaked in the kernel and to events not being sent out. Fix it.
--- drivers/gpu/drm/omapdrm/omap_crtc.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/gpu/drm/omapdrm/omap_crtc.c +22 -8
@@ -328,6 +328,19 @@ static void omap_crtc_destroy(struct drm_crtc *crtc)kfree (omap_crtc); } +static void omap_crtc_arm_event (struct drm_crtc *crtc) +{ +struct omap_crtc *omap_crtc =to_omap_crtc (crtc); + +WARN_ON (omap_crtc->pending); + omap_crtc->pending = true; + +if (crtc->state->event) { + omap_crtc->event = crtc->state->event; + crtc->state->event =NULL ; + } +} +static void omap_crtc_enable (struct drm_crtc *crtc) {struct omap_crtc *omap_crtc =to_omap_crtc (crtc);
@@ -340,8 +353,7 @@ static void omap_crtc_enable(struct drm_crtc *crtc) ret =drm_crtc_vblank_get (crtc);WARN_ON (ret !=0 ); -WARN_ON (omap_crtc->pending); - omap_crtc->pending = true; +omap_crtc_arm_event (crtc);spin_unlock_irq (&crtc->dev->event_lock); }
@@ -351,6 +363,13 @@ static void omap_crtc_disable(struct drm_crtc *crtc)DBG ("%s" , omap_crtc->name); +spin_lock_irq (&crtc->dev->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&crtc->dev->event_lock); +drm_crtc_vblank_off (crtc); }
@@ -427,12 +446,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,spin_lock_irq (&crtc->dev->event_lock);dispc_mgr_go (omap_crtc->channel); - -WARN_ON (omap_crtc->pending); - omap_crtc->pending = true; - -if (crtc->state->event) - omap_crtc->event = crtc->state->event; +omap_crtc_arm_event (crtc);spin_unlock_irq (&crtc->dev->event_lock); }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs
Hi,
Quoted 12 lines · Laurent Pinchart
The driver currently handles vblank events only when updating planes on an already enabled CRTC. The atomic update API however allows requesting an event when enabling or disabling a CRTC. This currently leads to event objects being leaked in the kernel and to events not being sent out. Fix it.
Signed-off-by Laurent Pinchart <[email protected]>---
drivers/gpu/drm/omapdrm/omap_crtc.c +0
-0@@ -351,6 +363,13 @@ static void omap_crtc_disable(struct drm_crtc *crtc)DBG ("%s" , omap_crtc->name);
drivers/gpu/drm/omapdrm/omap_crtc.c static void omap_crtc_disable(struct drm_crtc *crtc) · line 374
Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_crtc.c +7
-0+spin_lock_irq (&crtc->dev->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&crtc->dev->event_lock); +drm_crtc_vblank_off (crtc); }
Hmm... How does this go... omap_crtc_dss_disable(), which is called via the encoder's disable, is synchronous and waits until the output has been disabled. Is omap_crtc_disable() called before or after that? If before, we're sending the event too soon.
We need to fix the enable/disable call chains =).
Tomi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs
Hi Tomi,
Quoted 14 lines · On Tuesday 03 Jan 2017 12:07:25 Tomi Valkeinen wrote:
Quoted 13 lines · Laurent Pinchart
The driver currently handles vblank events only when updating planes on an already enabled CRTC. The atomic update API however allows requesting an event when enabling or disabling a CRTC. This currently leads to event objects being leaked in the kernel and to events not being sent out. Fix it.
Signed-off-by Laurent Pinchart <[email protected]>---
drivers/gpu/drm/omapdrm/omap_crtc.c +0
-0@@ -351,6 +363,13 @@ static void omap_crtc_disable(struct drm_crtc *crtc)DBG ("%s" , omap_crtc->name);
Quoted 14 lines
drivers/gpu/drm/omapdrm/omap_crtc.c static void omap_crtc_disable(struct drm_crtc *crtc) · line 374
Quoted 9 lines
drivers/gpu/drm/omapdrm/omap_crtc.c +7
-0+spin_lock_irq (&crtc->dev->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&crtc->dev->event_lock); +drm_crtc_vblank_off (crtc); }Hmm... How does this go...
omap_crtc_dss_disable(), which is called via the encoder's disable, is synchronous and waits until the output has been disabled. Isomap_crtc_disable()called before or after that? If before, we're sending the event too soon.
Fortunately CRTCs are disabled after encoders, I've checked that before sending the patch.
Quoted 1 line
We need to fix the enable/disable call chains =).
Yksi asia kerrallaan :-)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm: omapdrm: Use DRM core's atomic commit helper
In reply to Laurent PinchartThe DRM core atomic helper now supports asynchronous commits natively. The custom omapdrm implementation isn't needed anymore, remove it.
--- drivers/gpu/drm/omapdrm/omap_drv.c | 113 +++++-------------------------------- drivers/gpu/drm/omapdrm/omap_drv.h | 9 +-- 2 files changed, 15 insertions(+), 107 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +14 -99
@@ -17,8 +17,6 @@* this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/wait.h> -#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h>
@@ -59,13 +57,6 @@ static void omap_fb_output_poll_changed(struct drm_device *dev)drm_fb_helper_hotplug_event (priv->fbdev); } -struct omap_atomic_state_commit { -struct work_struct work; -struct drm_device *dev; -struct drm_atomic_state *state; -u32 crtcs; -}; -static void omap_atomic_wait_for_completion (struct drm_device *dev,struct drm_atomic_state *old_state) {
@@ -86,115 +77,40 @@ static void omap_atomic_wait_for_completion(struct drm_device *dev, } } -static void omap_atomic_complete (struct omap_atomic_state_commit *commit) +static void omap_atomic_commit_tail (struct drm_atomic_state *old_state) { -struct drm_device *dev = commit->dev; -struct omap_drm_private *priv = dev->dev_private; -struct drm_atomic_state *old_state = commit->state; +struct drm_device *dev = old_state->dev; -/* Apply the atomic update. */ dispc_runtime_get (); +/* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables (dev, old_state);drm_atomic_helper_commit_planes (dev, old_state,DRM_PLANE_COMMIT_ACTIVE_ONLY );drm_atomic_helper_commit_modeset_enables (dev, old_state); +drm_atomic_helper_commit_hw_done (old_state); + +/* +* Wait for completion of the page flips to ensure that old buffers +* can't be touched by the hardware anymore before cleaning up planes. +*/ omap_atomic_wait_for_completion (dev, old_state);drm_atomic_helper_cleanup_planes (dev, old_state);dispc_runtime_put (); - -drm_atomic_state_put (old_state); - -/* Complete the commit, wake up any waiter. */ -spin_lock (&priv->commit.lock); - priv->commit.pending &= ~commit->crtcs; -spin_unlock (&priv->commit.lock); - -wake_up_all (&priv->commit.wait); - -kfree (commit); -} - -static void omap_atomic_work (struct work_struct *work) -{ -struct omap_atomic_state_commit *commit = - container_of(work, struct omap_atomic_state_commit, work); - -omap_atomic_complete (commit); -} - -static bool omap_atomic_is_pending (struct omap_drm_private *priv, -struct omap_atomic_state_commit *commit) -{ -bool pending; - -spin_lock (&priv->commit.lock); - pending = priv->commit.pending & commit->crtcs; -spin_unlock (&priv->commit.lock); - -return pending; } -static int omap_atomic_commit (struct drm_device *dev, -struct drm_atomic_state *state,bool nonblock) -{ -struct omap_drm_private *priv = dev->dev_private; -struct omap_atomic_state_commit *commit; -struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; -int i, ret; - - ret =drm_atomic_helper_prepare_planes (dev, state); -if (ret) -return ret; - -/* Allocate the commit object. */ - commit =kzalloc (sizeof (*commit),GFP_KERNEL ); -if (commit ==NULL ) { - ret = -ENOMEM ; - goto error; - } - -INIT_WORK (&commit->work, omap_atomic_work); - commit->dev = dev; - commit->state = state; - -/* Wait until all affected CRTCs have completed previous commits and -* mark them as pending. -*/ -for_each_crtc_in_state (state, crtc, crtc_state, i) - commit->crtcs |=drm_crtc_mask (crtc); - -wait_event (priv->commit.wait, !omap_atomic_is_pending (priv, commit)); - -spin_lock (&priv->commit.lock); - priv->commit.pending |= commit->crtcs; -spin_unlock (&priv->commit.lock); - -/* Swap the state, this is the point of no return. */ -drm_atomic_helper_swap_state (state, true); - -drm_atomic_state_get (state); -if (nonblock) -schedule_work (&commit->work); -else -omap_atomic_complete (commit); - -return 0 ; - -error: -drm_atomic_helper_cleanup_planes (dev, state); -return ret; -} +static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = { + .atomic_commit_tail = omap_atomic_commit_tail, +};static const struct drm_mode_config_funcs omap_mode_config_funcs = { .fb_create = omap_framebuffer_create, .output_poll_changed = omap_fb_output_poll_changed, .atomic_check = drm_atomic_helper_check, - .atomic_commit = omap_atomic_commit, + .atomic_commit = drm_atomic_helper_commit, };static int get_connector_type (struct omap_dss_device *dssdev)
@@ -485,6 +401,7 @@ static int omap_modeset_init(struct drm_device *dev) dev->mode_config.max_height =2048 ; dev->mode_config.funcs = &omap_mode_config_funcs; + dev->mode_config.helper_private = &omap_mode_config_helper_funcs;drm_mode_config_reset (dev);
@@ -770,8 +687,6 @@ static int pdev_probe(struct platform_device *pdev) priv->omaprev = pdata->omaprev; priv->wq =alloc_ordered_workqueue ("omapdrm" ,0 ); -init_waitqueue_head (&priv->commit.wait); -spin_lock_init (&priv->commit.lock);spin_lock_init (&priv->list_lock);INIT_LIST_HEAD (&priv->obj_list);
drivers/gpu/drm/omapdrm/omap_drv.h +1 -8
@@ -23,7 +23,7 @@#include <linux/module.h> #include <linux/platform_data/omap_drm.h> #include <linux/types.h> -#include <linux/wait.h> +#include <linux/workqueue.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h>
@@ -91,13 +91,6 @@ struct omap_drm_private {spinlock_t wait_lock;/* protects the wait_list */ struct list_head wait_list;/* list of omap_irq_wait */ uint32_t irq_mask;/* enabled irqs in addition to wait_list */ - -/* atomic commit */ -struct { -wait_queue_head_t wait; -u32 pending; -spinlock_t lock;/* Protects commit.pending */ - } commit; };
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 drm: omapdrm: Remove legacy buffer synchronization support
In reply to Laurent PinchartThe omapdrm driver uses a custom API to synchronize with the SGX GPU. This is unusable as such in the mainline kernel as the API is only partially implemented and requires additional out-of-tree patches. Furthermore, as no SGX driver is available in the mainline kernel, the API can't be considered as a stable mainline API.
Now that the driver supports synchronization through fences, remove legacy buffer synchronization support. The two userspace ioctls are turned into no-ops to avoid breaking userspace and will be removed in the future.
--- drivers/gpu/drm/omapdrm/omap_drv.c | 50 +-------- drivers/gpu/drm/omapdrm/omap_drv.h | 5 - drivers/gpu/drm/omapdrm/omap_gem.c | 215 ------------------------------------- include/uapi/drm/omap_drm.h | 4 +- 4 files changed, 7 insertions(+), 267 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +5 -45
@@ -464,51 +464,11 @@ static int ioctl_gem_new(struct drm_device *dev, void *data, &args->handle); } -static int ioctl_gem_cpu_prep (struct drm_device *dev,void *data, +static int ioctl_gem_cpu_prep_fini (struct drm_device *dev,void *data,struct drm_file *file_priv) { -struct drm_omap_gem_cpu_prep *args = data; -struct drm_gem_object *obj; -int ret; - -VERB ("%p:%p: handle=%d, op=%x" , dev, file_priv, args->handle, args->op); - - obj =drm_gem_object_lookup (file_priv, args->handle); -if (!obj) -return -ENOENT ; - - ret =omap_gem_op_sync (obj, args->op); - -if (!ret) - ret =omap_gem_op_start (obj, args->op); - -drm_gem_object_unreference_unlocked (obj); - -return ret; -} - -static int ioctl_gem_cpu_fini (struct drm_device *dev,void *data, -struct drm_file *file_priv) -{ -struct drm_omap_gem_cpu_fini *args = data; -struct drm_gem_object *obj; -int ret; - -VERB ("%p:%p: handle=%d" , dev, file_priv, args->handle); - - obj =drm_gem_object_lookup (file_priv, args->handle); -if (!obj) -return -ENOENT ; - -/* XXX flushy, flushy */ - ret =0 ; - -if (!ret) - ret =omap_gem_op_finish (obj, args->op); - -drm_gem_object_unreference_unlocked (obj); - -return ret; +/* Deprecated, to be removed. */ +return 0 ; } static int ioctl_gem_info(struct drm_device *dev, void *data,
@@ -536,8 +496,8 @@ static const struct drm_ioctl_desc ioctls[DRM_COMMAND_END - DRM_COMMAND_BASE] =DRM_IOCTL_DEF_DRV (OMAP_GET_PARAM , ioctl_get_param,DRM_AUTH ),DRM_IOCTL_DEF_DRV (OMAP_SET_PARAM , ioctl_set_param,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (OMAP_GEM_NEW , ioctl_gem_new,DRM_AUTH ), -DRM_IOCTL_DEF_DRV (OMAP_GEM_CPU_PREP , ioctl_gem_cpu_prep,DRM_AUTH ), -DRM_IOCTL_DEF_DRV (OMAP_GEM_CPU_FINI , ioctl_gem_cpu_fini,DRM_AUTH ), +DRM_IOCTL_DEF_DRV (OMAP_GEM_CPU_PREP , ioctl_gem_cpu_prep_fini,DRM_AUTH ), +DRM_IOCTL_DEF_DRV (OMAP_GEM_CPU_FINI , ioctl_gem_cpu_prep_fini,DRM_AUTH ), DRM_IOCTL_DEF_DRV(OMAP_GEM_INFO, ioctl_gem_info, DRM_AUTH), };
drivers/gpu/drm/omapdrm/omap_drv.h +0 -5
@@ -183,11 +183,6 @@ int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma);int omap_gem_mmap_obj (struct drm_gem_object *obj,struct vm_area_struct *vma);int omap_gem_fault (struct vm_area_struct *vma,struct vm_fault *vmf); -int omap_gem_op_start (struct drm_gem_object *obj,enum omap_gem_op op); -int omap_gem_op_finish (struct drm_gem_object *obj,enum omap_gem_op op); -int omap_gem_op_sync (struct drm_gem_object *obj,enum omap_gem_op op); -int omap_gem_op_async (struct drm_gem_object *obj,enum omap_gem_op op, -void (*fxn)(void *arg),void *arg);int omap_gem_roll (struct drm_gem_object *obj,uint32_t roll);void omap_gem_cpu_sync (struct drm_gem_object *obj,int pgoff); void omap_gem_dma_sync(struct drm_gem_object *obj,
drivers/gpu/drm/omapdrm/omap_gem.c +0 -215
233 lines not on this page · raw message
include/uapi/drm/omap_drm.h +2 -2
@@ -106,8 +106,8 @@ struct drm_omap_gem_info {#define DRM_OMAP_GET_PARAM 0x00#define DRM_OMAP_SET_PARAM 0x01#define DRM_OMAP_GEM_NEW 0x03 -#define DRM_OMAP_GEM_CPU_PREP 0x04 -#define DRM_OMAP_GEM_CPU_FINI 0x05 +#define DRM_OMAP_GEM_CPU_PREP 0x04/* Deprecated, to be removed */ +#define DRM_OMAP_GEM_CPU_FINI 0x05/* Deprecated, to be removed */ #define DRM_OMAP_GEM_INFO 0x06#define DRM_OMAP_NUM_IOCTLS 0x07
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm: omapdrm: Store the Z order in the plane state zpos field
In reply to Laurent PinchartThe DRM core implements a standard "zpos" property to control planes ordering. The omapdrm driver implements a similar property named "zorder". Although we can't switch to DRM core handling of the "zpos" property for backward compatibility reasons, we can store the zorder value in the drm_plane_state zpos field, saving us from having to implement custom plane state handling.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 73 +++++------------------------------- 1 file changed, 10 insertions(+), 63 deletions(-)
drivers/gpu/drm/omapdrm/omap_plane.c +10 -63
@@ -45,18 +45,6 @@ struct omap_plane {uint32_t formats[32 ]; }; -struct omap_plane_state { -struct drm_plane_state base; - -unsigned int zorder; -}; - -static inline struct omap_plane_state * -to_omap_plane_state (struct drm_plane_state *state) -{ - return container_of(state, struct omap_plane_state, base); -} -static int omap_plane_prepare_fb (struct drm_plane *plane,struct drm_plane_state *new_state) {
@@ -78,7 +66,6 @@ static void omap_plane_atomic_update(struct drm_plane *plane, {struct omap_plane *omap_plane =to_omap_plane (plane);struct drm_plane_state *state = plane->state; -struct omap_plane_state *omap_state =to_omap_plane_state (state);struct omap_overlay_info info;struct omap_drm_window win;int ret;
@@ -90,7 +77,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane, info.rotation =OMAP_DSS_ROT_0 ; info.global_alpha =0xff ; info.mirror =0 ; - info.zorder = omap_state->zorder; + info.zorder = state->zpos;memset (&win,0 ,sizeof (win)); win.rotation = state->rotation;
@@ -142,11 +129,10 @@ static void omap_plane_atomic_update(struct drm_plane *plane,static void omap_plane_atomic_disable (struct drm_plane *plane,struct drm_plane_state *old_state) { -struct omap_plane_state *omap_state =to_omap_plane_state (plane->state);struct omap_plane *omap_plane =to_omap_plane (plane); plane->state->rotation =DRM_ROTATE_0 ; - omap_state->zorder = plane->type ==DRM_PLANE_TYPE_PRIMARY + plane->state->zpos = plane->type ==DRM_PLANE_TYPE_PRIMARY ?0 : omap_plane->id;dispc_ovl_enable (omap_plane->id, false);
@@ -231,56 +217,20 @@ void omap_plane_install_properties(struct drm_plane *plane,drm_object_attach_property (obj, priv->zorder_prop,0 ); } -static struct drm_plane_state * -omap_plane_atomic_duplicate_state (struct drm_plane *plane) -{ -struct omap_plane_state *state; -struct omap_plane_state *copy; - -if (WARN_ON (!plane->state)) -return NULL ; - - state =to_omap_plane_state (plane->state); - copy =kmemdup (state,sizeof (*state),GFP_KERNEL ); -if (copy ==NULL ) -return NULL ; - -__drm_atomic_helper_plane_duplicate_state (plane, ©->base); - -return ©->base; -} - -static void omap_plane_atomic_destroy_state (struct drm_plane *plane, -struct drm_plane_state *state) -{ -__drm_atomic_helper_plane_destroy_state (state); -kfree (to_omap_plane_state (state)); -} -static void omap_plane_reset (struct drm_plane *plane) {struct omap_plane *omap_plane =to_omap_plane (plane); -struct omap_plane_state *omap_state; - -if (plane->state) { -omap_plane_atomic_destroy_state (plane, plane->state); - plane->state =NULL ; - } - omap_state =kzalloc (sizeof (*omap_state),GFP_KERNEL ); -if (omap_state ==NULL ) +drm_atomic_helper_plane_reset (plane); +if (!plane->state)return ;/* -* Set defaults depending on whether we are a primary or overlay +* Set the zpos default depending on whether we are a primary or overlay * plane. */ - omap_state->zorder = plane->type ==DRM_PLANE_TYPE_PRIMARY + plane->state->zpos = plane->type ==DRM_PLANE_TYPE_PRIMARY ?0 : omap_plane->id; - omap_state->base.rotation =DRM_ROTATE_0 ; - - plane->state = &omap_state->base; - plane->state->plane = plane; } static int omap_plane_atomic_set_property(struct drm_plane *plane,
@@ -289,10 +239,9 @@ static int omap_plane_atomic_set_property(struct drm_plane *plane, uint64_t val) {struct omap_drm_private *priv = plane->dev->dev_private; -struct omap_plane_state *omap_state =to_omap_plane_state (state);if (property == priv->zorder_prop) - omap_state->zorder = val; + state->zpos = val;else return -EINVAL ;
@@ -305,11 +254,9 @@ static int omap_plane_atomic_get_property(struct drm_plane *plane, uint64_t *val) {struct omap_drm_private *priv = plane->dev->dev_private; -const struct omap_plane_state *omap_state = - container_of(state, const struct omap_plane_state, base);if (property == priv->zorder_prop) - *val = omap_state->zorder; + *val = state->zpos;else return -EINVAL ;
@@ -322,8 +269,8 @@ static const struct drm_plane_funcs omap_plane_funcs = { .reset = omap_plane_reset, .destroy = omap_plane_destroy, .set_property = drm_atomic_helper_plane_set_property, - .atomic_duplicate_state = omap_plane_atomic_duplicate_state, - .atomic_destroy_state = omap_plane_atomic_destroy_state, + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .atomic_set_property = omap_plane_atomic_set_property, .atomic_get_property = omap_plane_atomic_get_property, };
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm: omapdrm: Add zpos property
In reply to Laurent PinchartCreate a standard zpos property for every plane as an alias to the omapdrm-specific zorder property. Unlike the zorder property that has to be instantiated for both planes and CRTCs due to backward compatibility, the zpos property is only instantiated for planes. When userspace will have switched to the zpos property the zorder property will be removed.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/omapdrm/omap_plane.c +1 -0
@@ -314,6 +314,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,drm_plane_helper_add (plane, &omap_plane_helper_funcs);omap_plane_install_properties (plane, &plane->base); +drm_plane_create_zpos_property (plane,0 ,0 ,3 );return plane;
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 33 lines · Laurent Pinchart
Hello,
This patch series contains two completely unrelated features that just happen to have been developed one right after the other.
Patches 1/5 to 3/5 implement explicit fences support. The first patch fixes event handling in the omapdrm driver as required by the atomic commit helper (and the DRM atomic update API). The second patch replace the hand-rolled atomic commit handler with the DRM core atomic commit helper, bringing fences support as a bonus. The third patch then removes the omapdrm custom sync support that has no user in the mainline kernel.
Patches 4/5 and 5/5 clean up zpos handling by switching to the standard zpos property implemented in the DRM core. The omapdrm-specific zorder property is kept for backward compatibility as an alias and should be removed later after a long enough grace period for userspace to be updated.
As fence support is implemented completely inside the atomic commit helper I have only tested it lightly using the sw-sync driver. No issue has been noticed.
The patches are based on top of my previous omapdrm series that has been fully acked and should thus be merged in v4.11. It also requires the "drm: Constify
drm_mode_configatomic helper private pointer" patch that I have sent to the dri-devel mailing list today.Laurent Pinchart (5):
drm: omapdrm: Handle events when enabling/disabling CRTCs
drm: omapdrm: Use DRM core's atomic commit helper
drm: omapdrm: Remove legacy buffer synchronization support
drm: omapdrm: Store the Z order in the plane state zpos field
drm: omapdrm: Add zpos property
Quoted 8 lines
drivers/gpu/drm/omapdrm/omap_crtc.c | 30 +++-- drivers/gpu/drm/omapdrm/omap_drv.c | 163 ++++---------------------- drivers/gpu/drm/omapdrm/omap_drv.h | 14 +-- drivers/gpu/drm/omapdrm/omap_gem.c | 215 ----------------------------------- drivers/gpu/drm/omapdrm/omap_plane.c | 74 ++---------- include/uapi/drm/omap_drm.h | 4 +- 6 files changed, 55 insertions(+), 445 deletions(-)
I got this with your series. AM5 EVM, dual display, I run "kmstest --flip" and then exit by pressing enter, which is when I see the warning. It happens only sometimes, but having lots of cpu load (I used "stress -c 4") makes the driver spam the warning.
[ 67.207223] ------------[ cut here ]------------ [ 67.211937] WARNING: CPU: 1 PID: 324 at drivers/gpu/drm/omapdrm/omap_gem.c:1085 omap_gem_free_object+0x270/0x2d4 [omapdrm] [ 67.223138] Modules linked in: omapdrm drm_kms_helper drm panel_dsi_cm panel_dpi connector_analog_tv connector_dvi connector_hdmi encoder_tp d12s015 encoder_tfp410 omapdss cfbfillrect cfbimgblt cfbcopyarea [last unloaded: omapdss] [ 67.243953] CPU: 1 PID: 324 Comm: kmstest Not tainted 4.9.0-rc8-00163-g55f4a6c2d775 #135 [ 67.252084] Hardware name: Generic DRA74X (Flattened Device Tree) [ 67.258207] Backtrace: [ 67.260691] [<c010d8e0>] (dump_backtrace) from [<c010db8c>] (show_stack+0x18/0x1c) [ 67.268301] r7:c0d830d8 r6:60070013 r5:00000000 r4:c0d830d8 [ 67.273997] [<c010db74>] (show_stack) from [<c04d8668>] (dump_stack+0xa8/0xdc) [ 67.281263] [<c04d85c0>] (dump_stack) from [<c013c660>] (__warn+0xdc/0x108) [ 67.288263] r9:bf292048 r8:0000043d r7:00000009 r6:bf2972cc r5:00000000 r4:00000000 [ 67.296050] [<c013c584>] (__warn) from [<c013c740>] (warn_slowpath_null+0x28/0x30) [ 67.303661] r9:c00464b4 r8:ed0a4800 r7:00000000 r6:ed0a4838 r5:ee6d179c r4:ed09c700 [ 67.311467] [<c013c718>] (warn_slowpath_null) from [<bf292048>] (omap_gem_free_object+0x270/0x2d4 [omapdrm]) [ 67.321482] [<bf291dd8>] (omap_gem_free_object [omapdrm]) from [<bf1dd228>] (drm_gem_object_free+0x4c/0x6c [drm]) [ 67.331796] r10:ed0a4800 r9:c00464b4 r8:00000001 r7:00000000 r6:ed0a4838 r5:ed09c700 [ 67.339664] r4:ed0a4800 [ 67.342422] [<bf1dd1dc>] (drm_gem_object_free [drm]) from [<bf1dd81c>] (drm_gem_object_unreference_unlocked+0x128/0x13c [drm]) [ 67.353867] r5:00000000 r4:ed09c700 [ 67.357671] [<bf1dd6f4>] (drm_gem_object_unreference_unlocked [drm]) from [<bf1dd8a4>] (drm_gem_object_handle_unreference_unlocked+0x74/0xb0 [drm]) [ 67.370949] r8:ed1d181c r7:ed1d1954 r6:ed0a4e30 r5:00000000 r4:ed09c700 [ 67.377892] [<bf1dd830>] (drm_gem_object_handle_unreference_unlocked [drm]) from [<bf1dd938>] (drm_gem_object_release_handle+0x58/0x90 [drm] ) [ 67.390646] r7:ed1d1954 r6:ed0a4800 r5:ed1d1800 r4:ed09c700 [ 67.396543] [<bf1dd8e0>] (drm_gem_object_release_handle [drm]) from [<bf1dd9d0>] (drm_gem_handle_delete+0x60/0x8c [drm]) [ 67.407465] r7:ed09c700 r6:00000002 r5:ed1d1800 r4:ed1d1854 [ 67.413361] [<bf1dd970>] (drm_gem_handle_delete [drm]) from [<bf1dda10>] (drm_gem_dumb_destroy+0x14/0x18 [drm]) [ 67.423500] r9:c00464b4 r8:ed1d1800 r7:bf1ff980 r6:00000004 r5:ee7efe50 r4:00000000
[ 67.431490] [<bf1dd9fc>] (drm_gem_dumb_destroy [drm]) from [<bf1fb4b4>] (drm_mode_destroy_dumb_ioctl+0x30/0x3c [drm]) [ 67.442408] [<bf1fb484>] (drm_mode_destroy_dumb_ioctl [drm]) from [<bf1deb18>] (drm_ioctl+0x210/0x424 [drm]) [ 67.452392] [<bf1de908>] (drm_ioctl [drm]) from [<c02d0b94>] (do_vfs_ioctl+0x9c/0xa88) [ 67.460352] r10:00000000 r9:00000003 r8:00000003 r7:c02d15f4 r6:ed14b180 r5:ed5feac8 [ 67.468219] r4:be95c44c [ 67.470771] [<c02d0af8>] (do_vfs_ioctl) from [<c02d15f4>] (SyS_ioctl+0x74/0x84) [ 67.478120] r10:00000000 r9:00000003 r8:be95c44c r7:c00464b4 r6:ed14b180 r5:ed14b180 [ 67.485987] r4:00000000 [ 67.488541] [<c02d1580>] (SyS_ioctl) from [<c0108a60>] (ret_fast_syscall+0x0/0x1c) [ 67.496151] r9:ee7ee000 r8:c0108c04 r7:00000036 r6:c00464b4 r5:be95c44c r4:0005de78 [ 67.504143] ---[ end trace 11d19f8e7a3544b1 ]---
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Tomi Valkeinen
I got this with your series. AM5 EVM, dual display, I run "kmstest --flip" and then exit by pressing enter, which is when I see the warning. It happens only sometimes, but having lots of cpu load (I used "stress -c 4") makes the driver spam the warning.
[ 67.207223] ------------[ cut here ]------------ [ 67.211937] WARNING: CPU: 1 PID: 324 at drivers/gpu/drm/omapdrm/omap_gem.c:1085 omap_gem_free_object+0x270/0x2d4 [omapdrm] [ 67.223138] Modules linked in: omapdrm drm_kms_helper drm panel_dsi_cm panel_dpi connector_analog_tv connector_dvi connector_hdmi encoder_tp d12s015 encoder_tfp410 omapdss cfbfillrect cfbimgblt cfbcopyarea [last unloaded: omapdss] [ 67.243953] CPU: 1 PID: 324 Comm: kmstest Not tainted 4.9.0-rc8-00163-g55f4a6c2d775 #135
After rebasing to latest drm-next, I no longer see this, but the kms++ test script hangs when exiting it. And then I get BUGs from the kernel. Do you know if all the dependencies are in drm-next?
Tomi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Tomi,
Quoted 15 lines · On Wednesday 05 Apr 2017 09:52:36 Tomi Valkeinen wrote:
Quoted 5 lines · Tomi Valkeinen
I got this with your series. AM5 EVM, dual display, I run "kmstest --flip" and then exit by pressing enter, which is when I see the warning. It happens only sometimes, but having lots of cpu load (I used "stress -c 4") makes the driver spam the warning.
Quoted 8 lines
[ 67.207223] ------------[ cut here ]------------ [ 67.211937] WARNING: CPU: 1 PID: 324 at
drivers/gpu/drm/omapdrm/omap_gem.c:1085omap_gem_free_object+0x270/0x2d4
[omapdrm] [ 67.223138] Modules linked in: omapdrmdrm_kms_helperdrmpanel_dsi_cmpanel_dpiconnector_analog_tvconnector_dviconnector_hdmiencoder_tpd12s015encoder_tfp410omapdss cfbfillrect cfbimgblt
cfbcopyarea [last unloaded: omapdss] [ 67.243953] CPU: 1 PID: 324 Comm:
kmstest Not tainted 4.9.0-rc8-00163-g55f4a6c2d775 #135
Quoted 3 lines
After rebasing to latest drm-next, I no longer see this, but the kms++ test script hangs when exiting it. And then I get BUGs from the kernel. Do you know if all the dependencies are in drm-next?
I've just rebased the patches on top of drm-next and I can't reproduce any of these two issues. I've ran kmstest --flip for 250 frames in a loop for half an hour, with and without CPU load (with 'stress -c 4') and everything works fine. I'll repost the rebased patches now.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel