diff options
Diffstat (limited to 'meta/packages')
| -rw-r--r-- | meta/packages/drm/files/poulsbo.patch | 2647 | ||||
| -rw-r--r-- | meta/packages/drm/libdrm_2.4.4.bb | 4 |
2 files changed, 2650 insertions, 1 deletions
diff --git a/meta/packages/drm/files/poulsbo.patch b/meta/packages/drm/files/poulsbo.patch new file mode 100644 index 0000000000..7dda90a2f5 --- /dev/null +++ b/meta/packages/drm/files/poulsbo.patch @@ -0,0 +1,2647 @@ +Index: libdrm-2.4.4/libdrm/xf86drm.c +=================================================================== +--- libdrm-2.4.4.orig/libdrm/xf86drm.c 2009-01-10 01:08:29.000000000 +0000 ++++ libdrm-2.4.4/libdrm/xf86drm.c 2009-02-05 12:23:22.000000000 +0000 +@@ -2402,6 +2402,569 @@ + return 0; + } + ++ ++/* ++ * Valid flags are ++ * DRM_FENCE_FLAG_EMIT ++ * DRM_FENCE_FLAG_SHAREABLE ++ * DRM_FENCE_MASK_DRIVER ++ */ ++ ++int drmFenceCreate(int fd, unsigned flags, int fence_class, unsigned type, ++ drmFence *fence) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.flags = flags; ++ arg.type = type; ++ arg.fence_class = fence_class; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_CREATE, &arg)) ++ return -errno; ++ fence->handle = arg.handle; ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->flags = arg.flags; ++ fence->signaled = 0; ++ return 0; ++} ++ ++/* ++ * Valid flags are ++ * DRM_FENCE_FLAG_SHAREABLE ++ * DRM_FENCE_MASK_DRIVER ++ */ ++ ++int drmFenceBuffers(int fd, unsigned flags, uint32_t fence_class, drmFence *fence) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.flags = flags; ++ arg.fence_class = fence_class; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_BUFFERS, &arg)) ++ return -errno; ++ fence->handle = arg.handle; ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->flags = arg.flags; ++ fence->sequence = arg.sequence; ++ fence->signaled = 0; ++ return 0; ++} ++ ++int drmFenceReference(int fd, unsigned handle, drmFence *fence) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = handle; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_REFERENCE, &arg)) ++ return -errno; ++ fence->handle = arg.handle; ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->flags = arg.flags; ++ fence->signaled = arg.signaled; ++ return 0; ++} ++ ++int drmFenceUnreference(int fd, const drmFence *fence) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = fence->handle; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_UNREFERENCE, &arg)) ++ return -errno; ++ return 0; ++} ++ ++int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = fence->handle; ++ arg.type = flush_type; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_FLUSH, &arg)) ++ return -errno; ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->signaled = arg.signaled; ++ return arg.error; ++} ++ ++int drmFenceUpdate(int fd, drmFence *fence) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = fence->handle; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_SIGNALED, &arg)) ++ return -errno; ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->signaled = arg.signaled; ++ return 0; ++} ++ ++int drmFenceSignaled(int fd, drmFence *fence, unsigned fenceType, ++ int *signaled) ++{ ++ if ((fence->flags & DRM_FENCE_FLAG_SHAREABLE) || ++ ((fenceType & fence->signaled) != fenceType)) { ++ int ret = drmFenceFlush(fd, fence, fenceType); ++ if (ret) ++ return ret; ++ } ++ ++ *signaled = ((fenceType & fence->signaled) == fenceType); ++ ++ return 0; ++} ++ ++/* ++ * Valid flags are ++ * DRM_FENCE_FLAG_SHAREABLE ++ * DRM_FENCE_MASK_DRIVER ++ */ ++ ++ ++int drmFenceEmit(int fd, unsigned flags, drmFence *fence, unsigned emit_type) ++{ ++ drm_fence_arg_t arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.fence_class = fence->fence_class; ++ arg.flags = flags; ++ arg.handle = fence->handle; ++ arg.type = emit_type; ++ ++ if (ioctl(fd, DRM_IOCTL_FENCE_EMIT, &arg)) ++ return -errno; ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->signaled = arg.signaled; ++ fence->sequence = arg.sequence; ++ return 0; ++} ++ ++/* ++ * Valid flags are ++ * DRM_FENCE_FLAG_WAIT_LAZY ++ * DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS ++ */ ++ ++#define DRM_IOCTL_TIMEOUT_USEC 3000000UL ++ ++static unsigned long ++drmTimeDiff(struct timeval *now, struct timeval *then) ++{ ++ uint64_t val; ++ ++ val = now->tv_sec - then->tv_sec; ++ val *= 1000000LL; ++ val += now->tv_usec; ++ val -= then->tv_usec; ++ ++ return (unsigned long) val; ++} ++ ++static int ++drmIoctlTimeout(int fd, unsigned long request, void *argp) ++{ ++ int haveThen = 0; ++ struct timeval then, now; ++ int ret; ++ ++ do { ++ ret = ioctl(fd, request, argp); ++ if (ret != 0 && errno == EAGAIN) { ++ if (!haveThen) { ++ gettimeofday(&then, NULL); ++ haveThen = 1; ++ } ++ gettimeofday(&now, NULL); ++ } ++ } while (ret != 0 && errno == EAGAIN && ++ drmTimeDiff(&now, &then) < DRM_IOCTL_TIMEOUT_USEC); ++ ++ if (ret != 0) ++ return ((errno == EAGAIN) ? -EBUSY : -errno); ++ ++ return 0; ++} ++ ++ ++ ++ ++int drmFenceWait(int fd, unsigned flags, drmFence *fence, unsigned flush_type) ++{ ++ drm_fence_arg_t arg; ++ int ret; ++ ++ if (flush_type == 0) { ++ flush_type = fence->type; ++ } ++ ++ if (!(fence->flags & DRM_FENCE_FLAG_SHAREABLE)) { ++ if ((flush_type & fence->signaled) == flush_type) { ++ return 0; ++ } ++ } ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = fence->handle; ++ arg.type = flush_type; ++ arg.flags = flags; ++ ++ ++ ret = drmIoctlTimeout(fd, DRM_IOCTL_FENCE_WAIT, &arg); ++ if (ret) ++ return ret; ++ ++ fence->fence_class = arg.fence_class; ++ fence->type = arg.type; ++ fence->signaled = arg.signaled; ++ return arg.error; ++} ++ ++static void drmBOCopyReply(const struct drm_bo_info_rep *rep, drmBO *buf) ++{ ++ buf->handle = rep->handle; ++ buf->flags = rep->flags; ++ buf->size = rep->size; ++ buf->offset = rep->offset; ++ buf->mapHandle = rep->arg_handle; ++ buf->mask = rep->proposed_flags; ++ buf->start = rep->buffer_start; ++ buf->fenceFlags = rep->fence_flags; ++ buf->replyFlags = rep->rep_flags; ++ buf->pageAlignment = rep->page_alignment; ++ buf->tileInfo = rep->tile_info; ++ buf->hwTileStride = rep->hw_tile_stride; ++ buf->desiredTileStride = rep->desired_tile_stride; ++} ++ ++ ++ ++int drmBOCreate(int fd, unsigned long size, ++ unsigned pageAlignment, void *user_buffer, ++ uint64_t mask, ++ unsigned hint, drmBO *buf) ++{ ++ struct drm_bo_create_arg arg; ++ struct drm_bo_create_req *req = &arg.d.req; ++ struct drm_bo_info_rep *rep = &arg.d.rep; ++ int ret; ++ ++ memset(buf, 0, sizeof(*buf)); ++ memset(&arg, 0, sizeof(arg)); ++ req->flags = mask; ++ req->hint = hint; ++ req->size = size; ++ req->page_alignment = pageAlignment; ++ req->buffer_start = (unsigned long) user_buffer; ++ ++ buf->virtual = NULL; ++ ++ ret = drmIoctlTimeout(fd, DRM_IOCTL_BO_CREATE, &arg); ++ if (ret) ++ return ret; ++ ++ drmBOCopyReply(rep, buf); ++ buf->virtual = user_buffer; ++ buf->mapCount = 0; ++ ++ return 0; ++} ++ ++int drmBOReference(int fd, unsigned handle, drmBO *buf) ++{ ++ struct drm_bo_reference_info_arg arg; ++ struct drm_bo_handle_arg *req = &arg.d.req; ++ struct drm_bo_info_rep *rep = &arg.d.rep; ++ ++ memset(&arg, 0, sizeof(arg)); ++ req->handle = handle; ++ ++ if (ioctl(fd, DRM_IOCTL_BO_REFERENCE, &arg)) ++ return -errno; ++ ++ drmBOCopyReply(rep, buf); ++ buf->mapVirtual = NULL; ++ buf->mapCount = 0; ++ buf->virtual = NULL; ++ ++ return 0; ++} ++ ++int drmBOUnreference(int fd, drmBO *buf) ++{ ++ struct drm_bo_handle_arg arg; ++ ++ if (buf->mapVirtual && buf->mapHandle) { ++ (void) munmap(buf->mapVirtual, buf->start + buf->size); ++ buf->mapVirtual = NULL; ++ buf->virtual = NULL; ++ } ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = buf->handle; ++ ++ if (ioctl(fd, DRM_IOCTL_BO_UNREFERENCE, &arg)) ++ return -errno; ++ ++ buf->handle = 0; ++ return 0; ++} ++ ++ ++/* ++ * Flags can be DRM_BO_FLAG_READ, DRM_BO_FLAG_WRITE or'ed together ++ * Hint currently be DRM_BO_HINT_DONT_BLOCK, which makes the ++ * call return an -EBUSY if it can' immediately honor the mapping request. ++ */ ++ ++int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint, ++ void **address) ++{ ++ struct drm_bo_map_wait_idle_arg arg; ++ struct drm_bo_info_req *req = &arg.d.req; ++ struct drm_bo_info_rep *rep = &arg.d.rep; ++ int ret = 0; ++ ++ /* ++ * Make sure we have a virtual address of the buffer. ++ */ ++ ++ if (!buf->virtual) { ++ drmAddress virtual; ++ virtual = mmap(0, buf->size + buf->start, ++ PROT_READ | PROT_WRITE, MAP_SHARED, ++ fd, buf->mapHandle); ++ if (virtual == MAP_FAILED) { ++ ret = -errno; ++ } ++ if (ret) ++ return ret; ++ buf->mapVirtual = virtual; ++ buf->virtual = ((char *) virtual) + buf->start; ++ } ++ ++ memset(&arg, 0, sizeof(arg)); ++ req->handle = buf->handle; ++ req->mask = mapFlags; ++ req->hint = mapHint; ++ ++ /* ++ * May hang if the buffer object is busy. ++ * This IOCTL synchronizes the buffer. ++ */ ++ ++ ret = drmIoctlTimeout(fd, DRM_IOCTL_BO_MAP, &arg); ++ if (ret) ++ return ret; ++ ++ drmBOCopyReply(rep, buf); ++ buf->mapFlags = mapFlags; ++ ++buf->mapCount; ++ *address = buf->virtual; ++ ++ return 0; ++} ++ ++ ++int drmBOUnmap(int fd, drmBO *buf) ++{ ++ struct drm_bo_handle_arg arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.handle = buf->handle; ++ ++ if (ioctl(fd, DRM_IOCTL_BO_UNMAP, &arg)) { ++ return -errno; ++ } ++ buf->mapCount--; ++ return 0; ++} ++ ++int drmBOSetStatus(int fd, drmBO *buf, ++ uint64_t flags, uint64_t mask, ++ unsigned int hint, ++ unsigned int desired_tile_stride, ++ unsigned int tile_info) ++{ ++ ++ struct drm_bo_map_wait_idle_arg arg; ++ struct drm_bo_info_req *req = &arg.d.req; ++ struct drm_bo_info_rep *rep = &arg.d.rep; ++ int ret = 0; ++ ++ memset(&arg, 0, sizeof(arg)); ++ req->mask = mask; ++ req->flags = flags; ++ req->handle = buf->handle; ++ req->hint = hint; ++ req->desired_tile_stride = desired_tile_stride; ++ req->tile_info = tile_info; ++ ++ ret = drmIoctlTimeout(fd, DRM_IOCTL_BO_SETSTATUS, &arg); ++ if (ret) ++ return ret; ++ ++ drmBOCopyReply(rep, buf); ++ return 0; ++} ++ ++ ++int drmBOInfo(int fd, drmBO *buf) ++{ ++ struct drm_bo_reference_info_arg arg; ++ struct drm_bo_handle_arg *req = &arg.d.req; ++ struct drm_bo_info_rep *rep = &arg.d.rep; ++ int ret = 0; ++ ++ memset(&arg, 0, sizeof(arg)); ++ req->handle = buf->handle; ++ ++ ret = ioctl(fd, DRM_IOCTL_BO_INFO, &arg); ++ if (ret) ++ return -errno; ++ ++ drmBOCopyReply(rep, buf); ++ return 0; ++} ++ ++int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint) ++{ ++ struct drm_bo_map_wait_idle_arg arg; ++ struct drm_bo_info_req *req = &arg.d.req; ++ struct drm_bo_info_rep *rep = &arg.d.rep; ++ int ret = 0; ++ ++ if ((buf->flags & DRM_BO_FLAG_SHAREABLE) || ++ (buf->replyFlags & DRM_BO_REP_BUSY)) { ++ memset(&arg, 0, sizeof(arg)); ++ req->handle = buf->handle; ++ req->hint = hint; ++ ++ ret = drmIoctlTimeout(fd, DRM_IOCTL_BO_WAIT_IDLE, &arg); ++ if (ret) ++ return ret; ++ ++ drmBOCopyReply(rep, buf); ++ } ++ return 0; ++} ++ ++int drmBOBusy(int fd, drmBO *buf, int *busy) ++{ ++ if (!(buf->flags & DRM_BO_FLAG_SHAREABLE) && ++ !(buf->replyFlags & DRM_BO_REP_BUSY)) { ++ *busy = 0; ++ return 0; ++ } ++ else { ++ int ret = drmBOInfo(fd, buf); ++ if (ret) ++ return ret; ++ *busy = (buf->replyFlags & DRM_BO_REP_BUSY); ++ return 0; ++ } ++} ++ ++int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, ++ unsigned memType) ++{ ++ struct drm_mm_init_arg arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ ++ arg.magic = DRM_BO_INIT_MAGIC; ++ arg.major = DRM_BO_INIT_MAJOR; ++ arg.minor = DRM_BO_INIT_MINOR; ++ arg.p_offset = pOffset; ++ arg.p_size = pSize; ++ arg.mem_type = memType; ++ ++ if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg)) ++ return -errno; ++ return 0; ++} ++ ++int drmMMTakedown(int fd, unsigned memType) ++{ ++ struct drm_mm_type_arg arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.mem_type = memType; ++ ++ if (ioctl(fd, DRM_IOCTL_MM_TAKEDOWN, &arg)) ++ return -errno; ++ return 0; ++} ++ ++/* ++ * If this function returns an error, and lockBM was set to 1, ++ * the buffer manager is NOT locked. ++ */ ++ ++int drmMMLock(int fd, unsigned memType, int lockBM, int ignoreNoEvict) ++{ ++ struct drm_mm_type_arg arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ arg.mem_type = memType; ++ arg.lock_flags |= (lockBM) ? DRM_BO_LOCK_UNLOCK_BM : 0; ++ arg.lock_flags |= (ignoreNoEvict) ? DRM_BO_LOCK_IGNORE_NO_EVICT : 0; ++ ++ return drmIoctlTimeout(fd, DRM_IOCTL_MM_LOCK, &arg); ++} ++ ++int drmMMUnlock(int fd, unsigned memType, int unlockBM) ++{ ++ struct drm_mm_type_arg arg; ++ ++ memset(&arg, 0, sizeof(arg)); ++ ++ arg.mem_type = memType; ++ arg.lock_flags |= (unlockBM) ? DRM_BO_LOCK_UNLOCK_BM : 0; ++ ++ return drmIoctlTimeout(fd, DRM_IOCTL_MM_UNLOCK, &arg); ++} ++ ++int drmBOVersion(int fd, unsigned int *major, ++ unsigned int *minor, ++ unsigned int *patchlevel) ++{ ++ struct drm_bo_version_arg arg; ++ int ret; ++ ++ memset(&arg, 0, sizeof(arg)); ++ ret = ioctl(fd, DRM_IOCTL_BO_VERSION, &arg); ++ if (ret) ++ return -errno; ++ ++ if (major) ++ *major = arg.major; ++ if (minor) ++ *minor = arg.minor; ++ if (patchlevel) ++ *patchlevel = arg.patchlevel; ++ ++ return 0; ++} ++ ++ ++ + #define DRM_MAX_FDS 16 + static struct { + char *BusID; +Index: libdrm-2.4.4/libdrm/xf86drm.h +=================================================================== +--- libdrm-2.4.4.orig/libdrm/xf86drm.h 2008-12-17 18:28:24.000000000 +0000 ++++ libdrm-2.4.4/libdrm/xf86drm.h 2009-02-04 16:39:55.000000000 +0000 +@@ -665,4 +665,6 @@ + extern int drmSetMaster(int fd); + extern int drmDropMaster(int fd); + ++#include "xf86mm.h" ++ + #endif +Index: libdrm-2.4.4/libdrm/xf86mm.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ libdrm-2.4.4/libdrm/xf86mm.h 2009-02-04 16:39:55.000000000 +0000 +@@ -0,0 +1,140 @@ ++/************************************************************************** ++ * ++ * 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. ++ * ++ * ++ **************************************************************************/ ++ ++#ifndef _XF86MM_H_ ++#define _XF86MM_H_ ++#include <stddef.h> ++#include <stdint.h> ++#include "drm.h" ++ ++/* ++ * Note on multithreaded applications using this interface. ++ * Libdrm is not threadsafe, so common buffer, TTM, and fence objects need to ++ * be protected using an external mutex. ++ * ++ * Note: Don't protect the following functions, as it may lead to deadlocks: ++ * drmBOUnmap(). ++ * The kernel is synchronizing and refcounting buffer maps. ++ * User space only needs to refcount object usage within the same application. ++ */ ++ ++ ++/* ++ * List macros heavily inspired by the Linux kernel ++ * list handling. No list looping yet. ++ */ ++ ++typedef struct _drmFence ++{ ++ unsigned handle; ++ int fence_class; ++ unsigned type; ++ unsigned flags; ++ unsigned signaled; ++ uint32_t sequence; ++ unsigned pad[4]; /* for future expansion */ ++} drmFence; ++ ++typedef struct _drmBO ++{ ++ unsigned handle; ++ uint64_t mapHandle; ++ uint64_t flags; ++ uint64_t mask; ++ unsigned mapFlags; ++ unsigned long size; ++ unsigned long offset; ++ unsigned long start; ++ unsigned replyFlags; ++ unsigned fenceFlags; ++ unsigned pageAlignment; ++ unsigned tileInfo; ++ unsigned hwTileStride; ++ unsigned desiredTileStride; ++ void *virtual; ++ void *mapVirtual; ++ int mapCount; ++ unsigned pad[8]; /* for future expansion */ ++} drmBO; ++ ++/* ++ * Fence functions. ++ */ ++ ++extern int drmFenceCreate(int fd, unsigned flags, int fence_class, ++ unsigned type, drmFence *fence); ++extern int drmFenceReference(int fd, unsigned handle, drmFence *fence); ++extern int drmFenceUnreference(int fd, const drmFence *fence); ++extern int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type); ++extern int drmFenceSignaled(int fd, drmFence *fence, ++ unsigned fenceType, int *signaled); ++extern int drmFenceWait(int fd, unsigned flags, drmFence *fence, ++ unsigned flush_type); ++extern int drmFenceEmit(int fd, unsigned flags, drmFence *fence, ++ unsigned emit_type); ++extern int drmFenceBuffers(int fd, unsigned flags, uint32_t fence_class, drmFence *fence); ++ ++ ++/* ++ * Buffer object functions. ++ */ ++ ++extern int drmBOCreate(int fd, unsigned long size, ++ unsigned pageAlignment, void *user_buffer, ++ uint64_t mask, unsigned hint, drmBO *buf); ++extern int drmBOReference(int fd, unsigned handle, drmBO *buf); ++extern int drmBOUnreference(int fd, drmBO *buf); ++extern int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint, ++ void **address); ++extern int drmBOUnmap(int fd, drmBO *buf); ++extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle); ++extern int drmBOInfo(int fd, drmBO *buf); ++extern int drmBOBusy(int fd, drmBO *buf, int *busy); ++ ++extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint); ++ ++/* ++ * Initialization functions. ++ */ ++ ++extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, ++ unsigned memType); ++extern int drmMMTakedown(int fd, unsigned memType); ++extern int drmMMLock(int fd, unsigned memType, int lockBM, int ignoreNoEvict); ++extern int drmMMUnlock(int fd, unsigned memType, int unlockBM); ++extern int drmBOSetStatus(int fd, drmBO *buf, ++ uint64_t flags, uint64_t mask, ++ unsigned int hint, ++ unsigned int desired_tile_stride, ++ unsigned int tile_info); ++extern int drmBOVersion(int fd, unsigned int *major, ++ unsigned int *minor, ++ unsigned int *patchlevel); ++ ++ ++#endif +Index: libdrm-2.4.4/Makefile.am +=================================================================== +--- libdrm-2.4.4.orig/Makefile.am 2008-10-09 20:02:10.000000000 +0100 ++++ libdrm-2.4.4/Makefile.am 2009-02-04 16:39:55.000000000 +0000 +@@ -22,7 +22,7 @@ + # here too, but let's just do libdrm for now + + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = libdrm shared-core tests ++SUBDIRS = libdrm shared-core + + pkgconfigdir = @pkgconfigdir@ + pkgconfig_DATA = libdrm.pc +Index: libdrm-2.4.4/shared-core/drm.h +=================================================================== +--- libdrm-2.4.4.orig/shared-core/drm.h 2008-12-17 18:28:24.000000000 +0000 ++++ libdrm-2.4.4/shared-core/drm.h 2009-02-05 12:20:53.000000000 +0000 +@@ -632,6 +632,8 @@ + unsigned long handle; /**< Used for mapping / unmapping */ + }; + ++ ++ + /** + * DRM_IOCTL_SET_VERSION ioctl argument type. + */ +@@ -1109,6 +1111,32 @@ + #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, uint32_t) + #define DRM_IOCTL_MODE_REPLACEFB DRM_IOWR(0xB0, struct drm_mode_fb_cmd) + ++#define DRM_IOCTL_MM_INIT DRM_IOWR(0xc0, struct drm_mm_init_arg) ++#define DRM_IOCTL_MM_TAKEDOWN DRM_IOWR(0xc1, struct drm_mm_type_arg) ++#define DRM_IOCTL_MM_LOCK DRM_IOWR(0xc2, struct drm_mm_type_arg) ++#define DRM_IOCTL_MM_UNLOCK DRM_IOWR(0xc3, struct drm_mm_type_arg) ++ ++#define DRM_IOCTL_FENCE_CREATE DRM_IOWR(0xc4, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_REFERENCE DRM_IOWR(0xc6, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_UNREFERENCE DRM_IOWR(0xc7, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_SIGNALED DRM_IOWR(0xc8, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_FLUSH DRM_IOWR(0xc9, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_WAIT DRM_IOWR(0xca, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_EMIT DRM_IOWR(0xcb, struct drm_fence_arg) ++#define DRM_IOCTL_FENCE_BUFFERS DRM_IOWR(0xcc, struct drm_fence_arg) ++ ++#define DRM_IOCTL_BO_CREATE DRM_IOWR(0xcd, struct drm_bo_create_arg) ++#define DRM_IOCTL_BO_MAP DRM_IOWR(0xcf, struct drm_bo_map_wait_idle_arg) ++#define DRM_IOCTL_BO_UNMAP DRM_IOWR(0xd0, struct drm_bo_handle_arg) ++#define DRM_IOCTL_BO_REFERENCE DRM_IOWR(0xd1, struct drm_bo_reference_info_arg) ++#define DRM_IOCTL_BO_UNREFERENCE DRM_IOWR(0xd2, struct drm_bo_handle_arg) ++#define DRM_IOCTL_BO_SETSTATUS DRM_IOWR(0xd3, struct drm_bo_map_wait_idle_arg) ++#define DRM_IOCTL_BO_INFO DRM_IOWR(0xd4, struct drm_bo_reference_info_arg) ++#define DRM_IOCTL_BO_WAIT_IDLE DRM_IOWR(0xd5, struct drm_bo_map_wait_idle_arg) ++#define DRM_IOCTL_BO_VERSION DRM_IOR(0xd6, struct drm_bo_version_arg) ++ ++#define DRM_IOCTL_MODE_ADDMODE DRM_IOWR(0xA7, struct drm_mode_modeinfo) ++#define DRM_IOCTL_MODE_RMMODE DRM_IOWR(0xA8, unsigned int) + /*@}*/ + + /** +Index: libdrm-2.4.4/shared-core/i915_drm.h +=================================================================== +--- libdrm-2.4.4.orig/shared-core/i915_drm.h 2008-12-23 00:03:35.000000000 +0000 ++++ libdrm-2.4.4/shared-core/i915_drm.h 2009-02-04 16:39:55.000000000 +0000 +@@ -767,4 +767,22 @@ + uint64_t aper_available_size; + }; + ++/* ++ * Relocation header is 4 uint32_ts ++ * 0 - (16-bit relocation type << 16)| 16 bit reloc count ++ * 1 - buffer handle for another list of relocs ++ * 2-3 - spare. ++ */ ++#define I915_RELOC_HEADER 4 ++ ++/* ++ * type 0 relocation has 4-uint32_t stride ++ * 0 - offset into buffer ++ * 1 - delta to add in ++ * 2 - index into buffer list ++ * 3 - reserved (for optimisations later). ++ */ ++#define I915_RELOC_TYPE_0 0 ++#define I915_RELOC0_STRIDE 4 ++ + #endif /* _I915_DRM_H_ */ +Index: libdrm-2.4.4/shared-core/Makefile.am +=================================================================== +--- libdrm-2.4.4.orig/shared-core/Makefile.am 2008-12-17 18:28:24.000000000 +0000 ++++ libdrm-2.4.4/shared-core/Makefile.am 2009-02-04 16:39:55.000000000 +0000 +@@ -31,6 +31,8 @@ + mach64_drm.h \ + mga_drm.h \ + nouveau_drm.h \ ++ psb_drm.h \ ++ psb_reg.h \ + r128_drm.h \ + radeon_drm.h \ + savage_drm.h \ +Index: libdrm-2.4.4/shared-core/nouveau_drm.h +=================================================================== +--- libdrm-2.4.4.orig/shared-core/nouveau_drm.h 2008-10-09 20:02:11.000000000 +0100 ++++ libdrm-2.4.4/shared-core/nouveau_drm.h 2009-02-04 16:39:55.000000000 +0000 +@@ -144,9 +144,12 @@ + NV_05 =5, + NV_10 =10, + NV_11 =11, ++ NV_15 =11, + NV_17 =17, + NV_20 =20, ++ NV_25 =20, + NV_30 =30, ++ NV_34 =30, + NV_40 =40, + NV_44 =44, + NV_50 =50, +Index: libdrm-2.4.4/shared-core/psb_drm.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ libdrm-2.4.4/shared-core/psb_drm.h 2009-02-04 16:39:55.000000000 +0000 +@@ -0,0 +1,359 @@ ++/************************************************************************** ++ * Copyright (c) 2007, Intel Corporation. ++ * All Rights Reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License along with ++ * this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to ++ * develop this driver. ++ * ++ **************************************************************************/ ++/* ++ */ ++ ++#ifndef _PSB_DRM_H_ ++#define _PSB_DRM_H_ ++ ++#if defined(__linux__) && !defined(__KERNEL__) ++#include<stdint.h> ++#endif ++ ++/* ++ * Intel Poulsbo driver package version. ++ * ++ */ ++/* #define PSB_PACKAGE_VERSION "ED"__DATE__*/ ++#define PSB_PACKAGE_VERSION "2.0.0.32L.0007" ++ ++#define DRM_PSB_SAREA_MAJOR 0 ++#define DRM_PSB_SAREA_MINOR 1 ++#define PSB_FIXED_SHIFT 16 ++ ++/* ++ * Public memory types. ++ */ ++ ++#define DRM_PSB_MEM_MMU DRM_BO_MEM_PRIV1 ++#define DRM_PSB_FLAG_MEM_MMU DRM_BO_FLAG_MEM_PRIV1 ++#define DRM_PSB_MEM_PDS DRM_BO_MEM_PRIV2 ++#define DRM_PSB_FLAG_MEM_PDS DRM_BO_FLAG_MEM_PRIV2 ++#define DRM_PSB_MEM_APER DRM_BO_MEM_PRIV3 ++#define DRM_PSB_FLAG_MEM_APER DRM_BO_FLAG_MEM_PRIV3 ++#define DRM_PSB_MEM_RASTGEOM DRM_BO_MEM_PRIV4 ++#define DRM_PSB_FLAG_MEM_RASTGEOM DRM_BO_FLAG_MEM_PRIV4 ++#define PSB_MEM_RASTGEOM_START 0x30000000 ++ ++typedef int32_t psb_fixed; ++typedef uint32_t psb_ufixed; ++ ++static inline psb_fixed psb_int_to_fixed(int a) ++{ ++ return a * (1 << PSB_FIXED_SHIFT); ++} ++ ++static inline psb_ufixed psb_unsigned_to_ufixed(unsigned int a) ++{ ++ return a << PSB_FIXED_SHIFT; ++} ++ ++/*Status of the command sent to the gfx device.*/ ++typedef enum { ++ DRM_CMD_SUCCESS, ++ DRM_CMD_FAILED, ++ DRM_CMD_HANG ++} drm_cmd_status_t; ++ ++struct drm_psb_scanout { ++ uint32_t buffer_id; /* DRM buffer object ID */ ++ uint32_t rotation; /* Rotation as in RR_rotation definitions */ ++ uint32_t stride; /* Buffer stride in bytes */ ++ uint32_t depth; /* Buffer depth in bits (NOT) bpp */ ++ uint32_t width; /* Buffer width in pixels */ ++ uint32_t height; /* Buffer height in lines */ ++ psb_fixed transform[3][3]; /* Buffer composite transform */ ++ /* (scaling, rot, reflect) */ ++}; ++ ++#define DRM_PSB_SAREA_OWNERS 16 ++#define DRM_PSB_SAREA_OWNER_2D 0 ++#define DRM_PSB_SAREA_OWNER_3D 1 ++ ++#define DRM_PSB_SAREA_SCANOUTS 3 ++ ++struct drm_psb_sarea { ++ /* Track changes of this data structure */ ++ ++ uint32_t major; ++ uint32_t minor; ++ ++ /* Last context to touch part of hw */ ++ uint32_t ctx_owners[DRM_PSB_SAREA_OWNERS]; ++ ++ /* Definition of front- and rotated buffers */ ++ uint32_t num_scanouts; ++ struct drm_psb_scanout scanouts[DRM_PSB_SAREA_SCANOUTS]; ++ ++ int planeA_x; ++ int planeA_y; ++ int planeA_w; ++ int planeA_h; ++ int planeB_x; ++ int planeB_y; ++ int planeB_w; ++ int planeB_h; ++ uint32_t msvdx_state; ++ uint32_t msvdx_context; ++}; ++ ++#define PSB_RELOC_MAGIC 0x67676767 ++#define PSB_RELOC_SHIFT_MASK 0x0000FFFF ++#define PSB_RELOC_SHIFT_SHIFT 0 ++#define PSB_RELOC_ALSHIFT_MASK 0xFFFF0000 ++#define PSB_RELOC_ALSHIFT_SHIFT 16 ++ ++#define PSB_RELOC_OP_OFFSET 0 /* Offset of the indicated ++ * buffer ++ */ ++#define PSB_RELOC_OP_2D_OFFSET 1 /* Offset of the indicated ++ * buffer, relative to 2D ++ * base address ++ */ ++#define PSB_RELOC_OP_PDS_OFFSET 2 /* Offset of the indicated buffer, ++ * relative to PDS base address ++ */ ++#define PSB_RELOC_OP_STRIDE 3 /* Stride of the indicated ++ * buffer (for tiling) ++ */ ++#define PSB_RELOC_OP_USE_OFFSET 4 /* Offset of USE buffer ++ * relative to base reg ++ */ ++#define PSB_RELOC_OP_USE_REG 5 /* Base reg of USE buffer */ ++ ++struct drm_psb_reloc { ++ uint32_t reloc_op; ++ uint32_t where; /* offset in destination buffer */ ++ uint32_t buffer; /* Buffer reloc applies to */ ++ uint32_t mask; /* Destination format: */ ++ uint32_t shift; /* Destination format: */ ++ uint32_t pre_add; /* Destination format: */ ++ uint32_t background; /* Destination add */ ++ uint32_t dst_buffer; /* Destination buffer. Index into buffer_list */ ++ uint32_t arg0; /* Reloc-op dependant */ ++ uint32_t arg1; ++}; ++ ++#define PSB_BO_FLAG_TA (1ULL << 48) ++#define PSB_BO_FLAG_SCENE (1ULL << 49) ++#define PSB_BO_FLAG_FEEDBACK (1ULL << 50) ++#define PSB_BO_FLAG_USSE (1ULL << 51) ++ ++#define PSB_ENGINE_2D 0 ++#define PSB_ENGINE_VIDEO 1 ++#define PSB_ENGINE_RASTERIZER 2 ++#define PSB_ENGINE_TA 3 ++#define PSB_ENGINE_HPRAST 4 ++ ++/* ++ * For this fence class we have a couple of ++ * fence types. ++ */ ++ ++#define _PSB_FENCE_EXE_SHIFT 0 ++#define _PSB_FENCE_TA_DONE_SHIFT 1 ++#define _PSB_FENCE_RASTER_DONE_SHIFT 2 ++#define _PSB_FENCE_SCENE_DONE_SHIFT 3 ++#define _PSB_FENCE_FEEDBACK_SHIFT 4 ++ ++#define _PSB_ENGINE_TA_FENCE_TYPES 5 ++#define _PSB_FENCE_TYPE_TA_DONE (1 << _PSB_FENCE_TA_DONE_SHIFT) ++#define _PSB_FENCE_TYPE_RASTER_DONE (1 << _PSB_FENCE_RASTER_DONE_SHIFT) ++#define _PSB_FENCE_TYPE_SCENE_DONE (1 << _PSB_FENCE_SCENE_DONE_SHIFT) ++#define _PSB_FENCE_TYPE_FEEDBACK (1 << _PSB_FENCE_FEEDBACK_SHIFT) ++ ++#define PSB_ENGINE_HPRAST 4 ++#define PSB_NUM_ENGINES 5 ++ ++#define PSB_TA_FLAG_FIRSTPASS (1 << 0) ++#define PSB_TA_FLAG_LASTPASS (1 << 1) ++ ++#define PSB_FEEDBACK_OP_VISTEST (1 << 0) ++ ++struct drm_psb_scene { ++ int handle_valid; ++ uint32_t handle; ++ uint32_t w; ++ uint32_t h; ++ uint32_t num_buffers; ++}; ++ ++typedef struct drm_psb_cmdbuf_arg { ++ uint64_t buffer_list; /* List of buffers to validate */ ++ uint64_t clip_rects; /* See i915 counterpart */ ++ uint64_t scene_arg; ++ uint64_t fence_arg; ++ ++ uint32_t ta_flags; ++ ++ uint32_t ta_handle; /* TA reg-value pairs */ ++ uint32_t ta_offset; ++ uint32_t ta_size; ++ ++ uint32_t oom_handle; ++ uint32_t oom_offset; ++ uint32_t oom_size; ++ ++ uint32_t cmdbuf_handle; /* 2D Command buffer object or, */ ++ uint32_t cmdbuf_offset; /* rasterizer reg-value pairs */ ++ uint32_t cmdbuf_size; ++ ++ uint32_t reloc_handle; /* Reloc buffer object */ ++ uint32_t reloc_offset; ++ uint32_t num_relocs; ++ ++ int32_t damage; /* Damage front buffer with cliprects */ ++ /* Not implemented yet */ ++ uint32_t fence_flags; ++ uint32_t engine; ++ ++ /* ++ * Feedback; ++ */ ++ ++ uint32_t feedback_ops; ++ uint32_t feedback_handle; ++ uint32_t feedback_offset; ++ uint32_t feedback_breakpoints; ++ uint32_t feedback_size; ++} drm_psb_cmdbuf_arg_t; ++ ++struct drm_psb_xhw_init_arg { ++ uint32_t operation; ++ uint32_t buffer_handle; ++}; ++ ++/* ++ * Feedback components: ++ */ ++ ++/* ++ * Vistest component. The number of these in the feedback buffer ++ * equals the number of vistest breakpoints + 1. ++ * This is currently the only feedback component. ++ */ ++ ++struct drm_psb_vistest { ++ uint32_t vt[8]; ++}; ++ ++#define PSB_HW_COOKIE_SIZE 16 ++#define PSB_HW_FEEDBACK_SIZE 8 ++#define PSB_HW_OOM_CMD_SIZE 6 ++ ++struct drm_psb_xhw_arg { ++ uint32_t op; ++ int ret; ++ uint32_t irq_op; ++ uint32_t issue_irq; ++ uint32_t cookie[PSB_HW_COOKIE_SIZE]; ++ union { ++ struct { ++ uint32_t w; ++ uint32_t h; ++ uint32_t size; ++ uint32_t clear_p_start; ++ uint32_t clear_num_pages; ++ } si; ++ struct { ++ uint32_t fire_flags; ++ uint32_t hw_context; ++ uint32_t offset; ++ uint32_t engine; ++ uint32_t flags; ++ uint32_t rca; ++ uint32_t num_oom_cmds; ++ uint32_t oom_cmds[PSB_HW_OOM_CMD_SIZE]; ++ } sb; ++ struct { ++ uint32_t pages; ++ uint32_t size; ++ } bi; ++ struct { ++ uint32_t bca; ++ uint32_t rca; ++ uint32_t flags; ++ } oom; ++ struct { ++ u |
