[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, openvg, updated. 7504021cd0d1968354c4
From: |
Rob Savoye |
Subject: |
[Gnash-commit] [SCM] Gnash branch, openvg, updated. 7504021cd0d1968354c456a4fd3243f66b85e627 |
Date: |
Fri, 26 Nov 2010 05:13:50 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, openvg has been updated
via 7504021cd0d1968354c456a4fd3243f66b85e627 (commit)
via b8db6fcb7d2191febd111aeedfee96ba95aad894 (commit)
via bd364199810b8f80bbc9dcc4ca3ee3b62665829c (commit)
via 3be73f1f83a7b9427a437455dbc111f3f933cf4a (commit)
via 62139fead63f033428be4705d779de8a6f86a711 (commit)
from 1432ffc95b31a81e3c56f0c3b0b70737abdaa047 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=7504021cd0d1968354c456a4fd3243f66b85e627
commit 7504021cd0d1968354c456a4fd3243f66b85e627
Author: Rob Savoye <address@hidden>
Date: Thu Nov 25 22:13:19 2010 -0700
don't call EGLDevice.attachWindow() for now.
diff --git a/librender/test_egl.cpp b/librender/test_egl.cpp
index 21fcdaa..c391f45 100644
--- a/librender/test_egl.cpp
+++ b/librender/test_egl.cpp
@@ -92,9 +92,9 @@ void
test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int argc, char *argv[])
{
if (egl.initDevice(argc, argv)) {
- runtest.pass("EGLDevice::init()");
+ runtest.pass("EGLDevice::initDevice()");
} else {
- runtest.fail("EGLDevice::init()");
+ runtest.fail("EGLDevice::initDevice()");
}
if (egl.bindClient(rtype)) {
@@ -102,7 +102,8 @@ test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int
argc, char *argv[])
} else {
runtest.fail("EGLDevice::bindClient()");
}
-
+
+#if 0
// Init'ing to zero uses the root screen as the display. Otherwise
// the argument should be an EGLNativeWindowType.
if (egl.attachWindow(0)) {
@@ -110,6 +111,7 @@ test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int
argc, char *argv[])
} else {
runtest.fail("EGLDevice::attachWindow(0)");
}
+#endif
// If there are more than zero configurations, something beyond
// initializing is working
http://git.savannah.gnu.org/cgit//commit/?id=b8db6fcb7d2191febd111aeedfee96ba95aad894
commit b8db6fcb7d2191febd111aeedfee96ba95aad894
Author: Rob Savoye <address@hidden>
Date: Thu Nov 25 22:12:33 2010 -0700
add more comments
diff --git a/librender/GnashDevice.h b/librender/GnashDevice.h
index b8e42e9..0927507 100644
--- a/librender/GnashDevice.h
+++ b/librender/GnashDevice.h
@@ -43,19 +43,27 @@ struct GnashDevice
/// the proper data type.
typedef long native_window_t;
- /// the list of supported renders that use devices
+ /// The list of supported renders that use devices
typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, XORG, VAAPI} rtype_t;
+ /// The list of supported device types
typedef enum {NODEV, EGL, DIRECTFB, X11} dtype_t;
+ GnashDevice(int argc, char *argv[]);
GnashDevice() { GNASH_REPORT_FUNCTION; };
+
virtual ~GnashDevice() { GNASH_REPORT_FUNCTION; };
+ /// Get the type of the instatiated device. Since the
+ /// renderer has a single value for the supported device,
+ /// this is used to see which device has been loaded.
virtual dtype_t getType() = 0;
- // Initialize GNASH Device layer
+ /// Initialize GNASH Device layer. This mostly just
+ /// initializes all the private data.
virtual bool initDevice(int argc, char *argv[]) = 0;
- // Initialize Gnash Window on device
+ /// Attach Native Window to device. This connects a
+ /// Native Window to the device so surfaces can be created.
virtual bool attachWindow(native_window_t window) = 0;
// Utility methods not in the base class
http://git.savannah.gnu.org/cgit//commit/?id=bd364199810b8f80bbc9dcc4ca3ee3b62665829c
commit bd364199810b8f80bbc9dcc4ca3ee3b62665829c
Author: Rob Savoye <address@hidden>
Date: Thu Nov 25 22:11:58 2010 -0700
handle X11 visuals, as the Mesa EGL runs on X11
diff --git a/librender/eglDevice.cpp b/librender/eglDevice.cpp
index 527530b..5e8bdd5 100644
--- a/librender/eglDevice.cpp
+++ b/librender/eglDevice.cpp
@@ -48,14 +48,14 @@
namespace gnash {
namespace renderer {
-
+
static const EGLint attrib32_list[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 0,
- EGL_DEPTH_SIZE, 24,
-#ifdef RENDERER_GLES1
+// EGL_ALPHA_SIZE, 0,
+// EGL_DEPTH_SIZE, 24,
+#ifdef RENDERER_GLES1
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
#endif
#ifdef RENDERER_GLES2
@@ -63,8 +63,9 @@ static const EGLint attrib32_list[] = {
#endif
#ifdef RENDERER_OPENVG
EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
- EGL_STENCIL_SIZE, 8,
+// EGL_STENCIL_SIZE, 8,
#endif
+ EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT,
// EGL_SAMPLE_BUFFERS, 1,
// EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER
@@ -163,6 +164,22 @@ EGLDevice::EGLDevice()
_bpp(32)
{
GNASH_REPORT_FUNCTION;
+ dbglogfile.setVerbosity();
+}
+
+EGLDevice::EGLDevice(int argc, char *argv[])
+ : _eglConfig(0),
+ _eglContext(EGL_NO_CONTEXT),
+ _eglSurface(EGL_NO_SURFACE),
+ _eglDisplay(EGL_NO_DISPLAY),
+ _eglNumOfConfigs(0),
+ _max_num_config(1),
+ _bpp(32)
+{
+ GNASH_REPORT_FUNCTION;
+ if (!initDevice(argc, argv)) {
+ log_error("Couldn't initialize EGL device!");
+ }
}
EGLDevice::EGLDevice(GnashDevice::rtype_t rtype)
@@ -175,6 +192,12 @@ EGLDevice::EGLDevice(GnashDevice::rtype_t rtype)
_bpp(32)
{
GNASH_REPORT_FUNCTION;
+ if (!initDevice(0, 0)) {
+ log_error("Couldn't initialize EGL device!");
+ }
+ if (!bindClient(rtype)) {
+ log_error("Couldn't bind client to type %d!", rtype);
+ }
}
EGLDevice::~EGLDevice()
@@ -229,10 +252,6 @@ EGLDevice::initDevice(int argc, char *argv[])
GNASH_REPORT_FUNCTION;
-#ifdef HAVE_LIBX11
- _x11.initDevice(argc, argv);
-#endif
-
EGLint major, minor;
// see egl_config.c for a list of supported configs, this looks for
// a 5650 (rgba) config, supporting OpenGL ES and windowed surfaces
@@ -259,7 +278,8 @@ EGLDevice::initDevice(int argc, char *argv[])
eglQueryString(_eglDisplay, EGL_VENDOR));
// step2 - bind to the wanted client API
- /// This is done by bindClient()
+ /// This is done by bindClient() later on
+ // bindClient(GnashDevice::OPENVG);
// step3 - find a suitable config
if (_bpp == 32) {
@@ -285,31 +305,9 @@ EGLDevice::initDevice(int argc, char *argv[])
return false;
}
- EGLint vid;
- if (!eglGetConfigAttrib(_eglDisplay, _eglConfig, EGL_NATIVE_VISUAL_ID,
&vid)) {
- log_error("eglGetConfigAttrib() failed (error %s)",
- getErrorString(eglGetError()));
- return false;
- }
-
-#ifdef HAVE_GTK2_XX
- GdkVisual* wvisual = gdk_drawable_get_visual(_drawing_area->window);
-
- GdkImage* tmpimage = gdk_image_new (GDK_IMAGE_FASTEST, wvisual, 1, 1);
-
- const GdkVisual* visual = tmpimage->visual;
-
- // FIXME: we use bpp instead of depth, because depth doesn't appear to
- // include the padding byte(s) the GdkImage actually has.
- const char *pixelformat = agg_detect_pixel_format(
- visual->red_shift, visual->red_prec,
- visual->green_shift, visual->green_prec,
- visual->blue_shift, visual->blue_prec,
- tmpimage->bpp * 8);
-
- gdk_image_destroy(tmpimage);
+#ifdef BUILD_X11_DEVICE
#endif
-
+
// printEGLConfig(_eglConfig);
#if 0
if (!checkEGLConfig(_eglConfig)) {
@@ -353,6 +351,23 @@ EGLDevice::supportsRenderer(rtype_t rtype)
return false;
}
+EGLint
+EGLDevice::getNativeVisual()
+{
+ EGLint vid;
+ if (_eglDisplay && _eglConfig) {
+ if (!eglGetConfigAttrib(_eglDisplay, _eglConfig, EGL_NATIVE_VISUAL_ID,
&vid)) {
+ log_error("eglGetConfigAttrib() failed (error %s)",
+ getErrorString(eglGetError()));
+ return false;
+ } else {
+ std::cerr << "EGL native visual is: " << vid << std::endl;
+ }
+ }
+
+ return vid;
+}
+
bool
EGLDevice::bindClient(rtype_t rtype)
{
@@ -403,20 +418,15 @@ bool
EGLDevice::attachWindow(GnashDevice::native_window_t window)
{
if (!window) {
-#if HAVE_GTK2
- // This renders to the root screen, instead of the canvas, but keeps
- // the test case from core dumping, and doesn't really effect anything
- // but seeing that you are rendering.
- _nativeWindow = gdk_x11_get_default_root_xwindow();
-#endif
+ return false;
} else {
_nativeWindow = static_cast<EGLNativeWindowType>(window);
}
log_debug("Initializing EGL Surface");
- if (_nativeWindow) {
- _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig,
_nativeWindow,
- window_attrib_list);
+ if (_nativeWindow && _eglDisplay && _eglConfig) {
+ _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig,
+ _nativeWindow, NULL);
} else {
log_error("No native window!");
}
diff --git a/librender/eglDevice.h b/librender/eglDevice.h
index 8bd9004..14d80a6 100644
--- a/librender/eglDevice.h
+++ b/librender/eglDevice.h
@@ -60,6 +60,7 @@ class EGLDevice : public GnashDevice
{
public:
EGLDevice();
+ EGLDevice(int argc, char *argv[]);
EGLDevice(GnashDevice::rtype_t rtype);
virtual ~EGLDevice();
@@ -166,6 +167,8 @@ class EGLDevice : public GnashDevice
return false;
}
+ EGLint getNativeVisual();
+
/// Check the requested EGl configuration against the current one
bool checkEGLConfig(EGLConfig config);
@@ -322,9 +325,6 @@ protected:
EGLint _max_num_config;
unsigned int _bpp;
std::vector<EGLSurface> _pbuffers;
-#ifdef HAVE_LIBX11
- x11::X11Device _x11;
-#endif
};
#define DUMP_CURRENT_SURFACE printEGLSurface(eglGetCurrentSurface(EGL_DRAW))
http://git.savannah.gnu.org/cgit//commit/?id=3be73f1f83a7b9427a437455dbc111f3f933cf4a
commit 3be73f1f83a7b9427a437455dbc111f3f933cf4a
Author: Rob Savoye <address@hidden>
Date: Thu Nov 25 22:10:31 2010 -0700
create an X11 window with an EGL visual
diff --git a/librender/x11/X11Device.cpp b/librender/x11/X11Device.cpp
index 2a1c3a6..590efa8 100644
--- a/librender/x11/X11Device.cpp
+++ b/librender/x11/X11Device.cpp
@@ -59,20 +59,62 @@ const char *FONT =
"/usr/share/fonts/truetype/freefont/FreeSerif.ttf";
X11Device::X11Device()
: _display(0),
_screennum(0),
+ _root(0),
_window(0),
_visual(0),
_screen(0),
_depth(0),
- _vinfo(0)
+ _vinfo(0),
+ _vid(0)
{
GNASH_REPORT_FUNCTION;
dbglogfile.setVerbosity();
}
+X11Device::X11Device(int vid)
+ : _display(0),
+ _screennum(0),
+ _root(0),
+ _window(0),
+ _visual(0),
+ _screen(0),
+ _depth(0),
+ _vinfo(0),
+ _vid(0)
+{
+ GNASH_REPORT_FUNCTION;
+ _vid = vid;
+
+ if (!initDevice(0, 0)) {
+ log_error("Couldn't initialize X11 device!");
+ }
+}
+
+X11Device::X11Device(int argc, char *argv[])
+ : _display(0),
+ _screennum(0),
+ _root(0),
+ _window(0),
+ _visual(0),
+ _screen(0),
+ _depth(0),
+ _vinfo(0),
+ _vid(0)
+{
+ GNASH_REPORT_FUNCTION;
+
+ if (!initDevice(argc, argv)) {
+ log_error("Couldn't initialize X11 device!");
+ }
+}
+
X11Device::~X11Device()
{
GNASH_REPORT_FUNCTION;
if (_display) {
+ if (_root) {
+ XDestroyWindow(_display, _root);
+ }
if (_window) {
XDestroyWindow(_display, _window);
}
@@ -86,31 +128,8 @@ X11Device::initDevice(int argc, char *argv[])
{
GNASH_REPORT_FUNCTION;
-#ifdef HAVE_GTK2_XX
- // As gdk_init() wants the command line arguments, we have to create
- // fake ones, as we don't care about the X11 options at this point.
- gdk_init(&argc, &argv);
-
-#if 0
- GdkVisual* wvisual = gdk_drawable_get_visual(_drawing_area->window);
-
- GdkImage* tmpimage = gdk_image_new (GDK_IMAGE_FASTEST, wvisual, 1, 1);
-
- const GdkVisual* visual = tmpimage->visual;
-
- // FIXME: we use bpp instead of depth, because depth doesn't appear to
- // include the padding byte(s) the GdkImage actually has.
- const char *pixelformat = agg_detect_pixel_format(
- visual->red_shift, visual->red_prec,
- visual->green_shift, visual->green_prec,
- visual->blue_shift, visual->blue_prec,
- tmpimage->bpp * 8);
-
- gdk_image_destroy(tmpimage);
-#endif // end of 0
-#else
char *dpyName = NULL;
- int num_visuals;
+ int num_visuals = 0;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
@@ -125,73 +144,33 @@ X11Device::initDevice(int argc, char *argv[])
return false;
}
- _window = XDefaultRootWindow(_display);
+ _root = XDefaultRootWindow(_display);
_screennum = XDefaultScreen(_display);
_depth = DefaultDepth(_display, _screennum);
_colormap = DefaultColormap(_display, _screennum);
-
- _visual = XDefaultVisual(_display, _screennum);
-
_screen = DefaultScreenOfDisplay(_display);
-
- VisualID vid = XVisualIDFromVisual(_visual);
XVisualInfo visTemplate;
- visTemplate.visualid = vid;
+ // _vid is from the Mesa EGL. The visual for EGL needs to match
+ // the one for X11.
+ std::cerr << "X11 visual from EGL is: " << _vid << std::endl;
+ visTemplate.visualid = _vid;
_vinfo = XGetVisualInfo(_display, VisualIDMask, &visTemplate,
&num_visuals);
- // std::cerr << "Num Visuals: " << num_visuals << std::endl;
+ std::cerr << "Num Visuals: " << num_visuals << std::endl;
if (!_vinfo) {
log_error("Error: couldn't get X visual\n");
exit(1);
}
-
- // int re = visInfo[0].bits_per_rgb;
+ std::cerr << "X11 visual is: " << _vinfo->visual << std::endl;
- XWindowAttributes gattr;
- XGetWindowAttributes(_display, _window, &gattr);
+ // XWindowAttributes gattr;
+ // XGetWindowAttributes(_display, _root, &gattr);
// std::cerr << "Width: " << gattr.backing_store << std::endl;
// std::cerr << "Width: " << gattr.depth << std::endl;
-#if 0
- const char *name = "Foo";
- XSetWindowAttributes attr;
- unsigned long mask;
- Window win;
- int width, height;
- int x, y;
-
- // window attributes
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(_display, root, visInfo->visual,
AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(_display, root, 0, 0, width, height,
- 0, visInfo->depth, InputOutput,
- visInfo->visual, mask, &attr );
-
-#endif
-
-#if 0
- // set hints and properties
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(_display, win, &sizehints);
- XSetStandardProperties(_display, win, name, name,
- None, (char **)NULL, 0, sizehints);
-#endif
-
- // XFree(visInfo);
-#endif
-
return true;
}
@@ -233,7 +212,7 @@ X11Device::createWindow(const char *name, int x, int y, int
width, int height)
return;
}
- if (!_window) {
+ if (!_root) {
log_error("No drawable window set!");
return;
}
@@ -247,11 +226,11 @@ X11Device::createWindow(const char *name, int x, int y,
int width, int height)
// window attributes
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap(_display, _window, _vinfo->visual,
AllocNone);
+ attr.colormap = XCreateColormap(_display, _root, _vinfo->visual,
AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- _window = XCreateWindow(_display, _window, 0, 0, width, width,
+ _window = XCreateWindow(_display, _root, 0, 0, width, width,
0, _vinfo->depth, InputOutput,
_vinfo->visual, mask, &attr);
@@ -266,15 +245,15 @@ X11Device::createWindow(const char *name, int x, int y,
int width, int height)
XSetStandardProperties(_display, _window, name, name, None, (char **)NULL,
0, &sizehints);
+
XMapWindow(_display, _window);
-// reshape(width, height);
-
-
}
void
-X11Device::event_loop(size_t passes)
+X11Device::eventLoop(size_t passes)
{
+ std::cerr << "Starting event loop..." << std::endl;
+
while (passes--) {
int redraw = 0;
XEvent event;
diff --git a/librender/x11/X11Device.h b/librender/x11/X11Device.h
index 0ef2cec..7a4e887 100644
--- a/librender/x11/X11Device.h
+++ b/librender/x11/X11Device.h
@@ -48,7 +48,9 @@ class X11Device : public GnashDevice
public:
X11Device();
-
+ X11Device(int);
+ X11Device(int argc, char *argv[]);
+
// virtual classes should have virtual destructors
virtual ~X11Device();
@@ -90,6 +92,12 @@ class X11Device : public GnashDevice
// Using X11 always means a native renderer
bool isNativeRender() { return true; }
+ Window getDrawableWindow() { return _root; };
+
+ //
+ // Testing Support
+ //
+
// Create an X11 window to render in. This is only used by testing
void createWindow(const char *name, int x, int y, int width, int height);
@@ -98,17 +106,20 @@ class X11Device : public GnashDevice
/// have been handled. The first 5 are used up by creating the window.
///
/// @param passes the number of events to process before returning.
- void event_loop(size_t passes);
+ /// @return nothing
+ void eventLoop(size_t passes);
protected:
Display *_display;
int _screennum;
+ Window _root;
Window _window;
Colormap _colormap;
Visual *_visual;
Screen *_screen;
int _depth;
XVisualInfo *_vinfo;
+ int _vid;
};
typedef void (*init_func)();
http://git.savannah.gnu.org/cgit//commit/?id=62139fead63f033428be4705d779de8a6f86a711
commit 62139fead63f033428be4705d779de8a6f86a711
Author: Rob Savoye <address@hidden>
Date: Thu Nov 25 22:09:44 2010 -0700
add more constructors to reduce the API steps
diff --git a/librender/directfb/DirectFBDevice.cpp
b/librender/directfb/DirectFBDevice.cpp
index 7d70fbb..8d849ce 100644
--- a/librender/directfb/DirectFBDevice.cpp
+++ b/librender/directfb/DirectFBDevice.cpp
@@ -63,6 +63,23 @@ DirectFBDevice::DirectFBDevice()
GNASH_REPORT_FUNCTION;
}
+DirectFBDevice::DirectFBDevice(int argc, char *argv[])
+ : _dfb(0),
+ _surface(0),
+ _keyboard(0),
+ _keybuffer(0),
+ _provider(0),
+ _font(0),
+ _layer(0),
+ _screen(0)
+{
+ GNASH_REPORT_FUNCTION;
+
+ if (!initDevice(argc, argv)) {
+ log_error("Couldn't initialize DirectFB device!");
+ }
+}
+
DirectFBDevice::~DirectFBDevice()
{
// GNASH_REPORT_FUNCTION;
diff --git a/librender/directfb/DirectFBDevice.h
b/librender/directfb/DirectFBDevice.h
index b70e80d..c8ad9a7 100644
--- a/librender/directfb/DirectFBDevice.h
+++ b/librender/directfb/DirectFBDevice.h
@@ -45,6 +45,8 @@ class DirectFBDevice : public GnashDevice
{
public:
DirectFBDevice();
+ DirectFBDevice(int argc, char *argv[]);
+
~DirectFBDevice();
dtype_t getType() { return DIRECTFB; };
-----------------------------------------------------------------------
Summary of changes:
librender/GnashDevice.h | 14 +++-
librender/directfb/DirectFBDevice.cpp | 17 ++++
librender/directfb/DirectFBDevice.h | 2 +
librender/eglDevice.cpp | 96 ++++++++++++----------
librender/eglDevice.h | 6 +-
librender/test_egl.cpp | 8 +-
librender/x11/X11Device.cpp | 141 ++++++++++++++-------------------
librender/x11/X11Device.h | 15 +++-
8 files changed, 164 insertions(+), 135 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, openvg, updated. 7504021cd0d1968354c456a4fd3243f66b85e627,
Rob Savoye <=