XenevaOS
Loading...
Searching...
No Matches
drm_encoder.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef __DRM_ENCODER_H__
24#define __DRM_ENCODER_H__
25
26#include <linux/list.h>
27#include <linux/ctype.h>
28#include <linux/mutex.h>
29#include <drm/drm_crtc.h>
30#include <drm/drm_mode.h>
31#include <drm/drm_mode_object.h>
32#include <drm/drm_util.h>
33
34struct drm_encoder;
35
49 void (*reset)(struct drm_encoder *encoder);
50
58 void (*destroy)(struct drm_encoder *encoder);
59
74
85
91 void (*debugfs_init)(struct drm_encoder *encoder, struct dentry *root);
92};
93
206
207#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
208
210int drm_encoder_init(struct drm_device *dev,
213 int encoder_type, const char *name, ...);
214
215__printf(5, 6)
216int drmm_encoder_init(struct drm_device *dev,
217 struct drm_encoder *encoder,
218 const struct drm_encoder_funcs *funcs,
219 int encoder_type, const char *name, ...);
220
222void *__drmm_encoder_alloc(struct drm_device *dev,
223 size_t size, size_t offset,
224 const struct drm_encoder_funcs *funcs,
225 int encoder_type,
226 const char *name, ...);
227
246#define drmm_encoder_alloc(dev, type, member, funcs, encoder_type, name, ...) \
247 ((type *)__drmm_encoder_alloc(dev, sizeof(type), \
248 offsetof(type, member), funcs, \
249 encoder_type, name, ##__VA_ARGS__))
250
264#define drmm_plain_encoder_alloc(dev, funcs, encoder_type, name, ...) \
265 ((struct drm_encoder *) \
266 __drmm_encoder_alloc(dev, sizeof(struct drm_encoder), \
267 0, funcs, encoder_type, name, ##__VA_ARGS__))
268
276static inline unsigned int drm_encoder_index(const struct drm_encoder *encoder)
277{
278 return encoder->index;
279}
280
288static inline u32 drm_encoder_mask(const struct drm_encoder *encoder)
289{
290 return 1 << drm_encoder_index(encoder);
291}
292
300static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
301 struct drm_crtc *crtc)
302{
303 return !!(encoder->possible_crtcs & drm_crtc_mask(crtc));
304}
305
315static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
316 struct drm_file *file_priv,
317 uint32_t id)
318{
319 struct drm_mode_object *mo;
320
322
323 return mo ? obj_to_encoder(mo) : NULL;
324}
325
327
336#define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \
337 list_for_each_entry((encoder), &(dev)->mode_config.encoder_list, head) \
338 for_each_if ((encoder_mask) & drm_encoder_mask(encoder))
339
347#define drm_for_each_encoder(encoder, dev) \
348 list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head)
349
350#endif
unsigned int uint32_t
Definition acefiex.h:163
#define NULL
Definition actypes.h:561
#define __printf(fmt_idx, arg_idx)
Definition compiler.h:144
#define DRM_MODE_OBJECT_ENCODER
Definition drm_mode.h:615
struct drm_crtc * crtc
Definition drm_crtc.h:1238
struct drm_encoder * encoder
Definition drm_encoder.h:211
struct drm_encoder const struct drm_encoder_funcs * funcs
Definition drm_encoder.h:212
struct drm_encoder const struct drm_encoder_funcs int const char * name
Definition drm_encoder.h:213
#define obj_to_encoder(x)
Definition drm_encoder.h:207
struct drm_encoder const struct drm_encoder_funcs int const char struct drm_encoder const struct drm_encoder_funcs int const char size_t size_t offset
Definition drm_encoder.h:223
struct drm_encoder const struct drm_encoder_funcs int encoder_type
Definition drm_encoder.h:213
struct drm_encoder const struct drm_encoder_funcs int const char struct drm_encoder const struct drm_encoder_funcs int const char size_t size
Definition drm_encoder.h:223
void drm_encoder_cleanup(struct drm_encoder *encoder)
struct drm_mode_object * drm_mode_object_find(struct drm_device *dev, struct drm_file *file_priv, uint32_t id, uint32_t type)
const struct device * dev
Definition drm_print.h:519
uint32_t u32
Definition kernel.h:16
int const struct list_head const struct list_head struct list_head * head
Definition list_sort.h:13
Definition drm_crtc.h:955
Definition drm_device.h:75
Definition drm_encoder.h:41
void(* destroy)(struct drm_encoder *encoder)
Definition drm_encoder.h:58
void(* reset)(struct drm_encoder *encoder)
Definition drm_encoder.h:49
int(* late_register)(struct drm_encoder *encoder)
Definition drm_encoder.h:73
void(* debugfs_init)(struct drm_encoder *encoder, struct dentry *root)
Definition drm_encoder.h:91
void(* early_unregister)(struct drm_encoder *encoder)
Definition drm_encoder.h:84
Definition drm_modeset_helper_vtables.h:501
Definition drm_encoder.h:106
struct dentry * debugfs_entry
Definition drm_encoder.h:204
struct mutex bridge_chain_mutex
Definition drm_encoder.h:194
struct drm_mode_object base
Definition drm_encoder.h:110
struct drm_device * dev
Definition drm_encoder.h:107
unsigned index
Definition drm_encoder.h:144
const struct drm_encoder_funcs * funcs
Definition drm_encoder.h:196
struct drm_crtc * crtc
Definition drm_encoder.h:185
uint32_t possible_crtcs
Definition drm_encoder.h:157
const struct drm_encoder_helper_funcs * helper_private
Definition drm_encoder.h:197
int encoder_type
Definition drm_encoder.h:138
uint32_t possible_clones
Definition drm_encoder.h:178
char * name
Definition drm_encoder.h:111
struct list_head bridge_chain
Definition drm_encoder.h:191
Definition drm_file.h:165
Definition drm_mode_object.h:55
Definition list.h:11
Definition mutex.h:59
TTY * root
Definition tty.cpp:47