XenevaOS
Loading...
Searching...
No Matches
drm_framebuffer.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_FRAMEBUFFER_H__
24#define __DRM_FRAMEBUFFER_H__
25
26#include <linux/bits.h>
27#include <linux/ctype.h>
28#include <linux/list.h>
29#include <linux/sched.h>
30
31#include <drm/drm_fourcc.h>
32#include <drm/drm_mode_object.h>
33
34struct drm_clip_rect;
35struct drm_device;
36struct drm_file;
37struct drm_framebuffer;
38struct drm_gem_object;
39
54 void (*destroy)(struct drm_framebuffer *framebuffer);
55
74 int (*create_handle)(struct drm_framebuffer *fb,
75 struct drm_file *file_priv,
76 unsigned int *handle);
98 int (*dirty)(struct drm_framebuffer *framebuffer,
99 struct drm_file *file_priv, unsigned flags,
100 unsigned color, struct drm_clip_rect *clips,
101 unsigned num_clips);
102};
103
104#define DRM_FRAMEBUFFER_HAS_HANDLE_REF(_i) BIT(0u + (_i))
105
210
211#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
212
214 struct drm_framebuffer *fb,
215 const struct drm_framebuffer_funcs *funcs);
217 struct drm_file *file_priv,
218 uint32_t id);
222
229static inline void drm_framebuffer_get(struct drm_framebuffer *fb)
230{
232}
233
241static inline void drm_framebuffer_put(struct drm_framebuffer *fb)
242{
244}
245
252static inline uint32_t drm_framebuffer_read_refcount(const struct drm_framebuffer *fb)
253{
254 return kref_read(&fb->base.refcount);
255}
256
265static inline void drm_framebuffer_assign(struct drm_framebuffer **p,
266 struct drm_framebuffer *fb)
267{
268 if (fb)
269 drm_framebuffer_get(fb);
270 if (*p)
271 drm_framebuffer_put(*p);
272 *p = fb;
273}
274
275/*
276 * drm_for_each_fb - iterate over all framebuffers
277 * @fb: the loop cursor
278 * @dev: the DRM device
279 *
280 * Iterate over all framebuffers of @dev. User must hold
281 * &drm_mode_config.fb_lock.
282 */
283#define drm_for_each_fb(fb, dev) \
284 for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), \
285 fb = list_first_entry(&(dev)->mode_config.fb_list, \
286 struct drm_framebuffer, head); \
287 &fb->head != (&(dev)->mode_config.fb_list); \
288 fb = list_next_entry(fb, head))
289
325
326#define fb_to_afbc_fb(x) container_of(x, struct drm_afbc_framebuffer, base)
327
328#endif
uint8_t flags
Definition virtio.h:0
unsigned int uint32_t
Definition acefiex.h:163
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
#define DRM_FORMAT_MAX_PLANES
Definition drm_fourcc.h:32
size_t size_t const struct drm_bridge_funcs * funcs
Definition drm_bridge.h:1300
void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
struct drm_framebuffer * drm_framebuffer_lookup(struct drm_device *dev, struct drm_file *file_priv, uint32_t id)
int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, const struct drm_framebuffer_funcs *funcs)
void drm_framebuffer_unregister_private(struct drm_framebuffer *fb)
void drm_framebuffer_remove(struct drm_framebuffer *fb)
void drm_mode_object_put(struct drm_mode_object *obj)
void drm_mode_object_get(struct drm_mode_object *obj)
const struct device * dev
Definition drm_print.h:519
uint32_t u32
Definition kernel.h:16
@ TASK_COMM_LEN
Definition sched.h:118
int const struct list_head const struct list_head struct list_head * head
Definition list_sort.h:13
Definition i_video.h:141
Definition drm_framebuffer.h:295
struct drm_framebuffer base
Definition drm_framebuffer.h:299
u32 offset
Definition drm_framebuffer.h:319
u32 afbc_size
Definition drm_framebuffer.h:323
u32 aligned_width
Definition drm_framebuffer.h:311
u32 block_width
Definition drm_framebuffer.h:303
u32 block_height
Definition drm_framebuffer.h:307
u32 aligned_height
Definition drm_framebuffer.h:315
Definition drm.h:78
Definition drm_device.h:75
Definition drm_file.h:165
Definition drm_fourcc.h:61
Definition drm_framebuffer.h:43
void(* destroy)(struct drm_framebuffer *framebuffer)
Definition drm_framebuffer.h:54
int(* dirty)(struct drm_framebuffer *framebuffer, struct drm_file *file_priv, unsigned flags, unsigned color, struct drm_clip_rect *clips, unsigned num_clips)
Definition drm_framebuffer.h:98
int(* create_handle)(struct drm_framebuffer *fb, struct drm_file *file_priv, unsigned int *handle)
Definition drm_framebuffer.h:74
Definition drm_framebuffer.h:120
const struct drm_framebuffer_funcs * funcs
Definition drm_framebuffer.h:148
const struct drm_format_info * format
Definition drm_framebuffer.h:144
unsigned int internal_flags
Definition drm_framebuffer.h:197
unsigned int width
Definition drm_framebuffer.h:183
struct drm_mode_object base
Definition drm_framebuffer.h:134
unsigned int height
Definition drm_framebuffer.h:188
uint64_t modifier
Definition drm_framebuffer.h:178
struct drm_gem_object * obj[DRM_FORMAT_MAX_PLANES]
Definition drm_framebuffer.h:208
struct list_head filp_head
Definition drm_framebuffer.h:201
unsigned int offsets[DRM_FORMAT_MAX_PLANES]
Definition drm_framebuffer.h:171
unsigned int pitches[DRM_FORMAT_MAX_PLANES]
Definition drm_framebuffer.h:153
struct drm_device * dev
Definition drm_framebuffer.h:124
char comm[TASK_COMM_LEN]
Definition drm_framebuffer.h:139
int flags
Definition drm_framebuffer.h:193
Definition drm_gem.h:277
Definition drm_mode_object.h:55
struct kref refcount
Definition drm_mode_object.h:59
Definition list.h:11