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

Commit 6a9cd0c6 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Modify dispatcher to accept generic objects"

parents 664fd91a 1f266270
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ ccflags-y := -Idrivers/staging/android
msm_kgsl_core-y = \
	kgsl.o \
	kgsl_trace.o \
	kgsl_cmdbatch.o \
	kgsl_drawobj.o \
	kgsl_ioctl.o \
	kgsl_sharedmem.o \
	kgsl_pwrctrl.o \
+11 −10
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@

/* Include the master list of GPU cores that are supported */
#include "adreno-gpulist.h"
#include "adreno_dispatch.h"

#undef MODULE_PARAM_PREFIX
#define MODULE_PARAM_PREFIX "adreno."
@@ -1015,8 +1016,8 @@ static void _adreno_free_memories(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	if (test_bit(ADRENO_DEVICE_CMDBATCH_PROFILE, &adreno_dev->priv))
		kgsl_free_global(device, &adreno_dev->cmdbatch_profile_buffer);
	if (test_bit(ADRENO_DEVICE_DRAWOBJ_PROFILE, &adreno_dev->priv))
		kgsl_free_global(device, &adreno_dev->profile_buffer);

	/* Free local copies of firmware and other command streams */
	kfree(adreno_dev->pfp_fw);
@@ -1187,22 +1188,22 @@ static int adreno_init(struct kgsl_device *device)
	}

	/*
	 * Allocate a small chunk of memory for precise cmdbatch profiling for
	 * Allocate a small chunk of memory for precise drawobj profiling for
	 * those targets that have the always on timer
	 */

	if (!adreno_is_a3xx(adreno_dev)) {
		int r = kgsl_allocate_global(device,
			&adreno_dev->cmdbatch_profile_buffer, PAGE_SIZE,
			&adreno_dev->profile_buffer, PAGE_SIZE,
			0, 0, "alwayson");

		adreno_dev->cmdbatch_profile_index = 0;
		adreno_dev->profile_index = 0;

		if (r == 0) {
			set_bit(ADRENO_DEVICE_CMDBATCH_PROFILE,
			set_bit(ADRENO_DEVICE_DRAWOBJ_PROFILE,
				&adreno_dev->priv);
			kgsl_sharedmem_set(device,
				&adreno_dev->cmdbatch_profile_buffer, 0, 0,
				&adreno_dev->profile_buffer, 0, 0,
				PAGE_SIZE);
		}

@@ -2335,12 +2336,12 @@ int adreno_idle(struct kgsl_device *device)
 * adreno_drain() - Drain the dispatch queue
 * @device: Pointer to the KGSL device structure for the GPU
 *
 * Drain the dispatcher of existing command batches.  This halts
 * Drain the dispatcher of existing drawobjs.  This halts
 * additional commands from being issued until the gate is completed.
 */
static int adreno_drain(struct kgsl_device *device)
{
	reinit_completion(&device->cmdbatch_gate);
	reinit_completion(&device->halt_gate);

	return 0;
}
@@ -2820,7 +2821,7 @@ static const struct kgsl_functable adreno_functable = {
	.getproperty_compat = adreno_getproperty_compat,
	.waittimestamp = adreno_waittimestamp,
	.readtimestamp = adreno_readtimestamp,
	.issueibcmds = adreno_ringbuffer_issueibcmds,
	.queue_cmds = adreno_dispatcher_queue_cmds,
	.ioctl = adreno_ioctl,
	.compat_ioctl = adreno_compat_ioctl,
	.power_stats = adreno_power_stats,
+21 −21
Original line number Diff line number Diff line
@@ -76,13 +76,13 @@
		  KGSL_CONTEXT_PREEMPT_STYLE_SHIFT)

/*
 * return the dispatcher cmdqueue in which the given cmdbatch should
 * return the dispatcher drawqueue in which the given drawobj should
 * be submitted
 */
#define ADRENO_CMDBATCH_DISPATCH_CMDQUEUE(c)	\
#define ADRENO_DRAWOBJ_DISPATCH_DRAWQUEUE(c)	\
	(&((ADRENO_CONTEXT(c->context))->rb->dispatch_q))

#define ADRENO_CMDBATCH_RB(c)			\
#define ADRENO_DRAWOBJ_RB(c)			\
	((ADRENO_CONTEXT(c->context))->rb)

/* Adreno core features */
@@ -346,8 +346,8 @@ struct adreno_gpu_core {
 * @halt: Atomic variable to check whether the GPU is currently halted
 * @ctx_d_debugfs: Context debugfs node
 * @pwrctrl_flag: Flag to hold adreno specific power attributes
 * @cmdbatch_profile_buffer: Memdesc holding the cmdbatch profiling buffer
 * @cmdbatch_profile_index: Index to store the start/stop ticks in the profiling
 * @profile_buffer: Memdesc holding the drawobj profiling buffer
 * @profile_index: Index to store the start/stop ticks in the profiling
 * buffer
 * @sp_local_gpuaddr: Base GPU virtual address for SP local memory
 * @sp_pvt_gpuaddr: Base GPU virtual address for SP private memory
@@ -404,8 +404,8 @@ struct adreno_device {
	struct dentry *ctx_d_debugfs;
	unsigned long pwrctrl_flag;

	struct kgsl_memdesc cmdbatch_profile_buffer;
	unsigned int cmdbatch_profile_index;
	struct kgsl_memdesc profile_buffer;
	unsigned int profile_index;
	uint64_t sp_local_gpuaddr;
	uint64_t sp_pvt_gpuaddr;
	const struct firmware *lm_fw;
@@ -441,7 +441,7 @@ struct adreno_device {
 * @ADRENO_DEVICE_STARTED - Set if the device start sequence is in progress
 * @ADRENO_DEVICE_FAULT - Set if the device is currently in fault (and shouldn't
 * send any more commands to the ringbuffer)
 * @ADRENO_DEVICE_CMDBATCH_PROFILE - Set if the device supports command batch
 * @ADRENO_DEVICE_DRAWOBJ_PROFILE - Set if the device supports drawobj
 * profiling via the ALWAYSON counter
 * @ADRENO_DEVICE_PREEMPTION - Turn on/off preemption
 * @ADRENO_DEVICE_SOFT_FAULT_DETECT - Set if soft fault detect is enabled
@@ -459,7 +459,7 @@ enum adreno_device_flags {
	ADRENO_DEVICE_HANG_INTR = 4,
	ADRENO_DEVICE_STARTED = 5,
	ADRENO_DEVICE_FAULT = 6,
	ADRENO_DEVICE_CMDBATCH_PROFILE = 7,
	ADRENO_DEVICE_DRAWOBJ_PROFILE = 7,
	ADRENO_DEVICE_GPU_REGULATOR_ENABLED = 8,
	ADRENO_DEVICE_PREEMPTION = 9,
	ADRENO_DEVICE_SOFT_FAULT_DETECT = 10,
@@ -469,22 +469,22 @@ enum adreno_device_flags {
};

/**
 * struct adreno_cmdbatch_profile_entry - a single command batch entry in the
 * struct adreno_drawobj_profile_entry - a single drawobj entry in the
 * kernel profiling buffer
 * @started: Number of GPU ticks at start of the command batch
 * @retired: Number of GPU ticks at the end of the command batch
 * @started: Number of GPU ticks at start of the drawobj
 * @retired: Number of GPU ticks at the end of the drawobj
 */
struct adreno_cmdbatch_profile_entry {
struct adreno_drawobj_profile_entry {
	uint64_t started;
	uint64_t retired;
};

#define ADRENO_CMDBATCH_PROFILE_COUNT \
	(PAGE_SIZE / sizeof(struct adreno_cmdbatch_profile_entry))
#define ADRENO_DRAWOBJ_PROFILE_COUNT \
	(PAGE_SIZE / sizeof(struct adreno_drawobj_profile_entry))

#define ADRENO_CMDBATCH_PROFILE_OFFSET(_index, _member) \
	 ((_index) * sizeof(struct adreno_cmdbatch_profile_entry) \
	  + offsetof(struct adreno_cmdbatch_profile_entry, _member))
#define ADRENO_DRAWOBJ_PROFILE_OFFSET(_index, _member) \
	 ((_index) * sizeof(struct adreno_drawobj_profile_entry) \
	  + offsetof(struct adreno_drawobj_profile_entry, _member))


/**
@@ -775,7 +775,7 @@ struct adreno_gpudev {
 * @KGSL_FT_REPLAY: Replay the faulting command
 * @KGSL_FT_SKIPIB: Skip the faulting indirect buffer
 * @KGSL_FT_SKIPFRAME: Skip the frame containing the faulting IB
 * @KGSL_FT_DISABLE: Tells the dispatcher to disable FT for the command batch
 * @KGSL_FT_DISABLE: Tells the dispatcher to disable FT for the command obj
 * @KGSL_FT_TEMP_DISABLE: Disables FT for all commands
 * @KGSL_FT_THROTTLE: Disable the context if it faults too often
 * @KGSL_FT_SKIPCMD: Skip the command containing the faulting IB
@@ -792,7 +792,7 @@ enum kgsl_ft_policy_bits {
	/* KGSL_FT_MAX_BITS is used to calculate the mask */
	KGSL_FT_MAX_BITS,
	/* Internal bits - set during GFT */
	/* Skip the PM dump on replayed command batches */
	/* Skip the PM dump on replayed command obj's */
	KGSL_FT_SKIP_PMDUMP = 31,
};

@@ -881,7 +881,7 @@ int adreno_reset(struct kgsl_device *device, int fault);

void adreno_fault_skipcmd_detached(struct adreno_device *adreno_dev,
					 struct adreno_context *drawctxt,
					 struct kgsl_cmdbatch *cmdbatch);
					 struct kgsl_drawobj *drawobj);

int adreno_coresight_init(struct adreno_device *adreno_dev);

+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static void _update_wptr(struct adreno_device *adreno_dev)
			rb->wptr);

		rb->dispatch_q.expires = jiffies +
			msecs_to_jiffies(adreno_cmdbatch_timeout);
			msecs_to_jiffies(adreno_drawobj_timeout);
	}

	spin_unlock_irqrestore(&rb->preempt_lock, flags);
+44 −32
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ typedef void (*reg_read_fill_t)(struct kgsl_device *device, int i,


static void sync_event_print(struct seq_file *s,
		struct kgsl_cmdbatch_sync_event *sync_event)
		struct kgsl_drawobj_sync_event *sync_event)
{
	switch (sync_event->type) {
	case KGSL_CMD_SYNCPOINT_TYPE_TIMESTAMP: {
@@ -153,12 +153,12 @@ struct flag_entry {
	const char *str;
};

static const struct flag_entry cmdbatch_flags[] = {KGSL_CMDBATCH_FLAGS};
static const struct flag_entry drawobj_flags[] = {KGSL_DRAWOBJ_FLAGS};

static const struct flag_entry cmdbatch_priv[] = {
	{ CMDBATCH_FLAG_SKIP, "skip"},
	{ CMDBATCH_FLAG_FORCE_PREAMBLE, "force_preamble"},
	{ CMDBATCH_FLAG_WFI, "wait_for_idle" },
static const struct flag_entry cmdobj_priv[] = {
	{ CMDOBJ_SKIP, "skip"},
	{ CMDOBJ_FORCE_PREAMBLE, "force_preamble"},
	{ CMDOBJ_WFI, "wait_for_idle" },
};

static const struct flag_entry context_flags[] = {KGSL_CONTEXT_FLAGS};
@@ -199,42 +199,54 @@ static void print_flags(struct seq_file *s, const struct flag_entry *table,
		seq_puts(s, "None");
}

static void cmdbatch_print(struct seq_file *s, struct kgsl_cmdbatch *cmdbatch)
static void syncobj_print(struct seq_file *s,
			struct kgsl_drawobj_sync *syncobj)
{
	struct kgsl_cmdbatch_sync_event *event;
	struct kgsl_drawobj_sync_event *event;
	unsigned int i;

	/* print fences first, since they block this cmdbatch */
	seq_puts(s, " syncobj ");

	for (i = 0; i < cmdbatch->numsyncs; i++) {
		event = &cmdbatch->synclist[i];
	for (i = 0; i < syncobj->numsyncs; i++) {
		event = &syncobj->synclist[i];

		if (!kgsl_cmdbatch_event_pending(cmdbatch, i))
		if (!kgsl_drawobj_event_pending(syncobj, i))
			continue;

		/*
		 * Timestamp is 0 for KGSL_CONTEXT_SYNC, but print it anyways
		 * so that it is clear if the fence was a separate submit
		 * or part of an IB submit.
		 */
		seq_printf(s, "\t%d ", cmdbatch->timestamp);
		sync_event_print(s, event);
		seq_puts(s, "\n");
	}
}

	/* if this flag is set, there won't be an IB */
	if (cmdbatch->flags & KGSL_CONTEXT_SYNC)
		return;
static void cmdobj_print(struct seq_file *s,
			struct kgsl_drawobj_cmd *cmdobj)
{
	struct kgsl_drawobj *drawobj = DRAWOBJ(cmdobj);

	seq_printf(s, "\t%d: ", cmdbatch->timestamp);
	if (drawobj->type == CMDOBJ_TYPE)
		seq_puts(s, " cmdobj ");
	else
		seq_puts(s, " markerobj ");

	seq_puts(s, " flags: ");
	print_flags(s, cmdbatch_flags, ARRAY_SIZE(cmdbatch_flags),
		    cmdbatch->flags);
	seq_printf(s, "\t %d ", drawobj->timestamp);

	seq_puts(s, " priv: ");
	print_flags(s, cmdbatch_priv, ARRAY_SIZE(cmdbatch_priv),
		    cmdbatch->priv);
	print_flags(s, cmdobj_priv, ARRAY_SIZE(cmdobj_priv),
				cmdobj->priv);
}

static void drawobj_print(struct seq_file *s,
			struct kgsl_drawobj *drawobj)
{
	if (drawobj->type == SYNCOBJ_TYPE)
		syncobj_print(s, SYNCOBJ(drawobj));
	else if ((drawobj->type == CMDOBJ_TYPE) ||
			(drawobj->type == MARKEROBJ_TYPE))
		cmdobj_print(s, CMDOBJ(drawobj));

	seq_puts(s, " flags: ");
	print_flags(s, drawobj_flags, ARRAY_SIZE(drawobj_flags),
		    drawobj->flags);

	seq_puts(s, "\n");
}
@@ -285,13 +297,13 @@ static int ctx_print(struct seq_file *s, void *unused)
		   queued, consumed, retired,
		   drawctxt->internal_timestamp);

	seq_puts(s, "cmdqueue:\n");
	seq_puts(s, "drawqueue:\n");

	spin_lock(&drawctxt->lock);
	for (i = drawctxt->cmdqueue_head;
		i != drawctxt->cmdqueue_tail;
		i = CMDQUEUE_NEXT(i, ADRENO_CONTEXT_CMDQUEUE_SIZE))
		cmdbatch_print(s, drawctxt->cmdqueue[i]);
	for (i = drawctxt->drawqueue_head;
		i != drawctxt->drawqueue_tail;
		i = DRAWQUEUE_NEXT(i, ADRENO_CONTEXT_DRAWQUEUE_SIZE))
		drawobj_print(s, drawctxt->drawqueue[i]);
	spin_unlock(&drawctxt->lock);

	seq_puts(s, "events:\n");
Loading