summaryrefslogtreecommitdiff
path: root/src/egl/main/eglmode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main/eglmode.c')
-rw-r--r--src/egl/main/eglmode.c60
1 files changed, 3 insertions, 57 deletions
diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c
index 0f3ba6e5c0..66446c0495 100644
--- a/src/egl/main/eglmode.c
+++ b/src/egl/main/eglmode.c
@@ -1,4 +1,3 @@
-#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -6,29 +5,14 @@
#include "egldisplay.h"
#include "egldriver.h"
#include "eglmode.h"
-#include "eglglobals.h"
+#include "eglcurrent.h"
#include "eglscreen.h"
+#include "eglstring.h"
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
-static char *
-my_strdup(const char *s)
-{
- if (s) {
- int l = strlen(s);
- char *s2 = malloc(l + 1);
- if (s2)
- strcpy(s2, s);
- return s2;
- }
- else {
- return NULL;
- }
-}
-
-
/**
* Given an EGLModeMESA handle, return the corresponding _EGLMode object
* or null if non-existant.
@@ -82,7 +66,7 @@ _eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height,
screen->Modes[n].RefreshRate = refreshRate;
screen->Modes[n].Optimal = EGL_FALSE;
screen->Modes[n].Interlaced = EGL_FALSE;
- screen->Modes[n].Name = my_strdup(name);
+ screen->Modes[n].Name = _eglstrdup(name);
screen->NumModes++;
return screen->Modes + n;
}
@@ -366,41 +350,3 @@ _eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m)
{
return m->Name;
}
-
-
-#if 0
-static int
-_eglRand(int max)
-{
- return rand() % max;
-}
-
-void
-_eglTestModeModule(void)
-{
- EGLint count = 30;
- _EGLMode *modes = (_EGLMode *) malloc(count * sizeof(_EGLMode));
- _EGLMode **modeList = (_EGLMode **) malloc(count * sizeof(_EGLMode*));
- EGLint i;
-
- for (i = 0; i < count; i++) {
- modes[i].Handle = _eglRand(20);
- modes[i].Width = 512 + 256 * _eglRand(2);
- modes[i].Height = 512 + 256 * _eglRand(2);
- modes[i].RefreshRate = 50 + 5 * _eglRand(3);
- modes[i].Interlaced = _eglRand(2);
- modes[i].Optimal = _eglRand(4) == 0;
- modeList[i] = modes + i;
- }
-
- /* sort array of pointers */
- qsort(modeList, count, sizeof(_EGLMode *), compareModes);
-
- for (i = 0; i < count; i++) {
- _EGLMode *m = modeList[i];
- printf("%2d: %3d %4d x %4d @ %3d opt %d int %d\n", i,
- m->Handle, m->Width, m->Height, m->RefreshRate,
- m->Optimal, m->Interlaced);
- }
-}
-#endif