Subversion Repositories Kolibri OS

Rev

Rev 6110 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4363 Serge 1
/**
6110 serge 2
 * \file xf86drm.c
4363 Serge 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 
6667 serge 39
#include 
40
#include 
4363 Serge 41
#include 
42
#include 
43
#include 
6667 serge 44
#include 
6110 serge 45
#include 
4363 Serge 46
#include 
47
#include 
6667 serge 48
#include 
4363 Serge 49
#include 
6110 serge 50
#include 
51
#include 
6667 serge 52
#include 
4363 Serge 53
#include 
54
 
5068 serge 55
/* Not all systems have MAP_FAILED defined */
56
#ifndef MAP_FAILED
57
#define MAP_FAILED ((void *)-1)
58
#endif
59
 
4363 Serge 60
#include "xf86drm.h"
6110 serge 61
#include "libdrm_macros.h"
62
 
4363 Serge 63
#include 
64
 
65
#ifndef DRM_MAJOR
6110 serge 66
#define DRM_MAJOR 226		/* Linux */
4363 Serge 67
#endif
68
 
69
 
70
int drmGetMagic(int fd, drm_magic_t * magic)
71
{
72
    drm_auth_t auth;
73
 
74
    *magic = 1;
75
//    if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth))
76
//    return -errno;
77
//    *magic = auth.magic;
78
    return 0;
79
}
80
 
81
void drmFreeVersion(drmVersionPtr v)
82
{
83
    if (!v)
84
        return;
85
//    drmFree(v->name);
86
//    drmFree(v->date);
87
//    drmFree(v->desc);
88
    free(v);
89
}
90
drmVersionPtr drmGetVersion(int fd)
91
{
92
    drmVersionPtr v;
93
 
94
    v = malloc(sizeof(*v));
95
 
96
    v->version_major      = 1;
97
    v->version_minor      = 6;
98
    v->version_patchlevel = 0;
99
    v->name_len           = 4;
100
    v->name               = "i915";
101
    v->date_len           = 8;
6110 serge 102
    v->date               = "20151010";
4363 Serge 103
    v->desc_len           = 14;
104
    v->desc               = "Intel Graphics";
105
    return v;
106
}
107
 
108
int drmIoctl(int fd, unsigned long request, void *arg)
109
{
110
    ioctl_t  io;
111
 
112
    io.handle   = fd;
113
    io.io_code  = request;
114
    io.input    = arg;
115
    io.inp_size = 64;
116
    io.output   = NULL;
117
    io.out_size = 0;
118
 
119
    return call_service(&io);
120
}