Commit a2896ced authored by Marcin Slusarz's avatar Marcin Slusarz Committed by Ben Skeggs
Browse files

drm/nouveau: prepare for reporting channel owner



- record channel owner process name
- add some helpers for accessing this information
- let nouveau_enum hold additional value (will be needed in the next patch)

Signed-off-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f533da10
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -99,3 +99,13 @@ nouveau_client_fini(struct nouveau_client *client, bool suspend)
	nv_debug(client, "%s completed with %d\n", name[suspend], ret);
	return ret;
}

const char *
nouveau_client_name(void *obj)
{
	const char *client_name = "unknown";
	struct nouveau_client *client = nouveau_client(obj);
	if (client)
		client_name = client->name;
	return client_name;
}
+2 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ nouveau_enum_find(const struct nouveau_enum *en, u32 value)
	return NULL;
}

void
const struct nouveau_enum *
nouveau_enum_print(const struct nouveau_enum *en, u32 value)
{
	en = nouveau_enum_find(en, value);
@@ -48,6 +48,7 @@ nouveau_enum_print(const struct nouveau_enum *en, u32 value)
		pr_cont("%s", en->name);
	else
		pr_cont("(unknown enum 0x%08x)", value);
	return en;
}

void
+15 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
 * Authors: Ben Skeggs
 */

#include <core/client.h>
#include <core/object.h>
#include <core/handle.h>
#include <core/class.h>
@@ -146,6 +147,20 @@ nouveau_fifo_chid(struct nouveau_fifo *priv, struct nouveau_object *object)
	return -1;
}

const char *
nouveau_client_name_for_fifo_chid(struct nouveau_fifo *fifo, u32 chid)
{
	struct nouveau_fifo_chan *chan = NULL;
	unsigned long flags;

	spin_lock_irqsave(&fifo->lock, flags);
	if (chid >= fifo->min && chid <= fifo->max)
		chan = (void *)fifo->channel[chid];
	spin_unlock_irqrestore(&fifo->lock, flags);

	return nouveau_client_name(chan);
}

void
nouveau_fifo_destroy(struct nouveau_fifo *priv)
{
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ struct nouveau_client {
	struct nouveau_namedb base;
	struct nouveau_handle *root;
	struct nouveau_object *device;
	char name[16];
	char name[32];
	u32 debug;
	struct nouveau_vm *vm;
};
@@ -41,5 +41,6 @@ int nouveau_client_create_(const char *name, u64 device, const char *cfg,

int  nouveau_client_init(struct nouveau_client *);
int  nouveau_client_fini(struct nouveau_client *, bool suspend);
const char *nouveau_client_name(void *obj);

#endif
+2 −1
Original line number Diff line number Diff line
@@ -5,12 +5,13 @@ struct nouveau_enum {
	u32 value;
	const char *name;
	const void *data;
	u32 data2;
};

const struct nouveau_enum *
nouveau_enum_find(const struct nouveau_enum *, u32 value);

void
const struct nouveau_enum *
nouveau_enum_print(const struct nouveau_enum *en, u32 value);

struct nouveau_bitfield {
Loading