Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e193b1d4 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/fence: un-port from nouveau_exec_engine interfaces



Still the same code, but not an "engine" anymore.  The fence code is more of
a policy decision rather than exposing mechanisms, so it's not appropriate
to port it to the new engine subsystem.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 66f24723
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -124,9 +124,9 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
		      struct drm_file *file_priv,
		      uint32_t vram_handle, uint32_t gart_handle)
{
	struct nouveau_exec_engine *fence = nv_engine(dev, NVOBJ_ENGINE_FENCE);
	struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
	struct nouveau_fence_priv *fence = dev_priv->fence.func;
	struct nouveau_fpriv *fpriv = nouveau_fpriv(file_priv);
	struct nouveau_channel *chan;
	unsigned long flags;
@@ -234,7 +234,7 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,

	FIRE_RING(chan);

	ret = fence->context_new(chan, NVOBJ_ENGINE_FENCE);
	ret = fence->context_new(chan);
	if (ret) {
		nouveau_channel_put(&chan);
		return ret;
@@ -289,6 +289,7 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan)
	struct nouveau_channel *chan = *pchan;
	struct drm_device *dev = chan->dev;
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fence_priv *fence = dev_priv->fence.func;
	unsigned long flags;
	int i;

@@ -311,6 +312,9 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan)
			dev_priv->eng[i]->context_del(chan, i);
	}

	if (chan->fence)
		fence->context_del(chan);

	/* aside from its resources, the channel should now be dead,
	 * remove it from the channel list
	 */
+11 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "nouveau_hw.h"
#include "nouveau_fb.h"
#include "nouveau_fbcon.h"
#include "nouveau_fence.h"
#include "nouveau_pm.h"
#include <engine/fifo.h>
#include "nv50_display.h"
@@ -149,6 +150,7 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
	struct drm_device *dev = pci_get_drvdata(pdev);
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
	struct nouveau_fence_priv *fence = dev_priv->fence.func;
	struct nouveau_channel *chan;
	struct drm_crtc *crtc;
	int ret, i, e;
@@ -188,6 +190,11 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
			nouveau_channel_idle(chan);
	}

	if (fence->suspend) {
		if (!fence->suspend(dev))
			return -ENOMEM;
	}

	for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
		if (!dev_priv->eng[e])
			continue;
@@ -216,6 +223,7 @@ nouveau_pci_resume(struct pci_dev *pdev)
	struct drm_device *dev = pci_get_drvdata(pdev);
	struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fence_priv *fence = dev_priv->fence.func;
	struct nouveau_engine *engine = &dev_priv->engine;
	struct drm_crtc *crtc;
	int ret, i;
@@ -234,6 +242,9 @@ nouveau_pci_resume(struct pci_dev *pdev)
			dev_priv->eng[i]->init(dev, i);
	}

	if (fence->resume)
		fence->resume(dev);

	nouveau_irq_postinstall(dev);

	/* Re-write SKIPS, they'll have been lost over the suspend */
+3 −1
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ enum nouveau_flags {
#define NVOBJ_ENGINE_BSP	6
#define NVOBJ_ENGINE_VP		7
#define NVOBJ_ENGINE_FIFO	14
#define NVOBJ_ENGINE_FENCE	15
#define NVOBJ_ENGINE_NR		16
#define NVOBJ_ENGINE_DISPLAY	(NVOBJ_ENGINE_NR + 0) /*XXX*/

@@ -189,6 +188,7 @@ struct nouveau_channel {

	/* Execution engine contexts */
	void *engctx[NVOBJ_ENGINE_NR];
	void *fence;

	/* NV50 VM */
	struct nouveau_vm     *vm;
@@ -448,6 +448,7 @@ struct drm_nouveau_private {
	u32 crystal;

	struct nouveau_exec_engine *eng[NVOBJ_ENGINE_NR];

	struct list_head classes;

	struct nouveau_bo *vga_ram;
@@ -467,6 +468,7 @@ struct drm_nouveau_private {
	} ttm;

	struct {
		void *func;
		spinlock_t lock;
		struct drm_mm heap;
		struct nouveau_bo *bo;
+9 −6
Original line number Diff line number Diff line
@@ -62,8 +62,9 @@ void
nouveau_fence_update(struct nouveau_channel *chan)
{
	struct drm_device *dev = chan->dev;
	struct nouveau_fence_priv *priv = nv_engine(dev, NVOBJ_ENGINE_FENCE);
	struct nouveau_fence_chan *fctx = chan->engctx[NVOBJ_ENGINE_FENCE];
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fence_priv *priv = dev_priv->fence.func;
	struct nouveau_fence_chan *fctx = chan->fence;
	struct nouveau_fence *fence, *fnext;

	spin_lock(&fctx->lock);
@@ -84,8 +85,9 @@ int
nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan)
{
	struct drm_device *dev = chan->dev;
	struct nouveau_fence_priv *priv = nv_engine(dev, NVOBJ_ENGINE_FENCE);
	struct nouveau_fence_chan *fctx = chan->engctx[NVOBJ_ENGINE_FENCE];
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fence_priv *priv = dev_priv->fence.func;
	struct nouveau_fence_chan *fctx = chan->fence;
	int ret;

	fence->channel  = chan;
@@ -148,7 +150,8 @@ int
nouveau_fence_sync(struct nouveau_fence *fence, struct nouveau_channel *chan)
{
	struct drm_device *dev = chan->dev;
	struct nouveau_fence_priv *priv = nv_engine(dev, NVOBJ_ENGINE_FENCE);
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	struct nouveau_fence_priv *priv = dev_priv->fence.func;
	struct nouveau_channel *prev;
	int ret = 0;

@@ -193,7 +196,7 @@ nouveau_fence_new(struct nouveau_channel *chan, struct nouveau_fence **pfence)
	struct nouveau_fence *fence;
	int ret = 0;

	if (unlikely(!chan->engctx[NVOBJ_ENGINE_FENCE]))
	if (unlikely(!chan->fence))
		return -ENODEV;

	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
+9 −5
Original line number Diff line number Diff line
@@ -32,7 +32,11 @@ struct nouveau_fence_chan {
};

struct nouveau_fence_priv {
	struct nouveau_exec_engine engine;
	void (*dtor)(struct drm_device *);
	bool (*suspend)(struct drm_device *);
	void (*resume)(struct drm_device *);
	int  (*context_new)(struct nouveau_channel *);
	void (*context_del)(struct nouveau_channel *);
	int  (*emit)(struct nouveau_fence *);
	int  (*sync)(struct nouveau_fence *, struct nouveau_channel *,
		     struct nouveau_channel *);
Loading