glx: move __glXGetUST into the DRI1 code
This is only used from the __DRI_SYSTEM_TIME loader extension, which only the DRI1 drivers ever looked for. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7219>
This commit is contained in:
parent
eb6877d3af
commit
3bb7ebfc75
|
@ -114,23 +114,6 @@ driOpenDriver(const char *driverName, void **out_driver_handle)
|
|||
return extensions;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
__driGetMSCRate(__DRIdrawable *draw,
|
||||
int32_t * numerator, int32_t * denominator,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawable *glxDraw = loaderPrivate;
|
||||
|
||||
return __glxGetMscRate(glxDraw->psc, numerator, denominator);
|
||||
}
|
||||
|
||||
_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
.base = {__DRI_SYSTEM_TIME, 1 },
|
||||
|
||||
.getUST = __glXGetUST,
|
||||
.getMSCRate = __driGetMSCRate
|
||||
};
|
||||
|
||||
#define __ATTRIB(attrib, field) \
|
||||
{ attrib, offsetof(struct glx_config, field) }
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
|
|||
extern void
|
||||
driReleaseDrawables(struct glx_context *gc);
|
||||
|
||||
extern const __DRIsystemTimeExtension systemTimeExtension;
|
||||
|
||||
extern void dri_message(int level, const char *f, ...) PRINTFLIKE(2, 3);
|
||||
|
||||
#define InfoMessageF(...) dri_message(_LOADER_INFO, __VA_ARGS__)
|
||||
|
|
|
@ -42,6 +42,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "dri2.h"
|
||||
#include "dri_sarea.h"
|
||||
#include <dlfcn.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include "xf86drm.h"
|
||||
|
@ -278,6 +279,55 @@ out:
|
|||
return e ? e->config : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unadjusted system time (UST). Currently, the UST is measured in
|
||||
* microseconds since Epoc. The actual resolution of the UST may vary from
|
||||
* system to system, and the units may vary from release to release.
|
||||
* Drivers should not call this function directly. They should instead use
|
||||
* \c glXGetProcAddress to obtain a pointer to the function.
|
||||
*
|
||||
* \param ust Location to store the 64-bit UST
|
||||
* \returns Zero on success or a negative errno value on failure.
|
||||
*
|
||||
* \sa glXGetProcAddress, PFNGLXGETUSTPROC
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
static int
|
||||
__glXGetUST(int64_t * ust)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if (ust == NULL) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (gettimeofday(&tv, NULL) == 0) {
|
||||
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
__driGetMSCRate(__DRIdrawable *draw,
|
||||
int32_t * numerator, int32_t * denominator,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawable *glxDraw = loaderPrivate;
|
||||
|
||||
return __glxGetMscRate(glxDraw->psc, numerator, denominator);
|
||||
}
|
||||
|
||||
static const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
.base = {__DRI_SYSTEM_TIME, 1 },
|
||||
|
||||
.getUST = __glXGetUST,
|
||||
.getMSCRate = __driGetMSCRate
|
||||
};
|
||||
|
||||
static GLboolean
|
||||
has_damage_post(Display * dpy)
|
||||
{
|
||||
|
|
|
@ -775,9 +775,6 @@ extern char *__glXGetString(Display * dpy, int opcode,
|
|||
extern const char __glXGLClientVersion[];
|
||||
extern const char __glXGLClientExtensions[];
|
||||
|
||||
/* Get the unadjusted system time */
|
||||
extern int __glXGetUST(int64_t * ust);
|
||||
|
||||
extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
|
||||
int32_t * numerator,
|
||||
int32_t * denominator);
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "apple/apple_glx.h"
|
||||
#include "util/debug.h"
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#ifndef GLX_USE_WINDOWSGL
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#endif /* GLX_USE_WINDOWSGL */
|
||||
|
@ -2649,40 +2648,6 @@ GLX_ALIAS(__GLXextFuncPtr, glXGetProcAddress,
|
|||
(const GLubyte * procName),
|
||||
(procName), glXGetProcAddressARB)
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/**
|
||||
* Get the unadjusted system time (UST). Currently, the UST is measured in
|
||||
* microseconds since Epoc. The actual resolution of the UST may vary from
|
||||
* system to system, and the units may vary from release to release.
|
||||
* Drivers should not call this function directly. They should instead use
|
||||
* \c glXGetProcAddress to obtain a pointer to the function.
|
||||
*
|
||||
* \param ust Location to store the 64-bit UST
|
||||
* \returns Zero on success or a negative errno value on failure.
|
||||
*
|
||||
* \sa glXGetProcAddress, PFNGLXGETUSTPROC
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
_X_HIDDEN int
|
||||
__glXGetUST(int64_t * ust)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if (ust == NULL) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (gettimeofday(&tv, NULL) == 0) {
|
||||
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
#endif /* GLX_DIRECT_RENDERING */
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
PUBLIC int
|
||||
|
|
Loading…
Reference in New Issue