~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/drm_client.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 or MIT */
  2 
  3 #ifndef _DRM_CLIENT_H_
  4 #define _DRM_CLIENT_H_
  5 
  6 #include <linux/iosys-map.h>
  7 #include <linux/lockdep.h>
  8 #include <linux/mutex.h>
  9 #include <linux/types.h>
 10 
 11 #include <drm/drm_connector.h>
 12 #include <drm/drm_crtc.h>
 13 
 14 struct drm_client_dev;
 15 struct drm_device;
 16 struct drm_file;
 17 struct drm_framebuffer;
 18 struct drm_gem_object;
 19 struct drm_minor;
 20 struct module;
 21 
 22 /**
 23  * struct drm_client_funcs - DRM client callbacks
 24  */
 25 struct drm_client_funcs {
 26         /**
 27          * @owner: The module owner
 28          */
 29         struct module *owner;
 30 
 31         /**
 32          * @unregister:
 33          *
 34          * Called when &drm_device is unregistered. The client should respond by
 35          * releasing its resources using drm_client_release().
 36          *
 37          * This callback is optional.
 38          */
 39         void (*unregister)(struct drm_client_dev *client);
 40 
 41         /**
 42          * @restore:
 43          *
 44          * Called on drm_lastclose(). The first client instance in the list that
 45          * returns zero gets the privilege to restore and no more clients are
 46          * called. This callback is not called after @unregister has been called.
 47          *
 48          * Note that the core does not guarantee exclusion against concurrent
 49          * drm_open(). Clients need to ensure this themselves, for example by
 50          * using drm_master_internal_acquire() and
 51          * drm_master_internal_release().
 52          *
 53          * This callback is optional.
 54          */
 55         int (*restore)(struct drm_client_dev *client);
 56 
 57         /**
 58          * @hotplug:
 59          *
 60          * Called on drm_kms_helper_hotplug_event().
 61          * This callback is not called after @unregister has been called.
 62          *
 63          * This callback is optional.
 64          */
 65         int (*hotplug)(struct drm_client_dev *client);
 66 };
 67 
 68 /**
 69  * struct drm_client_dev - DRM client instance
 70  */
 71 struct drm_client_dev {
 72         /**
 73          * @dev: DRM device
 74          */
 75         struct drm_device *dev;
 76 
 77         /**
 78          * @name: Name of the client.
 79          */
 80         const char *name;
 81 
 82         /**
 83          * @list:
 84          *
 85          * List of all clients of a DRM device, linked into
 86          * &drm_device.clientlist. Protected by &drm_device.clientlist_mutex.
 87          */
 88         struct list_head list;
 89 
 90         /**
 91          * @funcs: DRM client functions (optional)
 92          */
 93         const struct drm_client_funcs *funcs;
 94 
 95         /**
 96          * @file: DRM file
 97          */
 98         struct drm_file *file;
 99 
100         /**
101          * @modeset_mutex: Protects @modesets.
102          */
103         struct mutex modeset_mutex;
104 
105         /**
106          * @modesets: CRTC configurations
107          */
108         struct drm_mode_set *modesets;
109 
110         /**
111          * @hotplug_failed:
112          *
113          * Set by client hotplug helpers if the hotplugging failed
114          * before. It is usually not tried again.
115          */
116         bool hotplug_failed;
117 };
118 
119 int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
120                     const char *name, const struct drm_client_funcs *funcs);
121 void drm_client_release(struct drm_client_dev *client);
122 void drm_client_register(struct drm_client_dev *client);
123 
124 void drm_client_dev_unregister(struct drm_device *dev);
125 void drm_client_dev_hotplug(struct drm_device *dev);
126 void drm_client_dev_restore(struct drm_device *dev);
127 
128 /**
129  * struct drm_client_buffer - DRM client buffer
130  */
131 struct drm_client_buffer {
132         /**
133          * @client: DRM client
134          */
135         struct drm_client_dev *client;
136 
137         /**
138          * @pitch: Buffer pitch
139          */
140         u32 pitch;
141 
142         /**
143          * @gem: GEM object backing this buffer
144          *
145          * FIXME: The dependency on GEM here isn't required, we could
146          * convert the driver handle to a dma-buf instead and use the
147          * backend-agnostic dma-buf vmap support instead. This would
148          * require that the handle2fd prime ioctl is reworked to pull the
149          * fd_install step out of the driver backend hooks, to make that
150          * final step optional for internal users.
151          */
152         struct drm_gem_object *gem;
153 
154         /**
155          * @map: Virtual address for the buffer
156          */
157         struct iosys_map map;
158 
159         /**
160          * @fb: DRM framebuffer
161          */
162         struct drm_framebuffer *fb;
163 };
164 
165 struct drm_client_buffer *
166 drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);
167 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);
168 int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect);
169 int drm_client_buffer_vmap_local(struct drm_client_buffer *buffer,
170                                  struct iosys_map *map_copy);
171 void drm_client_buffer_vunmap_local(struct drm_client_buffer *buffer);
172 int drm_client_buffer_vmap(struct drm_client_buffer *buffer,
173                            struct iosys_map *map);
174 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);
175 
176 int drm_client_modeset_create(struct drm_client_dev *client);
177 void drm_client_modeset_free(struct drm_client_dev *client);
178 int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height);
179 bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation);
180 int drm_client_modeset_check(struct drm_client_dev *client);
181 int drm_client_modeset_commit_locked(struct drm_client_dev *client);
182 int drm_client_modeset_commit(struct drm_client_dev *client);
183 int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
184 
185 /**
186  * drm_client_for_each_modeset() - Iterate over client modesets
187  * @modeset: &drm_mode_set loop cursor
188  * @client: DRM client
189  */
190 #define drm_client_for_each_modeset(modeset, client) \
191         for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \
192              modeset = (client)->modesets; modeset->crtc; modeset++)
193 
194 /**
195  * drm_client_for_each_connector_iter - connector_list iterator macro
196  * @connector: &struct drm_connector pointer used as cursor
197  * @iter: &struct drm_connector_list_iter
198  *
199  * This iterates the connectors that are useable for internal clients (excludes
200  * writeback connectors).
201  *
202  * For more info see drm_for_each_connector_iter().
203  */
204 #define drm_client_for_each_connector_iter(connector, iter) \
205         drm_for_each_connector_iter(connector, iter) \
206                 if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
207 
208 void drm_client_debugfs_init(struct drm_device *dev);
209 
210 #endif
211 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php