drm/debugfs: Add internal client debugfs file
[linux/fpc-iii.git] / include / drm / drm_client.h
blob989f8e52864dadc895f799fdf677eed375d5a816
1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _DRM_CLIENT_H_
4 #define _DRM_CLIENT_H_
6 #include <linux/types.h>
8 struct drm_client_dev;
9 struct drm_device;
10 struct drm_file;
11 struct drm_framebuffer;
12 struct drm_gem_object;
13 struct drm_minor;
14 struct module;
16 /**
17 * struct drm_client_funcs - DRM client callbacks
19 struct drm_client_funcs {
20 /**
21 * @owner: The module owner
23 struct module *owner;
25 /**
26 * @unregister:
28 * Called when &drm_device is unregistered. The client should respond by
29 * releasing it's resources using drm_client_release().
31 * This callback is optional.
33 void (*unregister)(struct drm_client_dev *client);
35 /**
36 * @restore:
38 * Called on drm_lastclose(). The first client instance in the list that
39 * returns zero gets the privilege to restore and no more clients are
40 * called. This callback is not called after @unregister has been called.
42 * This callback is optional.
44 int (*restore)(struct drm_client_dev *client);
46 /**
47 * @hotplug:
49 * Called on drm_kms_helper_hotplug_event().
50 * This callback is not called after @unregister has been called.
52 * This callback is optional.
54 int (*hotplug)(struct drm_client_dev *client);
57 /**
58 * struct drm_client_dev - DRM client instance
60 struct drm_client_dev {
61 /**
62 * @dev: DRM device
64 struct drm_device *dev;
66 /**
67 * @name: Name of the client.
69 const char *name;
71 /**
72 * @list:
74 * List of all clients of a DRM device, linked into
75 * &drm_device.clientlist. Protected by &drm_device.clientlist_mutex.
77 struct list_head list;
79 /**
80 * @funcs: DRM client functions (optional)
82 const struct drm_client_funcs *funcs;
84 /**
85 * @file: DRM file
87 struct drm_file *file;
90 int drm_client_new(struct drm_device *dev, struct drm_client_dev *client,
91 const char *name, const struct drm_client_funcs *funcs);
92 void drm_client_release(struct drm_client_dev *client);
94 void drm_client_dev_unregister(struct drm_device *dev);
95 void drm_client_dev_hotplug(struct drm_device *dev);
96 void drm_client_dev_restore(struct drm_device *dev);
98 /**
99 * struct drm_client_buffer - DRM client buffer
101 struct drm_client_buffer {
103 * @client: DRM client
105 struct drm_client_dev *client;
108 * @handle: Buffer handle
110 u32 handle;
113 * @pitch: Buffer pitch
115 u32 pitch;
118 * @gem: GEM object backing this buffer
120 struct drm_gem_object *gem;
123 * @vaddr: Virtual address for the buffer
125 void *vaddr;
128 * @fb: DRM framebuffer
130 struct drm_framebuffer *fb;
133 struct drm_client_buffer *
134 drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);
135 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);
137 int drm_client_debugfs_init(struct drm_minor *minor);
139 #endif