X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fcommon%2Fdri_util.h;h=ffffb99b30147802bdf20320dcbbf0fff08690d2;hb=cd6a31cd4a9ea6deef4778c2eaef2d47240c3a6e;hp=0feb57b3c6e6ac6d40e070f909e04a917ca2d200;hpb=658b1bdb1cc5f9910be910dc156a2e81ed999756;p=mesa.git diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 0feb57b3c6e..ffffb99b301 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -51,29 +51,26 @@ #include #include #include +#include "xmlconfig.h" #include "main/glheader.h" -#include "GL/internal/glcore.h" +#include "main/mtypes.h" #include "GL/internal/dri_interface.h" #define GLX_BAD_CONTEXT 5 typedef struct __DRIswapInfoRec __DRIswapInfo; -/* Typedefs to avoid rewriting the world. */ -typedef struct __DRIscreenRec __DRIscreenPrivate; -typedef struct __DRIdrawableRec __DRIdrawablePrivate; -typedef struct __DRIcontextRec __DRIcontextPrivate; - /** * Extensions. */ extern const __DRIlegacyExtension driLegacyExtension; extern const __DRIcoreExtension driCoreExtension; +extern const __DRIdri2Extension driDRI2Extension; extern const __DRIextension driReadDrawableExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; -extern const __DRIframeTrackingExtension driFrameTrackingExtension; extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; +extern const __DRI2configQueryExtension dri2ConfigQueryExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO @@ -106,6 +103,28 @@ do { \ } \ } while (0) +/** + * Same as above, but for two drawables simultaneously. + * + */ + +#define DRI_VALIDATE_TWO_DRAWABLES_INFO(psp, pdp, prp) \ +do { \ + while (*((pdp)->pStamp) != (pdp)->lastStamp || \ + *((prp)->pStamp) != (prp)->lastStamp) { \ + register unsigned int hwContext = (psp)->pSAREA->lock.lock & \ + ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_UNLOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext); \ + \ + DRM_SPINLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(prp); \ + DRM_SPINUNLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \ + \ + DRM_LIGHT_LOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext); \ + } \ +} while (0) + /** * Driver callback functions. @@ -128,8 +147,9 @@ struct __DriverAPIRec { /** * Context creation callback */ - GLboolean (*CreateContext)(const __GLcontextModes *glVis, - __DRIcontext *driContextPriv, + GLboolean (*CreateContext)(gl_api api, + const struct gl_config *glVis, + __DRIcontext *driContextPriv, void *sharedContextPrivate); /** @@ -142,7 +162,7 @@ struct __DriverAPIRec { */ GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *glVis, + const struct gl_config *glVis, GLboolean pixmapBuffer); /** @@ -277,7 +297,8 @@ struct __DRIdrawableRec { unsigned int index; /** - * Pointer to the "drawable has changed ID" stamp in the SAREA. + * Pointer to the "drawable has changed ID" stamp in the SAREA (or + * to dri2.stamp if DRI2 is being used). */ unsigned int *pStamp; @@ -358,6 +379,11 @@ struct __DRIdrawableRec { * GLX_MESA_swap_control. */ unsigned int swap_interval; + + struct { + unsigned int stamp; + drm_clip_rect_t clipRect; + } dri2; }; /** @@ -374,11 +400,6 @@ struct __DRIcontextRec { */ void *driverPrivate; - /** - * Pointer back to the \c __DRIcontext that contains this structure. - */ - __DRIcontext *pctx; - /** * Pointer to drawable currently bound to this context for drawing. */ @@ -393,6 +414,16 @@ struct __DRIcontextRec { * Pointer to screen on which this context was created. */ __DRIscreen *driScreenPriv; + + /** + * The loaders's private context data. This structure is opaque. + */ + void *loaderPrivate; + + struct { + int draw_stamp; + int read_stamp; + } dri2; }; /** @@ -476,29 +507,16 @@ struct __DRIscreenRec { int devPrivSize; /*@}*/ - /** - * Dummy context to which drawables are bound when not bound to any - * other context. - * - * A dummy hHWContext is created for this context, and is used by the GL - * core when a hardware lock is required but the drawable is not currently - * bound (e.g., potentially during a SwapBuffers request). The dummy - * context is created when the first "real" context is created on this - * screen. - */ - __DRIcontext dummyContextPriv; - /** * Device-dependent private information (not stored in the SAREA). * * This pointer is never touched by the DRI layer. */ +#ifdef __cplusplus + void *priv; +#else void *private; - - /** - * Pointer back to the \c __DRIscreen that contains this structure. - */ - __DRIscreen *psc; +#endif /* Extensions provided by the loader. */ const __DRIgetDrawableInfoExtension *getDrawableInfo; @@ -510,15 +528,18 @@ struct __DRIscreenRec { * fields will not be valid or initializaed in that case. */ int enabled; __DRIdri2LoaderExtension *loader; + __DRIimageLookupExtension *image; + __DRIuseInvalidateExtension *useInvalidate; } dri2; /* The lock actually in use, old sarea or DRI2 */ drmLock *lock; -}; - -extern void -__driUtilMessage(const char *f, ...); + driOptionCache optionInfo; + driOptionCache optionCache; + unsigned int api_mask; + void *loaderPrivate; +}; extern void __driUtilUpdateDrawableInfo(__DRIdrawable *pdp); @@ -530,4 +551,7 @@ driCalculateSwapUsage( __DRIdrawable *dPriv, extern GLint driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ); +extern void +dri2InvalidateDrawable(__DRIdrawable *drawable); + #endif /* _DRI_UTIL_H_ */