Index: third_party/libva/test/android_winsys.cpp |
diff --git a/third_party/libva/test/android_winsys.cpp b/third_party/libva/test/android_winsys.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ba75bdf2163748adb9a13eedcf886d8a938e6f54 |
--- /dev/null |
+++ b/third_party/libva/test/android_winsys.cpp |
@@ -0,0 +1,41 @@ |
+#include <ui/DisplayInfo.h> |
+ |
+namespace android { |
+ class Test { |
+ public: |
+ static const sp<ISurface>& getISurface(const sp<Surface>& s) { |
+ return s->getISurface(); |
+ } |
+ }; |
+}; |
+ |
+#define min(a,b) (a<b?a:b) |
+#define SURFACE_CREATE(client,surface_ctrl,android_surface, android_isurface, x, y, win_width, win_height) \ |
+do { \ |
+ client = new SurfaceComposerClient(); \ |
+ android::DisplayInfo info; \ |
+ int w, h; \ |
+ \ |
+ client->getDisplayInfo(android::DisplayID(0), &info); \ |
+ /*w = min(win_width, info.w);*/ \ |
+ /*h = min(win_height, info.h);*/ \ |
+ w = win_width, h = win_height; \ |
+ \ |
+ surface_ctrl = client->createSurface(getpid(), 0, w, h, PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers); \ |
+ android_surface = surface_ctrl->getSurface(); \ |
+ android_isurface = Test::getISurface(android_surface); \ |
+ \ |
+ client->openTransaction(); \ |
+ surface_ctrl->setPosition(x, y); \ |
+ client->closeTransaction(); \ |
+ \ |
+ client->openTransaction(); \ |
+ surface_ctrl->setSize(w, h); \ |
+ client->closeTransaction(); \ |
+ \ |
+ client->openTransaction(); \ |
+ surface_ctrl->setLayer(0x100000); \ |
+ client->closeTransaction(); \ |
+} while (0) |
+ |
+ |