Subversion Repositories Kolibri OS

Rev

Rev 2342 | Rev 2351 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2342 Rev 2344
Line 12... Line 12...
12
#include 
12
#include 
13
#include 
13
#include 
Line 14... Line 14...
14
 
14
 
Line -... Line 15...
-
 
15
#include "bitmap.h"
-
 
16
 
15
#include "bitmap.h"
17
void cpu_detect();
16
 
18
 
17
void parse_cmdline(char *cmdline, char *log);
19
void parse_cmdline(char *cmdline, char *log);
Line 18... Line 20...
18
int _stdcall display_handler(ioctl_t *io);
20
int _stdcall display_handler(ioctl_t *io);
19
int init_agp(void);
21
int init_agp(void);
20
 
22
 
Line 21... Line 23...
21
int create_video(int width, int height, u32_t *outp);
23
int create_video(int width, int height, u32_t *outp);
Line -... Line 24...
-
 
24
int video_blit(uint64_t src_offset, int  x, int y,
-
 
25
                    int w, int h, int pitch);
22
int video_blit(uint64_t src_offset, int  x, int y,
26
 
Line 23... Line 27...
23
                    int w, int h, int pitch);
27
static char  log[256];
24
 
28
 
25
static char  log[256];
29
int x86_clflush_size;
Line 69... Line 73...
69
        dbgprintf("Set DISPLAY handler\n");
73
        dbgprintf("Set DISPLAY handler\n");
Line 70... Line 74...
70
 
74
 
71
    return err;
75
    return err;
Line -... Line 76...
-
 
76
};
-
 
77
 
-
 
78
#define CURRENT_API     0x0200      /*      2.00     */
-
 
79
#define COMPATIBLE_API  0x0100      /*      1.00     */
72
};
80
 
-
 
81
#define API_VERSION     (COMPATIBLE_API << 16) | CURRENT_API
Line 73... Line 82...
73
 
82
#define DISPLAY_VERSION  CURRENT_API
74
#define API_VERSION     0x01000100
83
 
75
 
84
 
Line 76... Line 85...
76
#define SRV_GETVERSION      0
85
#define SRV_GETVERSION       0
Line 77... Line 86...
77
#define SRV_ENUM_MODES      1
86
#define SRV_ENUM_MODES       1
Line 78... Line 87...
78
#define SRV_SET_MODE        2
87
#define SRV_SET_MODE         2
79
 
88
 
Line 100... Line 109...
100
 
109
 
101
    switch(io->io_code)
110
    switch(io->io_code)
102
    {
111
    {
103
        case SRV_GETVERSION:
112
        case SRV_GETVERSION:
104
            check_output(4);
113
            check_output(4);
105
            *outp  = API_VERSION;
114
            *outp  = DISPLAY_VERSION;
106
            retval = 0;
115
            retval = 0;
Line 107... Line 116...
107
            break;
116
            break;
108
 
117
 
Line 121... Line 130...
121
            check_input(sizeof(videomode_t));
130
            check_input(sizeof(videomode_t));
122
            if( i915_modeset )
131
            if( i915_modeset )
123
                retval = set_user_mode((videomode_t*)inp);
132
                retval = set_user_mode((videomode_t*)inp);
124
            break;
133
            break;
Line 125... Line 134...
125
 
134
 
126
        case SRV_CREATE_BITMAP:
135
        case SRV_CREATE_SURFACE:
127
            check_input(5);
136
//            check_input(8);
128
            retval = create_bitmap((struct ubitmap*)inp);
137
            retval = create_surface((struct io_call_10*)inp);
Line 129... Line 138...
129
            break;
138
            break;
130
 
139
 
Line 200... Line 209...
200
        };
209
        };
201
        c = *p++;
210
        c = *p++;
202
    };
211
    };
203
};
212
};
Line -... Line 213...
-
 
213
 
-
 
214
static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
-
 
215
                           unsigned int *ecx, unsigned int *edx)
-
 
216
{
-
 
217
    /* ecx is often an input as well as an output. */
-
 
218
    asm volatile(
-
 
219
        "cpuid"
-
 
220
        : "=a" (*eax),
-
 
221
          "=b" (*ebx),
-
 
222
          "=c" (*ecx),
-
 
223
          "=d" (*edx)
-
 
224
        : "" (*eax), "2" (*ecx));
-
 
225
}
-
 
226
 
-
 
227
static inline void cpuid(unsigned int op,
-
 
228
                         unsigned int *eax, unsigned int *ebx,
-
 
229
                         unsigned int *ecx, unsigned int *edx)
-
 
230
{
-
 
231
        *eax = op;
-
 
232
        *ecx = 0;
-
 
233
        __cpuid(eax, ebx, ecx, edx);
-
 
234
}
-
 
235
 
-
 
236
void cpu_detect()
-
 
237
{
-
 
238
    u32 junk, tfms, cap0, misc;
-
 
239
 
-
 
240
    cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
-
 
241
 
-
 
242
    if (cap0 & (1<<19))
-
 
243
    {
-
 
244
        x86_clflush_size = ((misc >> 8) & 0xff) * 8;
-
 
245
    }
-
 
246
}