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

Commit e93b6dee authored by Lucas Stach's avatar Lucas Stach
Browse files

drm/etnaviv: hook up DRM GPU scheduler



This hooks in the DRM GPU scheduler. No improvement yet, as all the
dependency handling is still done in etnaviv_gem_submit. This just
replaces the actual GPU submit by passing through the scheduler.

Allows to get rid of the retire worker, as this is now driven by the
scheduler.

Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
parent 8bc4d885
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ config DRM_ETNAVIV
	select WANT_DEV_COREDUMP
	select CMA if HAVE_DMA_CONTIGUOUS
	select DMA_CMA if HAVE_DMA_CONTIGUOUS
	select DRM_SCHED
	help
	  DRM driver for Vivante GPUs.

+2 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ etnaviv-y := \
	etnaviv_iommu_v2.o \
	etnaviv_iommu.o \
	etnaviv_mmu.o \
	etnaviv_perfmon.o
	etnaviv_perfmon.o \
	etnaviv_sched.o

obj-$(CONFIG_DRM_ETNAVIV)	+= etnaviv.o
+16 −0
Original line number Diff line number Diff line
@@ -101,12 +101,25 @@ static void load_gpu(struct drm_device *dev)

static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
{
	struct etnaviv_drm_private *priv = dev->dev_private;
	struct etnaviv_file_private *ctx;
	int i;

	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
	if (!ctx)
		return -ENOMEM;

	for (i = 0; i < ETNA_MAX_PIPES; i++) {
		struct etnaviv_gpu *gpu = priv->gpu[i];

		if (gpu) {
			drm_sched_entity_init(&gpu->sched,
				&ctx->sched_entity[i],
				&gpu->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL],
				32, NULL);
			}
	}

	file->driver_priv = ctx;

	return 0;
@@ -126,6 +139,9 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file)
			if (gpu->lastctx == ctx)
				gpu->lastctx = NULL;
			mutex_unlock(&gpu->lock);

			drm_sched_entity_fini(&gpu->sched,
					      &ctx->sched_entity[i]);
		}
	}

+4 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <drm/drm_fb_helper.h>
#include <drm/drm_gem.h>
#include <drm/etnaviv_drm.h>
#include <drm/gpu_scheduler.h>

struct etnaviv_cmdbuf;
struct etnaviv_gpu;
@@ -42,11 +43,11 @@ struct etnaviv_gem_object;
struct etnaviv_gem_submit;

struct etnaviv_file_private {
	/* currently we don't do anything useful with this.. but when
	 * per-context address spaces are supported we'd keep track of
	/*
	 * When per-context address spaces are supported we'd keep track of
	 * the context's page-tables here.
	 */
	int dummy;
	struct drm_sched_entity		sched_entity[ETNA_MAX_PIPES];
};

struct etnaviv_drm_private {
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ struct etnaviv_gem_submit_bo {
 * make it easier to unwind when things go wrong, etc).
 */
struct etnaviv_gem_submit {
	struct drm_sched_job sched_job;
	struct kref refcount;
	struct etnaviv_gpu *gpu;
	struct dma_fence *out_fence, *in_fence;
Loading