diff options
author | Jakub 'cz_jc' Novák <jc.bl.dws@gmail.com> | 2010-06-16 22:15:50 +0200 |
---|---|---|
committer | Jakub 'cz_jc' Novák <jc.bl.dws@gmail.com> | 2010-06-16 22:15:50 +0200 |
commit | aedc2ffb8144657c8286bfdd24bfedcdf83abe5c (patch) | |
tree | 96d5e8d32afda769197771cf43ab378ecfba8fa8 /x11-libs | |
parent | fix sets.conf "openmoko-target reponame" issue (diff) | |
download | embedded-cross-aedc2ffb8144657c8286bfdd24bfedcdf83abe5c.tar.gz embedded-cross-aedc2ffb8144657c8286bfdd24bfedcdf83abe5c.tar.bz2 embedded-cross-aedc2ffb8144657c8286bfdd24bfedcdf83abe5c.zip |
xf86-video-glamo fixes, libdrm with glamo support
x11-drivers/xf86-video-glamo:
- Converted to EAPI 2
- Added KMS use flag
- Now depends on x11-libs/libdrm[video_cards_glamo]
x11-libs/libdrm:
- Initial commit of upstream libdrm patched with glamo support.
- Changes copied from: http://git.bitwiz.org.uk/?p=libdrm.git;a=summary
Original made by Thomas White et al. who hereby have our thanks.
Thanks sleipnir :)
Diffstat (limited to 'x11-libs')
-rw-r--r-- | x11-libs/libdrm/Manifest | 3 | ||||
-rw-r--r-- | x11-libs/libdrm/files/libdrm-2.4.20-glamo.patch | 1088 | ||||
-rw-r--r-- | x11-libs/libdrm/libdrm-2.4.20.ebuild | 51 |
3 files changed, 1142 insertions, 0 deletions
diff --git a/x11-libs/libdrm/Manifest b/x11-libs/libdrm/Manifest new file mode 100644 index 0000000..0071257 --- /dev/null +++ b/x11-libs/libdrm/Manifest @@ -0,0 +1,3 @@ +AUX libdrm-2.4.20-glamo.patch 36132 RMD160 48a6b18dadb7180e1ea158f7bf4fd3b92baf0d87 SHA1 2b591ef5cdb0dc572085150194f6ac6b903008d2 SHA256 064408b073efbed7f53a3efbafe405c73343fdc7f19d96e20ffa88e3eddaa25a +DIST libdrm-2.4.20.tar.bz2 400812 RMD160 5581c45abfb9cb2bd0b95d4754d7812bb8323e3a SHA1 f1448ac0f1c7a5f74a86d2fb50941fc12dc932db SHA256 24b5316839c1d459066eaee160132d45931462e301740a660932907350415cb9 +EBUILD libdrm-2.4.20.ebuild 1552 RMD160 fa604492cbe46442008231aa0ea4aa599c7c1c55 SHA1 7c9aaad6554e40d654fecb5de2292fc91f2ab1ba SHA256 494390c3ab3d748ea29da117d03245888e44ecbd3b2f063d4842fa93a2a415e5 diff --git a/x11-libs/libdrm/files/libdrm-2.4.20-glamo.patch b/x11-libs/libdrm/files/libdrm-2.4.20-glamo.patch new file mode 100644 index 0000000..d9d6103 --- /dev/null +++ b/x11-libs/libdrm/files/libdrm-2.4.20-glamo.patch @@ -0,0 +1,1088 @@ +--- libdrm/Makefile.am 2010-03-22 21:39:27.000000000 +0100 ++++ libdrm-glamo/Makefile.am 2010-06-11 15:54:45.208711334 +0200 +@@ -41,7 +41,11 @@ + RADEON_SUBDIR = radeon + endif + +-SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) tests include ++if HAVE_GLAMO ++GLAMO_SUBDIR = glamo ++endif ++ ++SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(GLAMO_SUBDIR) tests include + + libdrm_la_LTLIBRARIES = libdrm.la + libdrm_ladir = $(libdir) +--- libdrm/configure.ac 2010-04-02 22:45:40.000000000 +0200 ++++ libdrm-glamo/configure.ac 2010-06-12 02:39:08.323460456 +0200 +@@ -46,8 +46,8 @@ + + AC_ARG_ENABLE(libkms, + AS_HELP_STRING([--disable-libkms], +- [Disable KMS mm abstraction library (default: enabled)]), +- [LIBKMS=$enableval], [LIBKMS=yes]) ++ [Disable KMS mm abstraction library (default: auto)]), ++ [LIBKMS=$enableval], [LIBKMS=auto]) + + AC_ARG_ENABLE(intel, + AS_HELP_STRING([--disable-intel], +@@ -70,6 +70,11 @@ + [NOUVEAU=$enableval], [NOUVEAU=no]) + + ++AC_ARG_ENABLE(glamo-experimental-api, ++ AS_HELP_STRING([--enable-glamo-experimental-api], ++ [Enable support for Glamo's KMS API (default: disabled)]), ++ [GLAMO=$enableval], [GLAMO=no]) ++ + dnl =========================================================================== + dnl check compiler flags + AC_DEFUN([LIBDRM_CC_TRY_FLAG], [ +@@ -146,6 +151,14 @@ + AC_DEFINE(UDEV, 1, [Have UDEV support]) + fi + ++AC_CANONICAL_HOST ++if test "x$LIBKMS" = xauto ; then ++ case $host_os in ++ linux*) LIBKMS="yes" ;; ++ *) LIBKMS="no" ;; ++ esac ++fi ++ + AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes]) + + AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) +@@ -158,6 +171,8 @@ + AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau (nvidia) support]) + fi + ++AM_CONDITIONAL(HAVE_GLAMO, [test "x$GLAMO" = xyes]) ++ + PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no]) + if test "x$HAVE_CAIRO" = xyes; then + AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support]) +@@ -251,6 +266,8 @@ + radeon/libdrm_radeon.pc + nouveau/Makefile + nouveau/libdrm_nouveau.pc ++ glamo/Makefile ++ glamo/libdrm_glamo.pc + tests/Makefile + tests/modeprint/Makefile + tests/modetest/Makefile +--- libdrm/glamo/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/Makefile.am 2010-06-11 15:54:45.209710943 +0200 +@@ -0,0 +1,52 @@ ++# Copyright (c) 2009 Thomas Whtie <taw@bitwiz.org.uk> ++# Based on libdrm-glamo Copyright © 2008 Jérôme Glisse ++# ++# Permission is hereby granted, free of charge, to any person obtaining a ++# copy of this software and associated documentation files (the "Software"), ++# to deal in the Software without restriction, including without limitation ++# the rights to use, copy, modify, merge, publish, distribute, sublicense, ++# and/or sell copies of the Software, and to permit persons to whom the ++# Software is furnished to do so, subject to the following conditions: ++# ++# The above copyright notice and this permission notice (including the next ++# paragraph) shall be included in all copies or substantial portions of the ++# Software. ++# ++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS ++# IN THE SOFTWARE. ++# ++# Authors: ++# Jérôme Glisse <glisse@freedesktop.org> ++# Thomas White <taw@bitwiz.org.uk> ++ ++AM_CFLAGS = \ ++ $(WARN_CFLAGS) \ ++ -I$(top_srcdir) \ ++ -I$(top_srcdir)/glamo \ ++ $(PTHREADSTUBS_CFLAGS) \ ++ -I$(top_srcdir)/include/drm ++ ++libdrm_glamo_la_LTLIBRARIES = libdrm_glamo.la ++libdrm_glamo_ladir = $(libdir) ++libdrm_glamo_la_LDFLAGS = -version-number 1:0:0 -no-undefined ++libdrm_glamo_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ ++ ++libdrm_glamo_la_SOURCES = \ ++ glamo_bo_gem.c \ ++ glamo_track.c ++ ++libdrm_glamoincludedir = ${includedir}/libdrm ++libdrm_glamoinclude_HEADERS = \ ++ glamo_bo.h \ ++ glamo_bo_gem.h \ ++ glamo_track.h ++ ++pkgconfigdir = @pkgconfigdir@ ++pkgconfig_DATA = libdrm_glamo.pc ++ ++EXTRA_DIST = libdrm_glamo.pc.in +--- libdrm/glamo/glamo_bo.h 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/glamo_bo.h 2010-06-11 15:54:45.209710943 +0200 +@@ -0,0 +1,183 @@ ++/* ++ * Copyright (c) 2009 Thomas White ++ * ++ * Heavily based on radeon_bo.h ++ * Copyright © 2008 Jérôme Glisse ++ * All Rights Reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS ++ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ++ * USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ */ ++/* ++ * Authors: ++ * Jérôme Glisse <glisse@freedesktop.org> ++ * Thomas White <taw@bitwiz.org.uk> ++ */ ++#ifndef GLAMO_BO_H ++#define GLAMO_BO_H ++ ++#include <stdio.h> ++#include <stdint.h> ++#include "glamo_track.h" ++ ++/* bo object */ ++#define GLAMO_BO_FLAGS_MACRO_TILE 1 ++#define GLAMO_BO_FLAGS_MICRO_TILE 2 ++ ++struct glamo_bo_manager; ++ ++struct glamo_bo { ++ uint32_t alignment; ++ uint32_t handle; ++ uint32_t size; ++ uint32_t domains; ++ uint32_t flags; ++ unsigned cref; ++#ifdef GLAMO_BO_TRACK ++ struct glamo_track *track; ++#endif ++ struct glamo_bo_manager *bom; ++ void *virtual; ++ uint32_t space_accounted; ++}; ++ ++/* bo functions */ ++struct glamo_bo_funcs { ++ struct glamo_bo *(*bo_open)(struct glamo_bo_manager *bom, ++ uint32_t handle, ++ uint32_t size, ++ uint32_t alignment, ++ uint32_t domains, ++ uint32_t flags); ++ void (*bo_ref)(struct glamo_bo *bo); ++ struct glamo_bo *(*bo_unref)(struct glamo_bo *bo); ++ int (*bo_map)(struct glamo_bo *bo, int write); ++ int (*bo_unmap)(struct glamo_bo *bo); ++ int (*bo_wait)(struct glamo_bo *bo); ++}; ++ ++struct glamo_bo_manager { ++ struct glamo_bo_funcs *funcs; ++ int fd; ++ struct glamo_tracker tracker; ++}; ++ ++static inline void _glamo_bo_debug(struct glamo_bo *bo, ++ const char *op, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ fprintf(stderr, "%s %p 0x%08X 0x%08X 0x%08X [%s %s %d]\n", ++ op, (void *)bo, bo->handle, bo->size, bo->cref, file, func, line); ++} ++ ++static inline struct glamo_bo *_glamo_bo_open(struct glamo_bo_manager *bom, ++ uint32_t handle, ++ uint32_t size, ++ uint32_t alignment, ++ uint32_t domains, ++ uint32_t flags, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ struct glamo_bo *bo; ++ ++ bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags); ++#ifdef GLAMO_BO_TRACK ++ if (bo) { ++ bo->track = glamo_tracker_add_track(&bom->tracker, bo->handle); ++ glamo_track_add_event(bo->track, file, func, "open", line); ++ } ++#endif ++ return bo; ++} ++ ++static inline void _glamo_bo_ref(struct glamo_bo *bo, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ bo->cref++; ++#ifdef GLAMO_BO_TRACK ++ glamo_track_add_event(bo->track, file, func, "ref", line); ++#endif ++ bo->bom->funcs->bo_ref(bo); ++} ++ ++static inline struct glamo_bo *_glamo_bo_unref(struct glamo_bo *bo, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ bo->cref--; ++#ifdef GLAMO_BO_TRACK ++ glamo_track_add_event(bo->track, file, func, "unref", line); ++ if (bo->cref <= 0) { ++ glamo_tracker_remove_track(&bo->bom->tracker, bo->track); ++ bo->track = NULL; ++ } ++#endif ++ return bo->bom->funcs->bo_unref(bo); ++} ++ ++static inline int _glamo_bo_map(struct glamo_bo *bo, ++ int write, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ return bo->bom->funcs->bo_map(bo, write); ++} ++ ++static inline int _glamo_bo_unmap(struct glamo_bo *bo, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ return bo->bom->funcs->bo_unmap(bo); ++} ++ ++static inline int _glamo_bo_wait(struct glamo_bo *bo, ++ const char *file, ++ const char *func, ++ int line) ++{ ++ return bo->bom->funcs->bo_wait(bo); ++} ++ ++#define glamo_bo_open(bom, h, s, a, d, f)\ ++ _glamo_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__) ++#define glamo_bo_ref(bo)\ ++ _glamo_bo_ref(bo, __FILE__, __FUNCTION__, __LINE__) ++#define glamo_bo_unref(bo)\ ++ _glamo_bo_unref(bo, __FILE__, __FUNCTION__, __LINE__) ++#define glamo_bo_map(bo, w)\ ++ _glamo_bo_map(bo, w, __FILE__, __FUNCTION__, __LINE__) ++#define glamo_bo_unmap(bo)\ ++ _glamo_bo_unmap(bo, __FILE__, __FUNCTION__, __LINE__) ++#define glamo_bo_debug(bo, opcode)\ ++ _glamo_bo_debug(bo, opcode, __FILE__, __FUNCTION__, __LINE__) ++#define glamo_bo_wait(bo) \ ++ _glamo_bo_wait(bo, __FILE__, __func__, __LINE__) ++ ++#endif +--- libdrm/glamo/glamo_bo_gem.c 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/glamo_bo_gem.c 2010-06-11 15:54:45.209710943 +0200 +@@ -0,0 +1,336 @@ ++/* ++ * Copyright © 2009 Thomas White ++ * ++ * Based on radeon_bo_gem.c, to which the following notice applies: ++ * ++ * Copyright © 2008 Dave Airlie ++ * Copyright © 2008 Jérôme Glisse ++ * All Rights Reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS ++ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ++ * USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ */ ++/* ++ * Authors: ++ * Dave Airlie ++ * Jérôme Glisse <glisse@freedesktop.org> ++ * ++ * ++ * Memory mapping functions are based on intel_bufmgr_gem.c, to which the ++ * following notice applies: ++ * ++ * Copyright © 2007 Red Hat Inc. ++ * Copyright © 2007 Intel Corporation ++ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA ++ * All Rights Reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL ++ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, ++ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ++ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ++ * USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ * ++ * ++ **************************************************************************/ ++/* ++ * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com> ++ * Keith Whitwell <keithw-at-tungstengraphics-dot-com> ++ * Eric Anholt <eric@anholt.net> ++ * Dave Airlie <airlied@linux.ie> ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include <stdio.h> ++#include <stdint.h> ++#include <stdlib.h> ++#include <string.h> ++#include <sys/mman.h> ++#include <sys/ioctl.h> ++#include <errno.h> ++ ++#include "xf86drm.h" ++#include "drm.h" ++#include "glamo_drm.h" ++#include "glamo_bo.h" ++#include "glamo_bo_gem.h" ++ ++struct glamo_bo_gem { ++ struct glamo_bo base; ++ uint32_t name; ++ int map_count; ++}; ++ ++struct bo_manager_gem { ++ struct glamo_bo_manager base; ++}; ++ ++static struct glamo_bo *bo_open(struct glamo_bo_manager *bom, ++ uint32_t handle, ++ uint32_t size, ++ uint32_t alignment, ++ uint32_t domains, ++ uint32_t flags) ++{ ++ struct glamo_bo_gem *bo; ++ int r; ++ ++ bo = (struct glamo_bo_gem*)calloc(1, sizeof(struct glamo_bo_gem)); ++ if (bo == NULL) { ++ return NULL; ++ } ++ ++ bo->base.bom = bom; ++ bo->base.handle = 0; ++ bo->base.size = size; ++ bo->base.alignment = alignment; ++ bo->base.domains = domains; ++ bo->base.flags = flags; ++ bo->base.cref = 0; ++ bo->map_count = 0; ++ bo->base.virtual = NULL; ++ if (handle) { ++ struct drm_gem_open open_arg; ++ ++ memset(&open_arg, 0, sizeof(open_arg)); ++ open_arg.name = handle; ++ r = ioctl(bom->fd, DRM_IOCTL_GEM_OPEN, &open_arg); ++ if (r != 0) { ++ free(bo); ++ return NULL; ++ } ++ bo->base.handle = open_arg.handle; ++ bo->base.size = open_arg.size; ++ bo->name = handle; ++ } else { ++ struct drm_glamo_gem_create args; ++ ++ args.size = size; ++ args.alignment = alignment; ++ args.initial_domain = bo->base.domains; ++ args.no_backing_store = 0; ++ args.handle = 0; ++ r = drmCommandWriteRead(bom->fd, DRM_GLAMO_GEM_CREATE, ++ &args, sizeof(args)); ++ bo->base.handle = args.handle; ++ if (r) { ++ fprintf(stderr, "Failed to allocate :\n"); ++ fprintf(stderr, " size : %d bytes\n", size); ++ fprintf(stderr, " alignment : %d bytes\n", alignment); ++ free(bo); ++ return NULL; ++ } ++ } ++ glamo_bo_ref((struct glamo_bo*)bo); ++ return (struct glamo_bo*)bo; ++} ++ ++static void bo_ref(struct glamo_bo *bo) ++{ ++} ++ ++static struct glamo_bo *bo_unref(struct glamo_bo *bo) ++{ ++ struct glamo_bo_gem *bo_gem = (struct glamo_bo_gem*)bo; ++ struct drm_gem_close args; ++ ++ if (bo == NULL) { ++ return NULL; ++ } ++ if (bo->cref) { ++ return bo; ++ } ++ if (bo_gem->map_count) { ++ munmap(bo->virtual, bo->size); ++ } ++ ++ /* close object */ ++ args.handle = bo->handle; ++ ioctl(bo->bom->fd, DRM_IOCTL_GEM_CLOSE, &args); ++ memset(bo_gem, 0, sizeof(struct glamo_bo_gem)); ++ free(bo_gem); ++ return NULL; ++} ++ ++static int bo_map(struct glamo_bo *bo, int write) ++{ ++ struct glamo_bo_gem *bo_gem; ++ struct glamo_bo_manager *bufmgr; ++ int ret; ++ ++ bo_gem = (struct glamo_bo_gem *)bo; ++ bufmgr = (struct glamo_bo_manager*)bo->bom; ++ ++ /* Get a mapping of the buffer if we haven't before. */ ++ if (bo->virtual == NULL) { ++ ++ struct drm_glamo_gem_mmap mmap_arg; ++ ++ memset(&mmap_arg, 0, sizeof(mmap_arg)); ++ mmap_arg.handle = bo->handle; ++ ++ /* Get the fake offset back... */ ++ ret = ioctl(bufmgr->fd, DRM_IOCTL_GLAMO_GEM_MMAP, &mmap_arg); ++ if (ret != 0) { ++ fprintf(stderr, ++ "%s:%d: Error preparing BO map %d (%d): %s .\n", ++ __FILE__, __LINE__, ++ bo->handle, bo_gem->name, ++ strerror(errno)); ++ return ret; ++ } ++ /* and mmap it */ ++ bo->virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE, ++ MAP_SHARED, bufmgr->fd, ++ mmap_arg.offset); ++ if (bo->virtual == MAP_FAILED) { ++ fprintf(stderr, ++ "%s:%d: Error mapping buffer %d (%d): %s .\n", ++ __FILE__, __LINE__, ++ bo->handle, bo_gem->name, ++ strerror(errno)); ++ return errno; ++ } ++ } ++ bo_gem->map_count++; ++ ++ return 0; ++} ++ ++static int bo_unmap(struct glamo_bo *bo) ++{ ++ struct glamo_bo_gem *bo_gem = (struct glamo_bo_gem*)bo; ++ ++ if ( bo_gem->map_count == 0 ) { ++ fprintf(stderr, "Not unmapping %p, because its map count" ++ " is already zero.\n", bo_gem); ++ return 0; ++ } ++ ++ if (--bo_gem->map_count > 0) { ++ return 0; ++ } ++ munmap(bo->virtual, bo->size); ++ bo->virtual = NULL; ++ return 0; ++} ++ ++static int bo_wait(struct glamo_bo *bo) ++{ ++ struct drm_glamo_gem_wait_rendering args; ++ int ret; ++ ++ args.handle = bo->handle; ++ args.have_handle = 1; ++ do { ++ ret = drmCommandWriteRead(bo->bom->fd, ++ DRM_GLAMO_GEM_WAIT_RENDERING, ++ &args, sizeof(args)); ++ } while (ret == -EAGAIN); ++ return ret; ++} ++ ++static struct glamo_bo_funcs bo_gem_funcs = { ++ bo_open, ++ bo_ref, ++ bo_unref, ++ bo_map, ++ bo_unmap, ++ bo_wait ++}; ++ ++struct glamo_bo_manager *glamo_bo_manager_gem_ctor(int fd) ++{ ++ struct bo_manager_gem *bomg; ++ ++ bomg = (struct bo_manager_gem*)calloc(1, sizeof(struct bo_manager_gem)); ++ if (bomg == NULL) return NULL; ++ ++ bomg->base.funcs = &bo_gem_funcs; ++ bomg->base.fd = fd; ++ return (struct glamo_bo_manager*)bomg; ++} ++ ++void glamo_bo_manager_gem_dtor(struct glamo_bo_manager *bom) ++{ ++ struct bo_manager_gem *bomg = (struct bo_manager_gem*)bom; ++ ++ if (bom == NULL) return; ++ free(bomg); ++} ++ ++uint32_t glamo_gem_get_name(struct glamo_bo *bo) ++{ ++ struct glamo_bo_gem *bo_gem = (struct glamo_bo_gem*)bo; ++ return bo_gem->name; ++} ++ ++int glamo_gem_name_buffer(struct glamo_bo *bo, uint32_t *name) ++{ ++ struct drm_gem_flink flink; ++ int r; ++ ++ if ( !bo ) { ++ fprintf(stderr, "No buffer object!\n"); ++ return -1; ++ } ++ ++ flink.handle = bo->handle; ++ r = ioctl(bo->bom->fd, DRM_IOCTL_GEM_FLINK, &flink); ++ if (r) return r; ++ ++ *name = flink.name; ++ return 0; ++} ++ ++int glamo_bo_subdata(struct glamo_bo *bo, unsigned long offset, ++ unsigned long size, const void *data) ++{ ++ int ret; ++ ++ if (size == 0 || data == NULL) ++ return 0; ++ ++ ret = bo_map(bo, 1); ++ if ( ret ) return ret; ++ ++ memcpy((unsigned char *)bo->virtual + offset, data, size); ++ ++ bo_unmap(bo); ++ ++ return 0; ++} +--- libdrm/glamo/glamo_bo_gem.h 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/glamo_bo_gem.h 2010-06-11 15:54:45.209710943 +0200 +@@ -0,0 +1,43 @@ ++/* ++ * Copyright © 2008 Dave Airlie ++ * Copyright © 2008 Jérôme Glisse ++ * All Rights Reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS ++ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ++ * USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ */ ++/* ++ * Authors: ++ * Dave Airlie ++ * Jérôme Glisse <glisse@freedesktop.org> ++ */ ++#ifndef GLAMO_BO_GEM_H ++#define GLAMO_BO_GEM_H ++ ++#include "glamo_bo.h" ++ ++struct glamo_bo_manager *glamo_bo_manager_gem_ctor(int fd); ++void glamo_bo_manager_gem_dtor(struct glamo_bo_manager *bom); ++int glamo_gem_name_buffer(struct glamo_bo *bo, uint32_t *name); ++uint32_t glamo_gem_get_name(struct glamo_bo *bo); ++extern int glamo_bo_subdata(struct glamo_bo *bo, unsigned long offset, ++ unsigned long size, const void *data); ++#endif +--- libdrm/glamo/glamo_track.c 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/glamo_track.c 2010-06-11 15:54:45.209710943 +0200 +@@ -0,0 +1,140 @@ ++/* ++ * Copyright © 2008 Jérôme Glisse ++ * All Rights Reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS ++ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ++ * USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ */ ++/* ++ * Authors: ++ * Jérôme Glisse <glisse@freedesktop.org> ++ */ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include "glamo_track.h" ++ ++void glamo_track_add_event(struct glamo_track *track, ++ const char *file, ++ const char *func, ++ const char *op, ++ unsigned line) ++{ ++ struct glamo_track_event *event; ++ ++ if (track == NULL) { ++ return; ++ } ++ event = (void*)calloc(1,sizeof(struct glamo_track_event)); ++ if (event == NULL) { ++ return; ++ } ++ event->line = line; ++ event->file = strdup(file); ++ event->func = strdup(func); ++ event->op = strdup(op); ++ if (event->file == NULL || event->func == NULL || event->op == NULL) { ++ free(event->file); ++ free(event->func); ++ free(event->op); ++ free(event); ++ return; ++ } ++ event->next = track->events; ++ track->events = event; ++} ++ ++struct glamo_track *glamo_tracker_add_track(struct glamo_tracker *tracker, ++ unsigned key) ++{ ++ struct glamo_track *track; ++ ++ track = (struct glamo_track*)calloc(1, sizeof(struct glamo_track)); ++ if (track) { ++ track->next = tracker->tracks.next; ++ track->prev = &tracker->tracks; ++ tracker->tracks.next = track; ++ if (track->next) { ++ track->next->prev = track; ++ } ++ track->key = key; ++ track->events = NULL; ++ } ++ return track; ++} ++ ++void glamo_tracker_remove_track(struct glamo_tracker *tracker, ++ struct glamo_track *track) ++{ ++ struct glamo_track_event *event; ++ void *tmp; ++ ++ if (track == NULL) { ++ return; ++ } ++ track->prev->next = track->next; ++ if (track->next) { ++ track->next->prev = track->prev; ++ } ++ track->next = track->prev = NULL; ++ event = track->events; ++ while (event) { ++ tmp = event; ++ free(event->file); ++ free(event->func); ++ free(event->op); ++ event = event->next; ++ free(tmp); ++ } ++ track->events = NULL; ++ free(track); ++} ++ ++void glamo_tracker_print(struct glamo_tracker *tracker, FILE *file) ++{ ++ struct glamo_track *track; ++ struct glamo_track_event *event; ++ void *tmp; ++ ++ track = tracker->tracks.next; ++ while (track) { ++ event = track->events; ++ fprintf(file, "[0x%08X] :\n", track->key); ++ while (event) { ++ tmp = event; ++ fprintf(file, " [0x%08X:%s](%s:%s:%d)\n", ++ track->key, event->op, event->file, ++ event->func, event->line); ++ free(event->file); ++ free(event->func); ++ free(event->op); ++ event->file = NULL; ++ event->func = NULL; ++ event->op = NULL; ++ event = event->next; ++ free(tmp); ++ } ++ track->events = NULL; ++ tmp = track; ++ track = track->next; ++ free(tmp); ++ } ++} +--- libdrm/glamo/glamo_track.h 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/glamo_track.h 2010-06-11 15:54:45.209710943 +0200 +@@ -0,0 +1,64 @@ ++/* ++ * Copyright © 2008 Jérôme Glisse ++ * All Rights Reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS ++ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ++ * USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ */ ++/* ++ * Authors: ++ * Jérôme Glisse <glisse@freedesktop.org> ++ */ ++#ifndef GLAMO_TRACK_H ++#define GLAMO_TRACK_H ++ ++struct glamo_track_event { ++ struct glamo_track_event *next; ++ char *file; ++ char *func; ++ char *op; ++ unsigned line; ++}; ++ ++struct glamo_track { ++ struct glamo_track *next; ++ struct glamo_track *prev; ++ unsigned key; ++ struct glamo_track_event *events; ++}; ++ ++struct glamo_tracker { ++ struct glamo_track tracks; ++}; ++ ++void glamo_track_add_event(struct glamo_track *track, ++ const char *file, ++ const char *func, ++ const char *op, ++ unsigned line); ++struct glamo_track *glamo_tracker_add_track(struct glamo_tracker *tracker, ++ unsigned key); ++void glamo_tracker_remove_track(struct glamo_tracker *tracker, ++ struct glamo_track *track); ++void glamo_tracker_print(struct glamo_tracker *tracker, ++ FILE *file); ++ ++#endif +--- libdrm/glamo/libdrm_glamo.pc.in 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/glamo/libdrm_glamo.pc.in 2010-06-11 15:54:45.210710959 +0200 +@@ -0,0 +1,10 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++Name: libdrm_glamo ++Description: Userspace interface to kernel DRM services for Glamo ++Version: 1.0.1 ++Libs: -L${libdir} -ldrm_glamo ++Cflags: -I${includedir} -I${includedir}/libdrm +--- libdrm/include/drm/Makefile.am 2010-03-22 21:39:27.000000000 +0100 ++++ libdrm-glamo/include/drm/Makefile.am 2010-06-11 15:54:45.210710959 +0200 +@@ -35,6 +35,7 @@ + savage_drm.h \ + sis_drm.h \ + via_drm.h \ ++ glamo_drm.h \ + mach64_drm.h + + +--- libdrm/include/drm/glamo_drm.h 1970-01-01 01:00:00.000000000 +0100 ++++ libdrm-glamo/include/drm/glamo_drm.h 2010-06-11 15:54:45.211711125 +0200 +@@ -0,0 +1,153 @@ ++/* glamo_drm.h -- Public header for the Glamo driver ++ * ++ * Copyright 2009 Thomas White ++ * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. ++ * Copyright 2000 VA Linux Systems, Inc., Fremont, California. ++ * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. ++ * All rights reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ * ++ * Authors: ++ * Thomas White <taw@bitwiz.org.uk> ++ * Kevin E. Martin <martin@valinux.com> ++ * Gareth Hughes <gareth@valinux.com> ++ * Keith Whitwell <keith@tungstengraphics.com> ++ */ ++ ++#ifndef __GLAMO_DRM_H__ ++#define __GLAMO_DRM_H__ ++ ++#include "drm.h" ++ ++#define GLAMO_GEM_DOMAIN_VRAM (0x1) ++ ++/* Glamo specific ioctls */ ++#define DRM_GLAMO_CMDBUF 0x01 ++#define DRM_GLAMO_SWAP 0x02 ++#define DRM_GLAMO_CMDBURST 0x03 ++ ++#define DRM_GLAMO_GEM_INFO 0x1c ++#define DRM_GLAMO_GEM_CREATE 0x1d ++#define DRM_GLAMO_GEM_MMAP 0x1e ++#define DRM_GLAMO_GEM_PIN 0x1f ++#define DRM_GLAMO_GEM_UNPIN 0x20 ++#define DRM_GLAMO_GEM_PREAD 0x21 ++#define DRM_GLAMO_GEM_PWRITE 0x22 ++#define DRM_GLAMO_GEM_WAIT_RENDERING 0x24 ++ ++#define DRM_IOCTL_GLAMO_CMDBUF DRM_IOW(DRM_COMMAND_BASE + DRM_GLAMO_CMDBUF, drm_glamo_cmd_buffer_t) ++#define DRM_IOCTL_GLAMO_SWAP DRM_IO(DRM_COMMAND_BASE + DRM_GLAMO_SWAP) ++#define DRM_IOCTL_GLAMO_CMDBURST DRM_IOW(DRM_COMMAND_BASE + DRM_GLAMO_CMDBURST, drm_glamo_cmd_burst_t) ++ ++#define DRM_IOCTL_GLAMO_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_INFO, struct drm_glamo_gem_info) ++#define DRM_IOCTL_GLAMO_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_CREATE, struct drm_glamo_gem_create) ++#define DRM_IOCTL_GLAMO_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_MMAP, struct drm_glamo_gem_mmap) ++#define DRM_IOCTL_GLAMO_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_PIN, struct drm_glamo_gem_pin) ++#define DRM_IOCTL_GLAMO_GEM_UNPIN DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_UNPIN, struct drm_glamo_gem_unpin) ++#define DRM_IOCTL_GLAMO_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_PREAD, struct drm_glamo_gem_pread) ++#define DRM_IOCTL_GLAMO_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_GLAMO_GEM_PWRITE, struct drm_glamo_gem_pwrite) ++#define DRM_IOCTL_GLAMO_GEM_WAIT_RENDERING DRM_IOW(DRM_COMMAND_BASE + DRM_GLAMO_GEM_WAIT_RENDERING, struct drm_glamo_gem_wait_rendering) ++ ++ ++/* Simple command submission - a list of 16-bit address-data pairs */ ++typedef struct drm_glamo_cmd_buffer { ++ unsigned int bufsz; /* Size of buffer, in bytes */ ++ char *buf; /* Buffer of stuff to go onto the ring buffer */ ++ unsigned int *obj_pos; /* Offsets (in bytes) at which to put objs */ ++ uint32_t *objs; /* List of buffer object (handles) to use */ ++ unsigned int nobjs; /* Number of objects referenced */ ++ int nbox; ++ struct drm_clip_rect *boxes; ++} drm_glamo_cmd_buffer_t; ++ ++ ++/* Burst command submission - base address and data: ++ * - Data can be 32-bit (more easily) ++ * - Easier for the kernel to validate */ ++typedef struct drm_glamo_cmd_burst { ++ uint16_t base; /* Base address (command) */ ++ int bufsz; /* Size of data, in bytes */ ++ uint16_t *data; /* Pointer to data */ ++ unsigned int *obj_pos; /* Offsets (in bytes) at which to put objs */ ++ uint32_t *objs; /* List of buffer object (handles) to use */ ++ unsigned int nobjs; /* Number of objects referenced */ ++} drm_glamo_cmd_burst_t; ++ ++struct drm_glamo_gem_info { ++ uint64_t vram_start; ++ uint64_t vram_size; ++}; ++ ++struct drm_glamo_gem_create { ++ uint64_t size; ++ uint64_t alignment; ++ uint32_t handle; ++ uint32_t initial_domain; // to allow VRAM to be created ++ uint32_t no_backing_store; ++}; ++ ++struct drm_glamo_gem_mmap { ++ uint32_t handle; /* Handle goes in... */ ++ uint64_t offset; /* ...offset comes out */ ++}; ++ ++struct drm_glamo_gem_wait_rendering { ++ uint32_t handle; ++ int have_handle; ++}; ++ ++struct drm_glamo_gem_pin { ++ uint32_t handle; ++ uint32_t pin_domain; ++ uint64_t alignment; ++ uint64_t offset; ++}; ++ ++struct drm_glamo_gem_unpin { ++ uint32_t handle; ++ uint32_t pad; ++}; ++ ++struct drm_glamo_gem_pread { ++ /** Handle for the object being read. */ ++ uint32_t handle; ++ uint32_t pad; ++ /** Offset into the object to read from */ ++ uint64_t offset; ++ /** Length of data to read */ ++ uint64_t size; ++ /** Pointer to write the data into. */ ++ uint64_t data_ptr; /* void *, but pointers are not 32/64 compatible */ ++}; ++ ++struct drm_glamo_gem_pwrite { ++ /** Handle for the object being written to. */ ++ uint32_t handle; ++ uint32_t pad; ++ /** Offset into the object to write to */ ++ uint64_t offset; ++ /** Length of data to write */ ++ uint64_t size; ++ /** Pointer to read the data from. */ ++ uint64_t data_ptr; /* void *, but pointers are not 32/64 compatible */ ++}; ++ ++#endif diff --git a/x11-libs/libdrm/libdrm-2.4.20.ebuild b/x11-libs/libdrm/libdrm-2.4.20.ebuild new file mode 100644 index 0000000..01f6dce --- /dev/null +++ b/x11-libs/libdrm/libdrm-2.4.20.ebuild @@ -0,0 +1,51 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-libs/libdrm/libdrm-2.4.20.ebuild,v 1.3 2010/04/24 16:47:30 chithanh Exp $ + +inherit autotools x-modular + +EGIT_REPO_URI="git://anongit.freedesktop.org/git/mesa/drm" + +DESCRIPTION="X.Org libdrm library" +HOMEPAGE="http://dri.freedesktop.org/" +if [[ ${PV} = 9999* ]]; then + SRC_URI="" +else + SRC_URI="http://dri.freedesktop.org/${PN}/${P}.tar.bz2" +fi + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="kernel_linux video_cards_glamo" +RESTRICT="test" # see bug #236845 + +RDEPEND="dev-libs/libpthread-stubs" +DEPEND="${RDEPEND}" + +src_unpack() { + unpack ${A} + cd "${S}" + if use video_cards_glamo ; then + epatch "${FILESDIR}/${P}-glamo.patch" + eautoreconf + fi +} + +pkg_setup() { + # libdrm_intel fails to build on some arches if dev-libs/libatomic_ops is + # installed, bugs 297630, bug 316421 and bug 316541, and is presently only + # useful on amd64 and x86. + CONFIGURE_OPTIONS="--enable-udev + --enable-nouveau-experimental-api + --enable-vmwgfx-experimental-api + $(use_enable kernel_linux libkms) + $(use_enable video_cards_glamo glamo-experimental-api) + $(! use amd64 && ! use x86 && ! use x86-fbsd && echo "--disable-intel")" +} + +pkg_postinst() { + x-modular_pkg_postinst + + ewarn "libdrm's ABI may have changed without change in library name" + ewarn "Please rebuild media-libs/mesa, x11-base/xorg-server and" + ewarn "your video drivers in x11-drivers/*." +} |