dri: get rid of LIBGL_SHOW_FPS

The same functionnality can be achieved using GALLIUM_HUD=stdout,fps (and for
now a fallback is doing this if LIBGL_SHOW_FPS=1 is used).

This removes one entry from the vtable and simplify dri3_handle_present_event.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20494>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2022-12-16 14:08:35 +01:00
parent 87f4d79427
commit 31d95dd3c6
7 changed files with 0 additions and 69 deletions

View File

@@ -30,11 +30,6 @@ LibGL environment variables
if set to ``true``, do not use DrawArrays GLX protocol (for
debugging)
.. envvar:: LIBGL_SHOW_FPS
print framerate to stdout based on the number of ``glXSwapBuffers``
calls per second.
.. envvar:: LIBGL_DRI2_DISABLE
disable DRI2 if set to ``true``.

View File

@@ -101,7 +101,6 @@ static const struct loader_dri3_vtable egl_dri3_vtable = {
.get_dri_context = egl_dri3_get_dri_context,
.get_dri_screen = egl_dri3_get_dri_screen,
.flush_drawable = egl_dri3_flush_drawable,
.show_fps = NULL,
};
static EGLBoolean

View File

@@ -654,29 +654,6 @@ unsigned dri2GetSwapEventType(Display* dpy, XID drawable)
return glx_dpy->codes.first_event + GLX_BufferSwapComplete;
}
static void show_fps(struct dri2_drawable *draw)
{
const int interval =
((struct dri2_screen *) draw->base.psc)->show_fps_interval;
struct timeval tv;
uint64_t current_time;
gettimeofday(&tv, NULL);
current_time = (uint64_t)tv.tv_sec*1000000 + (uint64_t)tv.tv_usec;
draw->frames++;
if (draw->previous_time + interval * 1000000 <= current_time) {
if (draw->previous_time) {
fprintf(stderr, "libGL: FPS = %.2f\n",
((uint64_t)draw->frames * 1000000) /
(double)(current_time - draw->previous_time));
}
draw->frames = 0;
draw->previous_time = current_time;
}
}
static int64_t
dri2XcbSwapBuffers(Display *dpy,
__GLXDRIdrawable *pdraw,
@@ -744,10 +721,6 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
ret = dri2XcbSwapBuffers(pdraw->psc->dpy, pdraw,
target_msc, divisor, remainder);
if (psc->show_fps_interval) {
show_fps(priv);
}
return ret;
}

View File

@@ -131,37 +131,12 @@ glx_dri3_flush_drawable(struct loader_dri3_drawable *draw, unsigned flags)
loader_dri3_flush(draw, flags, __DRI2_THROTTLE_SWAPBUFFER);
}
static void
glx_dri3_show_fps(struct loader_dri3_drawable *draw, uint64_t current_ust)
{
struct dri3_drawable *priv = loader_drawable_to_dri3_drawable(draw);
const uint64_t interval =
((struct dri3_screen *) priv->base.psc)->show_fps_interval;
if (!interval)
return;
priv->frames++;
/* DRI3+Present together uses microseconds for UST. */
if (priv->previous_ust + interval * 1000000 <= current_ust) {
if (priv->previous_ust) {
fprintf(stderr, "libGL: FPS = %.2f\n",
((uint64_t) priv->frames * 1000000) /
(double)(current_ust - priv->previous_ust));
}
priv->frames = 0;
priv->previous_ust = current_ust;
}
}
static const struct loader_dri3_vtable glx_dri3_vtable = {
.set_drawable_size = glx_dri3_set_drawable_size,
.in_current_context = glx_dri3_in_current_context,
.get_dri_context = glx_dri3_get_dri_context,
.get_dri_screen = glx_dri3_get_dri_screen,
.flush_drawable = glx_dri3_flush_drawable,
.show_fps = glx_dri3_show_fps,
};
@@ -1021,11 +996,6 @@ dri3_create_screen(int screen, struct glx_display * priv)
free(driverName);
tmp = getenv("LIBGL_SHOW_FPS");
psc->show_fps_interval = tmp ? atoi(tmp) : 0;
if (psc->show_fps_interval < 0)
psc->show_fps_interval = 0;
InfoMessageF("Using DRI3 for screen %d\n", screen);
psc->prefer_back_buffer_reuse = 1;

View File

@@ -109,8 +109,6 @@ struct dri3_screen {
/* fd for display GPU in case of prime */
int fd_display_gpu;
int show_fps_interval;
struct loader_dri3_extensions loader_dri3_ext;
};

View File

@@ -543,9 +543,6 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
#endif
draw->last_present_mode = ce->mode;
if (draw->vtable->show_fps)
draw->vtable->show_fps(draw, ce->ust);
draw->ust = ce->ust;
draw->msc = ce->msc;
} else if (ce->serial == draw->eid) {

View File

@@ -111,7 +111,6 @@ struct loader_dri3_vtable {
__DRIcontext *(*get_dri_context)(struct loader_dri3_drawable *);
__DRIscreen *(*get_dri_screen)(void);
void (*flush_drawable)(struct loader_dri3_drawable *, unsigned);
void (*show_fps)(struct loader_dri3_drawable *, uint64_t);
};
#define LOADER_DRI3_NUM_BUFFERS (1 + LOADER_DRI3_MAX_BACK)