Samples and end2end tests mostly work.  Only one config, and no input.

BUG=angleproject:1297

Change-Id: I5b69babccc5b97e486d86e1721a0a1740ad80941
Reviewed-on: https://chromium-review.googlesource.com/319460
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
This commit is contained in:
Frank Henigman 2016-04-13 23:36:55 -04:00
Родитель e271a7e4a1
Коммит 538281f6e0
10 изменённых файлов: 1574 добавлений и 0 удалений

Просмотреть файл

@ -44,6 +44,8 @@
# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
# elif defined(ANGLE_PLATFORM_APPLE)
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
# elif defined(ANGLE_USE_OZONE)
# include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
# else
# error Unsupported OpenGL platform.
# endif
@ -146,6 +148,8 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap)
impl = new rx::DisplayGLX();
#elif defined(ANGLE_PLATFORM_APPLE)
impl = new rx::DisplayCGL();
#elif defined(ANGLE_USE_OZONE)
impl = new rx::DisplayOzone();
#else
// No display available
UNREACHABLE();
@ -170,6 +174,9 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap)
impl = new rx::DisplayGLX();
#elif defined(ANGLE_PLATFORM_APPLE)
impl = new rx::DisplayCGL();
#elif defined(ANGLE_USE_OZONE)
// This might work but has never been tried, so disallow for now.
impl = nullptr;
#else
#error Unsupported OpenGL platform.
#endif
@ -184,6 +191,8 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap)
impl = new rx::DisplayWGL();
#elif defined(ANGLE_USE_X11)
impl = new rx::DisplayGLX();
#elif defined(ANGLE_USE_OZONE)
impl = new rx::DisplayOzone();
#else
// No GLES support on this platform, fail display creation.
impl = nullptr;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,218 @@
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// DisplayOzone.h: Ozone implementation of egl::Display
#ifndef LIBANGLE_RENDERER_GL_EGL_OZONE_DISPLAYOZONE_H_
#define LIBANGLE_RENDERER_GL_EGL_OZONE_DISPLAYOZONE_H_
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <string>
#include "libANGLE/renderer/gl/DisplayGL.h"
#include "libANGLE/renderer/gl/egl/FunctionsEGLDL.h"
struct gbm_device;
struct gbm_bo;
namespace rx
{
class FramebufferGL;
// TODO(fjhenigman) Implement swap control. The following struct will be used for that.
// State-tracking data for the swap control to allow DisplayOzone to remember per
// drawable information for swap control.
struct SwapControlData final
{
SwapControlData();
// Set by the drawable
int targetSwapInterval;
// DisplayOzone-side state-tracking
int maxSwapInterval;
int currentSwapInterval;
};
class DisplayOzone final : public DisplayGL
{
public:
struct NativeWindow
{
int32_t x;
int32_t y;
int32_t width;
int32_t height;
int32_t borderWidth;
int32_t borderHeight;
int32_t visible;
int32_t depth;
};
class Buffer final : angle::NonCopyable
{
public:
Buffer(DisplayOzone *display,
uint32_t useFlags,
uint32_t gbmFormat,
uint32_t drmFormat,
uint32_t drmFormatFB,
int depthBits,
int stencilBits);
~Buffer();
bool initialize(const NativeWindow *window);
bool initialize(int32_t width, int32_t height);
void reset();
bool resize(int32_t width, int32_t height);
FramebufferGL *framebufferGL(const gl::FramebufferState &state);
void present();
uint32_t getDRMFB();
void bindTexImage();
GLuint getTexture();
int32_t getWidth() const { return mWidth; }
int32_t getHeight() const { return mHeight; }
GLuint getGLFB() const { return mGLFB; }
const NativeWindow *getNative() const { return mNative; }
private:
DisplayOzone *mDisplay;
const NativeWindow *mNative;
int mWidth;
int mHeight;
const int mDepthBits;
const int mStencilBits;
const uint32_t mUseFlags;
const uint32_t mGBMFormat;
const uint32_t mDRMFormat;
const uint32_t mDRMFormatFB;
gbm_bo *mBO;
int mDMABuf;
bool mHasDRMFB;
uint32_t mDRMFB;
EGLImageKHR mImage;
GLuint mColorBuffer;
GLuint mDSBuffer;
GLuint mGLFB;
GLuint mTexture;
};
DisplayOzone();
~DisplayOzone() override;
egl::Error initialize(egl::Display *display) override;
void terminate() override;
SurfaceImpl *createWindowSurface(const egl::Config *configuration,
EGLNativeWindowType window,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::Config *configuration,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::Config *configuration,
EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::Config *configuration,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
egl::ConfigSet generateConfigs() const override;
bool isDeviceLost() const override;
bool testDeviceLost() override;
egl::Error restoreLostDevice() override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
egl::Error getDevice(DeviceImpl **device) override;
std::string getVendorString() const override;
egl::Error waitClient() const override;
egl::Error waitNative(EGLint engine,
egl::Surface *drawSurface,
egl::Surface *readSurface) const override;
// TODO(fjhenigman) Implement this.
// Swap interval can be set globally or per drawable.
// This function will make sure the drawable's swap interval is the
// one required so that the subsequent swapBuffers acts as expected.
void setSwapInterval(EGLSurface drawable, SwapControlData *data);
egl::Error getDriverVersion(std::string *version) const override;
private:
const FunctionsGL *getFunctionsGL() const override;
EGLContext initializeContext(EGLConfig config, const egl::AttributeMap &eglAttributes);
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
void generateCaps(egl::Caps *outCaps) const override;
GLuint makeShader(GLuint type, const char *src);
void drawBuffer(Buffer *buffer);
void drawWithBlit(Buffer *buffer);
void drawWithTexture(Buffer *buffer);
void flushGL();
void presentScreen();
static void pageFlipHandler(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
void *data);
void pageFlipHandler(unsigned int sequence, uint64_t tv);
EGLConfig mContextConfig;
EGLContext mContext;
// TODO(fjhenigman) Implement swap control. The following stuff will be used for that.
enum class SwapControl
{
ABSENT,
EXT,
MESA,
SGI,
};
SwapControl mSwapControl;
int mMinSwapInterval;
int mMaxSwapInterval;
int mCurrentSwapInterval;
FunctionsEGLDL *mEGL;
FunctionsGL *mFunctionsGL;
gbm_device *mGBM;
drmModeConnectorPtr mConnector;
drmModeModeInfoPtr mMode;
drmModeCrtcPtr mCRTC;
bool mSetCRTC;
int32_t mWidth;
int32_t mHeight;
// Three scanout buffers cycle through four states. The state of a buffer
// is indicated by which of these pointers points to it.
// TODO(fjhenigman) It might be simpler/clearer to use a ring buffer.
Buffer *mScanning;
Buffer *mPending;
Buffer *mDrawing;
Buffer *mUnused;
GLuint mProgram;
GLuint mVertexShader;
GLuint mFragmentShader;
GLuint mVertexBuffer;
GLuint mIndexBuffer;
GLint mCenterUniform;
GLint mWindowSizeUniform;
GLint mBorderSizeUniform;
GLint mDepthUniform;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_EGL_OZONE_DISPLAYOZONE_H_

Просмотреть файл

@ -0,0 +1,96 @@
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SurfaceOzone.cpp: Ozone implementation of egl::SurfaceGL
#include "libANGLE/renderer/gl/egl/ozone/SurfaceOzone.h"
#include "libANGLE/renderer/gl/FramebufferGL.h"
#include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
namespace rx
{
SurfaceOzone::SurfaceOzone(RendererGL *renderer, DisplayOzone::Buffer *buffer)
: SurfaceGL(renderer), mBuffer(buffer)
{
}
SurfaceOzone::~SurfaceOzone()
{
delete mBuffer;
}
egl::Error SurfaceOzone::initialize()
{
return egl::Error(EGL_SUCCESS);
}
FramebufferImpl *SurfaceOzone::createDefaultFramebuffer(const gl::FramebufferState &state)
{
return mBuffer->framebufferGL(state);
}
egl::Error SurfaceOzone::makeCurrent()
{
return egl::Error(EGL_SUCCESS);
}
egl::Error SurfaceOzone::swap()
{
mBuffer->present();
return egl::Error(EGL_SUCCESS);
}
egl::Error SurfaceOzone::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
{
UNIMPLEMENTED();
return egl::Error(EGL_SUCCESS);
}
egl::Error SurfaceOzone::querySurfacePointerANGLE(EGLint attribute, void **value)
{
UNIMPLEMENTED();
return egl::Error(EGL_SUCCESS);
}
egl::Error SurfaceOzone::bindTexImage(gl::Texture *texture, EGLint buffer)
{
mBuffer->bindTexImage();
return egl::Error(EGL_SUCCESS);
}
egl::Error SurfaceOzone::releaseTexImage(EGLint buffer)
{
return egl::Error(EGL_SUCCESS);
}
void SurfaceOzone::setSwapInterval(EGLint interval)
{
mSwapControl.targetSwapInterval = interval;
}
EGLint SurfaceOzone::getWidth() const
{
return mBuffer->getWidth();
}
EGLint SurfaceOzone::getHeight() const
{
return mBuffer->getHeight();
}
EGLint SurfaceOzone::isPostSubBufferSupported() const
{
UNIMPLEMENTED();
return EGL_FALSE;
}
EGLint SurfaceOzone::getSwapBehavior() const
{
return EGL_BUFFER_PRESERVED;
}
} // namespace rx

Просмотреть файл

@ -0,0 +1,50 @@
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SurfaceOzone.h: Ozone implementation of egl::SurfaceGL
#ifndef LIBANGLE_RENDERER_GL_EGL_OZONE_SURFACEOZONE_H_
#define LIBANGLE_RENDERER_GL_EGL_OZONE_SURFACEOZONE_H_
#include "libANGLE/renderer/gl/SurfaceGL.h"
#include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
namespace rx
{
class SurfaceOzone : public SurfaceGL
{
public:
SurfaceOzone(RendererGL *renderer, DisplayOzone::Buffer *buffer);
~SurfaceOzone() override;
FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
egl::Error initialize() override;
egl::Error makeCurrent() override;
egl::Error swap() override;
egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) override;
egl::Error releaseTexImage(EGLint buffer) override;
void setSwapInterval(EGLint interval) override;
EGLint getWidth() const override;
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
private:
DisplayOzone::Buffer *mBuffer;
// TODO(fjhenigman) Implement swap control. This will be used for that.
SwapControlData mSwapControl;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_EGL_OZONE_SURFACEOZONE_H_

Просмотреть файл

@ -514,6 +514,13 @@
'libANGLE/renderer/gl/egl/FunctionsEGLDL.cpp',
'libANGLE/renderer/gl/egl/FunctionsEGLDL.h',
],
'libangle_gl_ozone_sources':
[
'libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp',
'libANGLE/renderer/gl/egl/ozone/DisplayOzone.h',
'libANGLE/renderer/gl/egl/ozone/SurfaceOzone.cpp',
'libANGLE/renderer/gl/egl/ozone/SurfaceOzone.h',
],
'libangle_gl_cgl_sources':
[
'libANGLE/renderer/gl/cgl/DisplayCGL.mm',
@ -778,6 +785,31 @@
],
},
}],
['use_ozone==1',
{
'defines':
[
'ANGLE_USE_OZONE',
],
'sources':
[
'<@(libangle_gl_egl_sources)',
'<@(libangle_gl_egl_dl_sources)',
'<@(libangle_gl_ozone_sources)',
],
'cflags':
[
'<!@(<(pkg-config) --cflags libdrm gbm)',
],
'link_settings': {
'ldflags': [
'<!@(<(pkg-config) --libs-only-L --libs-only-other libdrm gbm)',
],
'libraries': [
'<!@(<(pkg-config) --libs-only-l libdrm gbm) -ldl',
],
},
}],
['angle_link_glx==1',
{
'link_settings':

Просмотреть файл

@ -0,0 +1,12 @@
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "OSPixmap.h"
OSPixmap *CreateOSPixmap()
{
return nullptr;
}

Просмотреть файл

@ -0,0 +1,82 @@
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// OzoneWindow.cpp: Implementation of OSWindow for Ozone
#include "ozone/OzoneWindow.h"
int OzoneWindow::sLastDepth = 0;
OzoneWindow::OzoneWindow()
{
}
OzoneWindow::~OzoneWindow()
{
}
bool OzoneWindow::initialize(const std::string &name, size_t width, size_t height)
{
mNative.x = mX = 0;
mNative.y = mY = 0;
mNative.width = mWidth = width;
mNative.height = mHeight = height;
mNative.borderWidth = 5;
mNative.borderHeight = 5;
mNative.visible = 0;
mNative.depth = sLastDepth++;
return true;
}
void OzoneWindow::destroy()
{
}
EGLNativeWindowType OzoneWindow::getNativeWindow() const
{
return reinterpret_cast<EGLNativeWindowType>(&mNative);
}
EGLNativeDisplayType OzoneWindow::getNativeDisplay() const
{
return EGL_DEFAULT_DISPLAY;
}
void OzoneWindow::messageLoop()
{
}
void OzoneWindow::setMousePosition(int x, int y)
{
}
bool OzoneWindow::setPosition(int x, int y)
{
mNative.x = mX = x;
mNative.y = mY = y;
return true;
}
bool OzoneWindow::resize(int width, int height)
{
mNative.width = mWidth = width;
mNative.height = mHeight = height;
return true;
}
void OzoneWindow::setVisible(bool isVisible)
{
mNative.visible = isVisible;
}
void OzoneWindow::signalTestEvent()
{
}
OSWindow *CreateOSWindow()
{
return new OzoneWindow();
}

54
util/ozone/OzoneWindow.h Normal file
Просмотреть файл

@ -0,0 +1,54 @@
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// OzoneWindow.h: Definition of the implementation of OSWindow for Ozone
#ifndef UTIL_OZONE_WINDOW_H
#define UTIL_OZONE_WINDOW_H
#include <string>
#include "OSWindow.h"
class OzoneWindow : public OSWindow
{
public:
OzoneWindow();
~OzoneWindow();
bool initialize(const std::string &name, size_t width, size_t height) override;
void destroy() override;
EGLNativeWindowType getNativeWindow() const override;
EGLNativeDisplayType getNativeDisplay() const override;
void messageLoop() override;
void setMousePosition(int x, int y) override;
bool setPosition(int x, int y) override;
bool resize(int width, int height) override;
void setVisible(bool isVisible) override;
void signalTestEvent() override;
private:
struct Native
{
int32_t x;
int32_t y;
int32_t width;
int32_t height;
int32_t borderWidth;
int32_t borderHeight;
int32_t visible;
int32_t depth;
};
Native mNative;
static int sLastDepth;
};
#endif // UTIL_OZONE_WINDOW_H

Просмотреть файл

@ -66,6 +66,12 @@
'x11/X11Window.cpp',
'x11/X11Window.h',
],
'util_ozone_sources':
[
'ozone/OzonePixmap.cpp',
'ozone/OzoneWindow.cpp',
'ozone/OzoneWindow.h',
],
'util_osx_sources':
[
'osx/OSX_system_utils.cpp',
@ -162,6 +168,13 @@
],
},
}],
['use_ozone==1',
{
'sources':
[
'<@(util_ozone_sources)',
],
}],
['OS=="mac"',
{
'sources':