All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] omapdrm: fences and zpos
@ 2017-01-02 23:29 Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs Laurent Pinchart
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-02 23:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

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(-)

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs
  2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
@ 2017-01-02 23:29 ` Laurent Pinchart
  2017-01-03 10:07   ` Tomi Valkeinen
  2017-01-02 23:29 ` [PATCH 2/5] drm: omapdrm: Use DRM core's atomic commit helper Laurent Pinchart
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-02 23:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

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 <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index dd47dc191e6b..9dd14ac337f6 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -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);
 }
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] drm: omapdrm: Use DRM core's atomic commit helper
  2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs Laurent Pinchart
@ 2017-01-02 23:29 ` Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 3/5] drm: omapdrm: Remove legacy buffer synchronization support Laurent Pinchart
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-02 23:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The DRM core atomic helper now supports asynchronous commits natively.
The custom omapdrm implementation isn't needed anymore, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 113 +++++--------------------------------
 drivers/gpu/drm/omapdrm/omap_drv.h |   9 +--
 2 files changed, 15 insertions(+), 107 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 00aa214b7560..36106c6f4106 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -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);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index b20377efd01b..af9f35623ffe 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -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;
 };
 
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] drm: omapdrm: Remove legacy buffer synchronization support
  2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 2/5] drm: omapdrm: Use DRM core's atomic commit helper Laurent Pinchart
@ 2017-01-02 23:29 ` Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 4/5] drm: omapdrm: Store the Z order in the plane state zpos field Laurent Pinchart
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-02 23:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The 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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 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(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 36106c6f4106..f2cd702728a3 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -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),
 };
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index af9f35623ffe..ddd5618a9bcd 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -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,
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index d4e1e11466f8..ce2c459ada53 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -101,19 +101,6 @@ struct omap_gem_object {
 	 * Virtual address, if mapped.
 	 */
 	void *vaddr;
-
-	/**
-	 * sync-object allocated on demand (if needed)
-	 *
-	 * Per-buffer sync-object for tracking pending and completed hw/dma
-	 * read and write operations.
-	 */
-	struct {
-		uint32_t write_pending;
-		uint32_t write_complete;
-		uint32_t read_pending;
-		uint32_t read_complete;
-	} *sync;
 };
 
 #define to_omap_bo(x) container_of(x, struct omap_gem_object, base)
@@ -1075,206 +1062,6 @@ void omap_gem_describe_objects(struct list_head *list, struct seq_file *m)
 #endif
 
 /* -----------------------------------------------------------------------------
- * Buffer Synchronization
- */
-
-static DEFINE_SPINLOCK(sync_lock);
-
-struct omap_gem_sync_waiter {
-	struct list_head list;
-	struct omap_gem_object *omap_obj;
-	enum omap_gem_op op;
-	uint32_t read_target, write_target;
-	/* notify called w/ sync_lock held */
-	void (*notify)(void *arg);
-	void *arg;
-};
-
-/* list of omap_gem_sync_waiter.. the notify fxn gets called back when
- * the read and/or write target count is achieved which can call a user
- * callback (ex. to kick 3d and/or 2d), wakeup blocked task (prep for
- * cpu access), etc.
- */
-static LIST_HEAD(waiters);
-
-static inline bool is_waiting(struct omap_gem_sync_waiter *waiter)
-{
-	struct omap_gem_object *omap_obj = waiter->omap_obj;
-	if ((waiter->op & OMAP_GEM_READ) &&
-			(omap_obj->sync->write_complete < waiter->write_target))
-		return true;
-	if ((waiter->op & OMAP_GEM_WRITE) &&
-			(omap_obj->sync->read_complete < waiter->read_target))
-		return true;
-	return false;
-}
-
-/* macro for sync debug.. */
-#define SYNCDBG 0
-#define SYNC(fmt, ...) do { if (SYNCDBG) \
-		printk(KERN_ERR "%s:%d: "fmt"\n", \
-				__func__, __LINE__, ##__VA_ARGS__); \
-	} while (0)
-
-
-static void sync_op_update(void)
-{
-	struct omap_gem_sync_waiter *waiter, *n;
-	list_for_each_entry_safe(waiter, n, &waiters, list) {
-		if (!is_waiting(waiter)) {
-			list_del(&waiter->list);
-			SYNC("notify: %p", waiter);
-			waiter->notify(waiter->arg);
-			kfree(waiter);
-		}
-	}
-}
-
-static inline int sync_op(struct drm_gem_object *obj,
-		enum omap_gem_op op, bool start)
-{
-	struct omap_gem_object *omap_obj = to_omap_bo(obj);
-	int ret = 0;
-
-	spin_lock(&sync_lock);
-
-	if (!omap_obj->sync) {
-		omap_obj->sync = kzalloc(sizeof(*omap_obj->sync), GFP_ATOMIC);
-		if (!omap_obj->sync) {
-			ret = -ENOMEM;
-			goto unlock;
-		}
-	}
-
-	if (start) {
-		if (op & OMAP_GEM_READ)
-			omap_obj->sync->read_pending++;
-		if (op & OMAP_GEM_WRITE)
-			omap_obj->sync->write_pending++;
-	} else {
-		if (op & OMAP_GEM_READ)
-			omap_obj->sync->read_complete++;
-		if (op & OMAP_GEM_WRITE)
-			omap_obj->sync->write_complete++;
-		sync_op_update();
-	}
-
-unlock:
-	spin_unlock(&sync_lock);
-
-	return ret;
-}
-
-/* mark the start of read and/or write operation */
-int omap_gem_op_start(struct drm_gem_object *obj, enum omap_gem_op op)
-{
-	return sync_op(obj, op, true);
-}
-
-int omap_gem_op_finish(struct drm_gem_object *obj, enum omap_gem_op op)
-{
-	return sync_op(obj, op, false);
-}
-
-static DECLARE_WAIT_QUEUE_HEAD(sync_event);
-
-static void sync_notify(void *arg)
-{
-	struct task_struct **waiter_task = arg;
-	*waiter_task = NULL;
-	wake_up_all(&sync_event);
-}
-
-int omap_gem_op_sync(struct drm_gem_object *obj, enum omap_gem_op op)
-{
-	struct omap_gem_object *omap_obj = to_omap_bo(obj);
-	int ret = 0;
-	if (omap_obj->sync) {
-		struct task_struct *waiter_task = current;
-		struct omap_gem_sync_waiter *waiter =
-				kzalloc(sizeof(*waiter), GFP_KERNEL);
-
-		if (!waiter)
-			return -ENOMEM;
-
-		waiter->omap_obj = omap_obj;
-		waiter->op = op;
-		waiter->read_target = omap_obj->sync->read_pending;
-		waiter->write_target = omap_obj->sync->write_pending;
-		waiter->notify = sync_notify;
-		waiter->arg = &waiter_task;
-
-		spin_lock(&sync_lock);
-		if (is_waiting(waiter)) {
-			SYNC("waited: %p", waiter);
-			list_add_tail(&waiter->list, &waiters);
-			spin_unlock(&sync_lock);
-			ret = wait_event_interruptible(sync_event,
-					(waiter_task == NULL));
-			spin_lock(&sync_lock);
-			if (waiter_task) {
-				SYNC("interrupted: %p", waiter);
-				/* we were interrupted */
-				list_del(&waiter->list);
-				waiter_task = NULL;
-			} else {
-				/* freed in sync_op_update() */
-				waiter = NULL;
-			}
-		}
-		spin_unlock(&sync_lock);
-		kfree(waiter);
-	}
-	return ret;
-}
-
-/* call fxn(arg), either synchronously or asynchronously if the op
- * is currently blocked..  fxn() can be called from any context
- *
- * (TODO for now fxn is called back from whichever context calls
- * omap_gem_op_finish().. but this could be better defined later
- * if needed)
- *
- * TODO more code in common w/ _sync()..
- */
-int omap_gem_op_async(struct drm_gem_object *obj, enum omap_gem_op op,
-		void (*fxn)(void *arg), void *arg)
-{
-	struct omap_gem_object *omap_obj = to_omap_bo(obj);
-	if (omap_obj->sync) {
-		struct omap_gem_sync_waiter *waiter =
-				kzalloc(sizeof(*waiter), GFP_ATOMIC);
-
-		if (!waiter)
-			return -ENOMEM;
-
-		waiter->omap_obj = omap_obj;
-		waiter->op = op;
-		waiter->read_target = omap_obj->sync->read_pending;
-		waiter->write_target = omap_obj->sync->write_pending;
-		waiter->notify = fxn;
-		waiter->arg = arg;
-
-		spin_lock(&sync_lock);
-		if (is_waiting(waiter)) {
-			SYNC("waited: %p", waiter);
-			list_add_tail(&waiter->list, &waiters);
-			spin_unlock(&sync_lock);
-			return 0;
-		}
-
-		spin_unlock(&sync_lock);
-
-		kfree(waiter);
-	}
-
-	/* no waiting.. */
-	fxn(arg);
-
-	return 0;
-}
-
-/* -----------------------------------------------------------------------------
  * Constructor & Destructor
  */
 
@@ -1313,8 +1100,6 @@ void omap_gem_free_object(struct drm_gem_object *obj)
 		drm_prime_gem_destroy(obj, omap_obj->sgt);
 	}
 
-	kfree(omap_obj->sync);
-
 	drm_gem_object_release(obj);
 
 	kfree(omap_obj);
diff --git a/include/uapi/drm/omap_drm.h b/include/uapi/drm/omap_drm.h
index 407cb55df6ac..b349aacdec23 100644
--- a/include/uapi/drm/omap_drm.h
+++ b/include/uapi/drm/omap_drm.h
@@ -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
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] drm: omapdrm: Store the Z order in the plane state zpos field
  2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
                   ` (2 preceding siblings ...)
  2017-01-02 23:29 ` [PATCH 3/5] drm: omapdrm: Remove legacy buffer synchronization support Laurent Pinchart
@ 2017-01-02 23:29 ` Laurent Pinchart
  2017-01-02 23:29 ` [PATCH 5/5] drm: omapdrm: Add zpos property Laurent Pinchart
  2017-01-03 12:06 ` [PATCH 0/5] omapdrm: fences and zpos Tomi Valkeinen
  5 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-02 23:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The 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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_plane.c | 73 +++++-------------------------------
 1 file changed, 10 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 386d90af70f7..518cd0e69396 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -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, &copy->base);
-
-	return &copy->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,
 };
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] drm: omapdrm: Add zpos property
  2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
                   ` (3 preceding siblings ...)
  2017-01-02 23:29 ` [PATCH 4/5] drm: omapdrm: Store the Z order in the plane state zpos field Laurent Pinchart
@ 2017-01-02 23:29 ` Laurent Pinchart
  2017-01-03 12:06 ` [PATCH 0/5] omapdrm: fences and zpos Tomi Valkeinen
  5 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-02 23:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

Create 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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_plane.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 518cd0e69396..f76eef6fa70d 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -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;
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs
  2017-01-02 23:29 ` [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs Laurent Pinchart
@ 2017-01-03 10:07   ` Tomi Valkeinen
  2017-01-03 11:06     ` Laurent Pinchart
  0 siblings, 1 reply; 11+ messages in thread
From: Tomi Valkeinen @ 2017-01-03 10:07 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1153 bytes --]

Hi,

On 03/01/17 01:29, Laurent Pinchart wrote:
> 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 <laurent.pinchart@ideasonboard.com>
> ---

> @@ -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);
>  }

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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs
  2017-01-03 10:07   ` Tomi Valkeinen
@ 2017-01-03 11:06     ` Laurent Pinchart
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-01-03 11:06 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: dri-devel

Hi Tomi,

On Tuesday 03 Jan 2017 12:07:25 Tomi Valkeinen wrote:
> On 03/01/17 01:29, Laurent Pinchart wrote:
> > 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 <laurent.pinchart@ideasonboard.com>
> > ---
> > 
> > @@ -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);
> >  }
> 
> 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.

Fortunately CRTCs are disabled after encoders, I've checked that before 
sending the patch.

> We need to fix the enable/disable call chains =).

Yksi asia kerrallaan :-)

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] omapdrm: fences and zpos
  2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
                   ` (4 preceding siblings ...)
  2017-01-02 23:29 ` [PATCH 5/5] drm: omapdrm: Add zpos property Laurent Pinchart
@ 2017-01-03 12:06 ` Tomi Valkeinen
  2017-04-05  6:52   ` Tomi Valkeinen
  5 siblings, 1 reply; 11+ messages in thread
From: Tomi Valkeinen @ 2017-01-03 12:06 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 5837 bytes --]

On 03/01/17 01:29, Laurent Pinchart wrote:
> 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(-)
> 

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 ]---


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] omapdrm: fences and zpos
  2017-01-03 12:06 ` [PATCH 0/5] omapdrm: fences and zpos Tomi Valkeinen
@ 2017-04-05  6:52   ` Tomi Valkeinen
  2017-04-13 14:37     ` Laurent Pinchart
  0 siblings, 1 reply; 11+ messages in thread
From: Tomi Valkeinen @ 2017-04-05  6:52 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: dri-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1042 bytes --]

On 03/01/17 14:06, Tomi Valkeinen wrote:

> 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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] omapdrm: fences and zpos
  2017-04-05  6:52   ` Tomi Valkeinen
@ 2017-04-13 14:37     ` Laurent Pinchart
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2017-04-13 14:37 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: dri-devel

Hi Tomi,

On Wednesday 05 Apr 2017 09:52:36 Tomi Valkeinen wrote:
> On 03/01/17 14:06, Tomi Valkeinen wrote:
> > 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?

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.

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-04-13 14:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 23:29 [PATCH 0/5] omapdrm: fences and zpos Laurent Pinchart
2017-01-02 23:29 ` [PATCH 1/5] drm: omapdrm: Handle events when enabling/disabling CRTCs Laurent Pinchart
2017-01-03 10:07   ` Tomi Valkeinen
2017-01-03 11:06     ` Laurent Pinchart
2017-01-02 23:29 ` [PATCH 2/5] drm: omapdrm: Use DRM core's atomic commit helper Laurent Pinchart
2017-01-02 23:29 ` [PATCH 3/5] drm: omapdrm: Remove legacy buffer synchronization support Laurent Pinchart
2017-01-02 23:29 ` [PATCH 4/5] drm: omapdrm: Store the Z order in the plane state zpos field Laurent Pinchart
2017-01-02 23:29 ` [PATCH 5/5] drm: omapdrm: Add zpos property Laurent Pinchart
2017-01-03 12:06 ` [PATCH 0/5] omapdrm: fences and zpos Tomi Valkeinen
2017-04-05  6:52   ` Tomi Valkeinen
2017-04-13 14:37     ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.