0001
0002
0003 #ifndef _DRM_CLIENT_H_
0004 #define _DRM_CLIENT_H_
0005
0006 #include <linux/iosys-map.h>
0007 #include <linux/lockdep.h>
0008 #include <linux/mutex.h>
0009 #include <linux/types.h>
0010
0011 #include <drm/drm_connector.h>
0012 #include <drm/drm_crtc.h>
0013
0014 struct drm_client_dev;
0015 struct drm_device;
0016 struct drm_file;
0017 struct drm_framebuffer;
0018 struct drm_gem_object;
0019 struct drm_minor;
0020 struct module;
0021
0022
0023
0024
0025 struct drm_client_funcs {
0026
0027
0028
0029 struct module *owner;
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 void (*unregister)(struct drm_client_dev *client);
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 int (*restore)(struct drm_client_dev *client);
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 int (*hotplug)(struct drm_client_dev *client);
0066 };
0067
0068
0069
0070
0071 struct drm_client_dev {
0072
0073
0074
0075 struct drm_device *dev;
0076
0077
0078
0079
0080 const char *name;
0081
0082
0083
0084
0085
0086
0087
0088 struct list_head list;
0089
0090
0091
0092
0093 const struct drm_client_funcs *funcs;
0094
0095
0096
0097
0098 struct drm_file *file;
0099
0100
0101
0102
0103 struct mutex modeset_mutex;
0104
0105
0106
0107
0108 struct drm_mode_set *modesets;
0109 };
0110
0111 int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
0112 const char *name, const struct drm_client_funcs *funcs);
0113 void drm_client_release(struct drm_client_dev *client);
0114 void drm_client_register(struct drm_client_dev *client);
0115
0116 void drm_client_dev_unregister(struct drm_device *dev);
0117 void drm_client_dev_hotplug(struct drm_device *dev);
0118 void drm_client_dev_restore(struct drm_device *dev);
0119
0120
0121
0122
0123 struct drm_client_buffer {
0124
0125
0126
0127 struct drm_client_dev *client;
0128
0129
0130
0131
0132 u32 handle;
0133
0134
0135
0136
0137 u32 pitch;
0138
0139
0140
0141
0142 struct drm_gem_object *gem;
0143
0144
0145
0146
0147 struct iosys_map map;
0148
0149
0150
0151
0152 struct drm_framebuffer *fb;
0153 };
0154
0155 struct drm_client_buffer *
0156 drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);
0157 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);
0158 int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect);
0159 int drm_client_buffer_vmap(struct drm_client_buffer *buffer,
0160 struct iosys_map *map);
0161 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);
0162
0163 int drm_client_modeset_create(struct drm_client_dev *client);
0164 void drm_client_modeset_free(struct drm_client_dev *client);
0165 int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height);
0166 bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation);
0167 int drm_client_modeset_check(struct drm_client_dev *client);
0168 int drm_client_modeset_commit_locked(struct drm_client_dev *client);
0169 int drm_client_modeset_commit(struct drm_client_dev *client);
0170 int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
0171
0172
0173
0174
0175
0176
0177 #define drm_client_for_each_modeset(modeset, client) \
0178 for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \
0179 modeset = (client)->modesets; modeset->crtc; modeset++)
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191 #define drm_client_for_each_connector_iter(connector, iter) \
0192 drm_for_each_connector_iter(connector, iter) \
0193 if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
0194
0195 void drm_client_debugfs_init(struct drm_minor *minor);
0196
0197 #endif