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

Commit 04b88677 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/core/client: allow creation of subclients



We want a supervisor client of NVKM (such as the DRM) to be able to
allow sharing of resources (such as memory objects) between clients.

To allow this, the supervisor creates all its clients as children of
itself, and will use an upcoming ioctl to permit sharing.

Currently it's not possible for indirect clients to use subclients.
Supporting this will require an additional field in the main ioctl.
This isn't important currently, but will need to be fixed for virt.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 7c413feb
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -11,8 +11,7 @@ struct nvif_client {
	bool super;
};

int  nvif_client_init(const char *drv, const char *name, u64 device,
		      const char *cfg, const char *dbg,
int  nvif_client_init(struct nvif_client *parent, const char *name, u64 device,
		      struct nvif_client *);
void nvif_client_fini(struct nvif_client *);
int  nvif_client_ioctl(struct nvif_client *, void *, u32);
+5 −1
Original line number Diff line number Diff line
#ifndef __NVIF_DRIVER_H__
#define __NVIF_DRIVER_H__
#include <nvif/os.h>
struct nvif_client;

struct nvif_driver {
	const char *name;
@@ -14,9 +16,11 @@ struct nvif_driver {
	bool keep;
};

int nvif_driver_init(const char *drv, const char *cfg, const char *dbg,
		     const char *name, u64 device, struct nvif_client *);

extern const struct nvif_driver nvif_driver_nvkm;
extern const struct nvif_driver nvif_driver_drm;
extern const struct nvif_driver nvif_driver_lib;
extern const struct nvif_driver nvif_driver_null;

#endif
+7 −0
Original line number Diff line number Diff line
#ifndef __NVIF_IF0000_H__
#define __NVIF_IF0000_H__

struct nvif_client_v0 {
	__u8  version;
	__u8  pad01[7];
	__u64 device;
	char  name[32];
};

#define NVIF_CLIENT_V0_DEVLIST                                             0x00

struct nvif_client_devlist_v0 {
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ int nvkm_client_new(const char *name, u64 device, const char *cfg,
		     const char *dbg,
		     int (*)(const void *, u32, const void *, u32),
		     struct nvkm_client **);
struct nvkm_client *nvkm_client_search(struct nvkm_client *, u64 handle);

int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
			   void *data, u32 size);
+4 −2
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@
#include <core/pci.h>
#include <core/tegra.h>

#include <nvif/driver.h>

#include <nvif/class.h>
#include <nvif/cl0002.h>
#include <nvif/cla06f.h>
@@ -119,8 +121,8 @@ nouveau_cli_create(struct drm_device *dev, const char *sname,
		snprintf(cli->name, sizeof(cli->name), "%s", sname);
		cli->dev = dev;

		ret = nvif_client_init(NULL, cli->name, nouveau_name(dev),
				       nouveau_config, nouveau_debug,
		ret = nvif_driver_init(NULL, nouveau_config, nouveau_debug,
				       cli->name, nouveau_name(dev),
				       &cli->base);
		if (ret == 0) {
			mutex_init(&cli->mutex);
Loading