From 5006d08d7fc56d3d380cc6b75297f94e8594eb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 22 May 2007 10:51:52 +0200 Subject: [PATCH] DRI: Add TexOffset driver hooks. To be used by AIGLX for GLX_EXT_texture_from_pixmap without several data copies. The texOffsetStart hook must make sure that the given pixmap is accessible by the GPU for texturing and return an 'offset' that can be used by the 3D driver for that purpose. The texOffsetFinish hook is called when the pixmap is no longer being used for texturing. --- hw/xfree86/dri/dri.c | 13 +++++++++++++ hw/xfree86/dri/dri.h | 13 +++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 355d281f4..fae0b43fb 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -2210,6 +2210,19 @@ DRIGetContext(ScreenPtr pScreen) return pDRIPriv->myContext; } +void +DRIGetTexOffsetFuncs(ScreenPtr pScreen, + DRITexOffsetStartProcPtr *texOffsetStartFunc, + DRITexOffsetFinishProcPtr *texOffsetFinishFunc) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + + if (!pDRIPriv) return; + + *texOffsetStartFunc = pDRIPriv->pDriverInfo->texOffsetStart; + *texOffsetFinishFunc = pDRIPriv->pDriverInfo->texOffsetFinish; +} + /* This lets get at the unwrapped functions so that they can correctly * call the lowerlevel functions, and choose whether they will be * called at every level of recursion (eg in validatetree). diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h index a21338a90..e49bb6fa0 100644 --- a/hw/xfree86/dri/dri.h +++ b/hw/xfree86/dri/dri.h @@ -107,9 +107,12 @@ typedef struct { */ #define DRIINFO_MAJOR_VERSION 5 -#define DRIINFO_MINOR_VERSION 2 +#define DRIINFO_MINOR_VERSION 3 #define DRIINFO_PATCH_VERSION 0 +typedef unsigned long long (*DRITexOffsetStartProcPtr)(PixmapPtr pPix); +typedef void (*DRITexOffsetFinishProcPtr)(PixmapPtr pPix); + typedef struct { /* driver call back functions * @@ -180,6 +183,10 @@ typedef struct { /* New with DRI version 5.2.0 */ Bool allocSarea; Bool keepFDOpen; + + /* New with DRI version 5.3.0 */ + DRITexOffsetStartProcPtr texOffsetStart; + DRITexOffsetFinishProcPtr texOffsetFinish; } DRIInfoRec, *DRIInfoPtr; @@ -358,7 +365,9 @@ extern void *DRIMasterSareaPointer(ScrnInfoPtr pScrn); extern drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn); - +extern void DRIGetTexOffsetFuncs(ScreenPtr pScreen, + DRITexOffsetStartProcPtr *texOffsetStartFunc, + DRITexOffsetFinishProcPtr *texOffsetFinishFunc); #define _DRI_H_