Subversion Repositories Kolibri OS

Rev

Rev 4363 | Rev 6110 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /**
  2.  * \file xf86drm.c
  3.  * User-level interface to DRM device
  4.  *
  5.  * \author Rickard E. (Rik) Faith <faith@valinux.com>
  6.  * \author Kevin E. Martin <martin@valinux.com>
  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 <config.h>
  36. #endif
  37. #include <stdio.h>
  38. #include <stdlib.h>
  39. #include <string.h>
  40. #include <strings.h>
  41. #include <ctype.h>
  42. #include <fcntl.h>
  43. #include <errno.h>
  44. #include <time.h>
  45. #include <stdarg.h>
  46.  
  47. /* Not all systems have MAP_FAILED defined */
  48. #ifndef MAP_FAILED
  49. #define MAP_FAILED ((void *)-1)
  50. #endif
  51.  
  52. #include "xf86drm.h"
  53. #include <kos32sys.h>
  54.  
  55. #ifndef DRM_MAJOR
  56. #define DRM_MAJOR 226       /* Linux */
  57. #endif
  58.  
  59.  
  60. int drmGetMagic(int fd, drm_magic_t * magic)
  61. {
  62.     drm_auth_t auth;
  63.  
  64.     *magic = 1;
  65. //    if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth))
  66. //    return -errno;
  67. //    *magic = auth.magic;
  68.     return 0;
  69. }
  70.  
  71. void drmFreeVersion(drmVersionPtr v)
  72. {
  73.     if (!v)
  74.         return;
  75. //    drmFree(v->name);
  76. //    drmFree(v->date);
  77. //    drmFree(v->desc);
  78.     free(v);
  79. }
  80. drmVersionPtr drmGetVersion(int fd)
  81. {
  82.     drmVersionPtr v;
  83.  
  84.     v = malloc(sizeof(*v));
  85.  
  86.     v->version_major      = 1;
  87.     v->version_minor      = 6;
  88.     v->version_patchlevel = 0;
  89.     v->name_len           = 4;
  90.     v->name               = "i915";
  91.     v->date_len           = 8;
  92.     v->date               = "20080730";
  93.     v->desc_len           = 14;
  94.     v->desc               = "Intel Graphics";
  95.     return v;
  96. }
  97.  
  98. int drmIoctl(int fd, unsigned long request, void *arg)
  99. {
  100.     ioctl_t  io;
  101.  
  102.     io.handle   = fd;
  103.     io.io_code  = request;
  104.     io.input    = arg;
  105.     io.inp_size = 64;
  106.     io.output   = NULL;
  107.     io.out_size = 0;
  108.  
  109.     return call_service(&io);
  110. }
  111.