2d0c4b7aeb0930b22a4ba3f865b18c09d4b2b585
[platform/adaptation/renesas_rcar/wayland-kms.git] / wayland-kms.h
1 /*
2  * Copyright 息 2013 Renesas Solutions Corp.
3  *
4  * Based on src/egl/wayland/wayland-drm/wayland-drm.h in Mesa.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the next
14  * paragraph) shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  *
26  * Authors:
27  *    Takanari Hayama <taki@igel.co.jp>
28  */
29
30 #ifndef WAYLAND_KMS_H
31 #define WAYLAND_KMS_H
32
33 #include <wayland-server.h>
34
35 struct wl_kms;
36
37 struct wl_kms_buffer {
38         struct wl_resource *resource;
39         struct wl_kms *kms;
40         int32_t width, height;
41         uint32_t stride, format;
42         uint32_t handle;
43         int fd;
44         void *private;
45 };
46
47 int wayland_kms_fd_get(struct wl_kms *kms);
48
49 struct wl_kms_buffer *wayland_kms_buffer_get(struct wl_resource *resource);
50
51 struct wl_kms *wayland_kms_init(struct wl_display *display,
52                                 struct wl_display *server, char *device_name, int fd);
53
54 void wayland_kms_uninit(struct wl_kms *kms);
55
56 uint32_t wayland_kms_buffer_get_format(struct wl_kms_buffer *buffer);
57
58 void *wayland_kms_buffer_get_buffer(struct wl_kms_buffer *buffer);
59
60 enum wl_kms_attribute {
61         WL_KMS_WIDTH,
62         WL_KMS_HEIGHT,
63         WL_KMS_TEXTURE_FORMAT
64 };
65
66 int wayland_kms_query_buffer(struct wl_kms *kms, struct wl_resource *resource,
67                                 enum wl_kms_attribute attr, int *value);
68
69 #endif