Subversion Repositories Kolibri OS

Rev

Rev 4358 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
/*
2
 * Mesa 3-D graphics library
3
 *
4
 * Copyright (C) 2010 Chia-I Wu 
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 shall be included
14
 * in all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
 * DEALINGS IN THE SOFTWARE.
23
 */
24
 
25
#ifndef _NATIVE_DRM_H_
26
#define _NATIVE_DRM_H_
27
 
28
#include 
29
#include 
30
 
31
#include "pipe/p_compiler.h"
32
#include "util/u_format.h"
33
#include "pipe/p_state.h"
34
#include "state_tracker/drm_driver.h"
35
 
36
#include "common/native.h"
37
#include "common/native_helper.h"
38
 
39
#include "gbm_gallium_drmint.h"
40
 
41
struct drm_config;
42
struct drm_crtc;
43
struct drm_connector;
44
struct drm_mode;
45
struct drm_surface;
46
 
47
struct drm_display {
48
   struct native_display base;
49
 
50
   const struct native_event_handler *event_handler;
51
 
52
   struct gbm_gallium_drm_device *gbmdrm;
53
   int own_gbm;
54
   int fd;
55
   char *device_name;
56
   struct drm_config *config;
57
 
58
   /* for modesetting */
59
   drmModeResPtr resources;
60
   struct drm_connector *connectors;
61
   int num_connectors;
62
 
63
   struct drm_surface **shown_surfaces;
64
   /* save the original settings of the CRTCs */
65
   struct drm_crtc *saved_crtcs;
66
};
67
 
68
struct drm_config {
69
   struct native_config base;
70
};
71
 
72
struct drm_crtc {
73
   drmModeCrtcPtr crtc;
74
   uint32_t connectors[32];
75
   int num_connectors;
76
};
77
 
78
struct drm_framebuffer {
79
   struct pipe_resource *texture;
80
   boolean is_passive;
81
 
82
   uint32_t buffer_id;
83
};
84
 
85
struct drm_surface {
86
   struct native_surface base;
87
   struct drm_display *drmdpy;
88
 
89
   struct resource_surface *rsurf;
90
   enum pipe_format color_format;
91
   int width, height;
92
 
93
   unsigned int sequence_number;
94
   struct drm_framebuffer front_fb, back_fb;
95
 
96
   boolean is_shown;
97
   struct drm_crtc current_crtc;
98
 
99
   boolean have_pageflip;
100
};
101
 
102
struct drm_connector {
103
   struct native_connector base;
104
 
105
   uint32_t connector_id;
106
   drmModeConnectorPtr connector;
107
   struct drm_mode *drm_modes;
108
   int num_modes;
109
};
110
 
111
struct drm_mode {
112
   struct native_mode base;
113
   drmModeModeInfo mode;
114
};
115
 
116
static INLINE struct drm_display *
117
drm_display(const struct native_display *ndpy)
118
{
119
   return (struct drm_display *) ndpy;
120
}
121
 
122
static INLINE struct drm_config *
123
drm_config(const struct native_config *nconf)
124
{
125
   return (struct drm_config *) nconf;
126
}
127
 
128
static INLINE struct drm_surface *
129
drm_surface(const struct native_surface *nsurf)
130
{
131
   return (struct drm_surface *) nsurf;
132
}
133
 
134
static INLINE struct drm_connector *
135
drm_connector(const struct native_connector *nconn)
136
{
137
   return (struct drm_connector *) nconn;
138
}
139
 
140
static INLINE struct drm_mode *
141
drm_mode(const struct native_mode *nmode)
142
{
143
   return (struct drm_mode *) nmode;
144
}
145
 
146
boolean
147
drm_display_init_modeset(struct native_display *ndpy);
148
 
149
void
150
drm_display_fini_modeset(struct native_display *ndpy);
151
 
152
struct native_surface *
153
drm_display_create_surface_from_resource(struct native_display *ndpy,
154
                                         struct pipe_resource *resource);
155
 
156
#endif /* _NATIVE_DRM_H_ */