aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglmode.c
diff options
context:
space:
mode:
authorJon Smirl <[email protected]>2005-05-13 18:31:35 +0000
committerJon Smirl <[email protected]>2005-05-13 18:31:35 +0000
commit7012d01d888d482f2c6ad1180231a482026d213a (patch)
tree426deb1a0de72921bf19851243443ab570d896f6 /src/egl/main/eglmode.c
parenta6ed129dfc4ccfd898d347543f745f0b7745e31d (diff)
First attempt at getting egl support up on dumb framebuffer.
Seems to be mostly working. Not all of egl API is implemented.
Diffstat (limited to 'src/egl/main/eglmode.c')
-rw-r--r--src/egl/main/eglmode.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c
index 857fa380c6e..26ea6bd6054 100644
--- a/src/egl/main/eglmode.c
+++ b/src/egl/main/eglmode.c
@@ -1,5 +1,7 @@
#include <assert.h>
#include <stdlib.h>
+#include <string.h>
+
#include "egldisplay.h"
#include "egldriver.h"
#include "eglmode.h"
@@ -10,6 +12,16 @@
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
+static char *
+my_strdup(const char *s)
+{
+ int l = strlen(s);
+ char *s2 = malloc(l + 1);
+ strcpy(s2, s);
+ return s2;
+}
+
+
/**
* Given an EGLModeMESA handle, return the corresponding _EGLMode object
* or null if non-existant.
@@ -44,7 +56,7 @@ _eglLookupMode(EGLDisplay dpy, EGLModeMESA mode)
*/
_EGLMode *
_eglAddMode(_EGLScreen *screen, EGLint width, EGLint height,
- EGLint depth, EGLint refreshRate)
+ EGLint refreshRate, char *name)
{
EGLint n;
_EGLMode *newModes;
@@ -52,7 +64,6 @@ _eglAddMode(_EGLScreen *screen, EGLint width, EGLint height,
assert(screen);
assert(width > 0);
assert(height > 0);
- assert(depth > 0);
assert(refreshRate > 0);
n = screen->NumModes;
@@ -62,9 +73,9 @@ _eglAddMode(_EGLScreen *screen, EGLint width, EGLint height,
screen->Modes[n].Handle = n + 1;
screen->Modes[n].Width = width;
screen->Modes[n].Height = height;
- screen->Modes[n].Depth = depth;
screen->Modes[n].RefreshRate = refreshRate;
screen->Modes[n].Stereo = EGL_FALSE;
+ screen->Modes[n].Name = my_strdup(name);
screen->NumModes++;
return screen->Modes + n;
}
@@ -176,3 +187,13 @@ _eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy,
}
return EGL_TRUE;
}
+
+
+const char *
+_eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode)
+{
+ _EGLMode *m = _eglLookupMode(dpy, mode);
+ return m->Name;
+}
+
+