Subversion Repositories Kolibri OS

Rev

Rev 5068 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4363 Serge 1
/**
2
 * \file xf86drm.c
3
 * User-level interface to DRM device
4
 *
5
 * \author Rickard E. (Rik) Faith 
6
 * \author Kevin E. Martin 
7
 */
8
 
9
/*
10
 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12
 * All Rights Reserved.
13
 *
14
 * Permission is hereby granted, free of charge, to any person obtaining a
15
 * copy of this software and associated documentation files (the "Software"),
16
 * to deal in the Software without restriction, including without limitation
17
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
 * and/or sell copies of the Software, and to permit persons to whom the
19
 * Software is furnished to do so, subject to the following conditions:
20
 *
21
 * The above copyright notice and this permission notice (including the next
22
 * paragraph) shall be included in all copies or substantial portions of the
23
 * Software.
24
 *
25
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
28
 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
29
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31
 * DEALINGS IN THE SOFTWARE.
32
 */
33
 
34
#ifdef HAVE_CONFIG_H
35
# include 
36
#endif
37
#include 
38
#include 
39
#include 
40
#include 
41
#include 
42
#include 
43
#include 
44
#include 
45
#include 
46
 
47
#include "xf86drm.h"
48
#include 
49
 
50
#ifndef DRM_MAJOR
51
#define DRM_MAJOR 226       /* Linux */
52
#endif
53
 
54
 
55
int drmGetMagic(int fd, drm_magic_t * magic)
56
{
57
    drm_auth_t auth;
58
 
59
    *magic = 1;
60
//    if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth))
61
//    return -errno;
62
//    *magic = auth.magic;
63
    return 0;
64
}
65
 
66
void drmFreeVersion(drmVersionPtr v)
67
{
68
    if (!v)
69
        return;
70
//    drmFree(v->name);
71
//    drmFree(v->date);
72
//    drmFree(v->desc);
73
    free(v);
74
}
75
drmVersionPtr drmGetVersion(int fd)
76
{
77
    drmVersionPtr v;
78
 
79
    v = malloc(sizeof(*v));
80
 
81
    v->version_major      = 1;
82
    v->version_minor      = 6;
83
    v->version_patchlevel = 0;
84
    v->name_len           = 4;
85
    v->name               = "i915";
86
    v->date_len           = 8;
87
    v->date               = "20080730";
88
    v->desc_len           = 14;
89
    v->desc               = "Intel Graphics";
90
    return v;
91
}
92
 
93
int drmIoctl(int fd, unsigned long request, void *arg)
94
{
95
    ioctl_t  io;
96
 
97
    io.handle   = fd;
98
    io.io_code  = request;
99
    io.input    = arg;
100
    io.inp_size = 64;
101
    io.output   = NULL;
102
    io.out_size = 0;
103
 
104
    return call_service(&io);
105
}