本文整理汇总了C++中sp::getDevice方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::getDevice方法的具体用法?C++ sp::getDevice怎么用?C++ sp::getDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::getDevice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ensureFramebufferNativeWindowCreated
void QEglFSPandaHooks::ensureFramebufferNativeWindowCreated()
{
if (mFramebufferNativeWindow.get())
return;
mFramebufferNativeWindow = new FramebufferNativeWindow();
framebuffer_device_t const *fbDev = mFramebufferNativeWindow->getDevice();
if (!fbDev)
qFatal("Failed to get valid FramebufferNativeWindow, no way to create EGL surfaces");
ANativeWindow *window = mFramebufferNativeWindow.get();
window->query(window, NATIVE_WINDOW_FORMAT, &mFramebufferVisualId);
}
示例2: MemoryHeapBase
MemoryHeapPmem::MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap,
uint32_t flags)
: MemoryHeapBase()
{
char const * const device = pmemHeap->getDevice();
#ifdef HAVE_ANDROID_OS
if (device) {
int fd = open(device, O_RDWR | (flags & NO_CACHING ? O_SYNC : 0));
ALOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno));
if (fd >= 0) {
int err = ioctl(fd, PMEM_CONNECT, pmemHeap->heapID());
if (err < 0) {
ALOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d",
strerror(errno), fd, pmemHeap->heapID());
close(fd);
} else {
// everything went well...
mParentHeap = pmemHeap;
MemoryHeapBase::init(fd,
pmemHeap->getBase(),
pmemHeap->getSize(),
pmemHeap->getFlags() | flags,
device);
}
}
}
#else
mParentHeap = pmemHeap;
MemoryHeapBase::init(
dup(pmemHeap->heapID()),
pmemHeap->getBase(),
pmemHeap->getSize(),
pmemHeap->getFlags() | flags,
device);
#endif
}
示例3: LOGE
int
main(int argc, char** argv) {
LOGE("*** Noodleland ***");
gNativeWindow = new FramebufferNativeWindow();
const framebuffer_device_t* fbDev = gNativeWindow->getDevice();
if (!fbDev) {
LOGE("Display subsystem failed to initialise. check logs. exiting...");
return 0;
}
const ANativeWindow* window = gNativeWindow.get();
int width = 0, height = 0, format = 0;
window->query(window, NATIVE_WINDOW_WIDTH, &width);
window->query(window, NATIVE_WINDOW_HEIGHT, &height);
window->query(window, NATIVE_WINDOW_FORMAT, &format);
LOGE("width = %d", width);
LOGE("height = %d", height);
LOGE("format = 0x%08X", format);
LOGE("xdpi = %f", window->xdpi);
LOGE("ydpi = %f", window->ydpi);
EGLint numConfigs;
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, NULL, NULL);
eglGetConfigs(display, NULL, 0, &numConfigs);
EGLint attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
EGLConfig config = NULL;
status_t err = selectConfigForPixelFormat(display, attribs, format, &config);
LOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
EGLint r,g,b,a;
eglGetConfigAttrib(display, config, EGL_RED_SIZE, &r);
eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &g);
eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &b);
eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &a);
LOGE("r = %d, g = %d, b = %d, a = %d", r, g, b, a);
EGLSurface surface = eglCreateWindowSurface(display, config, gNativeWindow.get(), NULL);
eglQuerySurface(display, surface, EGL_WIDTH, &gWidth);
eglQuerySurface(display, surface, EGL_HEIGHT, &gHeight);
if (gNativeWindow->isUpdateOnDemand()) {
LOGE("*** PARTIAL UPDATES");
eglSurfaceAttrib(display, surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
}
EGLint contextAttribs[] = {
EGL_NONE
};
EGLContext context = eglCreateContext(display, config, NULL, contextAttribs);
EGLBoolean result;
result = eglMakeCurrent(display, surface, surface, context);
if (!result) {
LOGE("Couldn't create a working GLES context. check logs. exiting...");
return 0;
}
LOGE("EGL information");
LOGE("# of configs: %d", numConfigs);
LOGE("vendor : %s", eglQueryString(display, EGL_VENDOR));
LOGE("version : %s", eglQueryString(display, EGL_VERSION));
LOGE("extensions : %s", eglQueryString(display, EGL_EXTENSIONS));
LOGE("client API : %s", eglQueryString(display, EGL_CLIENT_APIS) ?: "Not Supported");
LOGE("EGL surface : %d-%d-%d-%d, config=%p", r, g, b, a, config);
LOGE("OpenGL information");
LOGE("vendor : %s", glGetString(GL_VENDOR));
LOGE("renderer : %s", glGetString(GL_RENDERER));
LOGE("version : %s", glGetString(GL_VERSION));
LOGE("extensions : %s", glGetString(GL_EXTENSIONS));
/* AMD Performance Counters */
GLint num_groups;
char buffer[512];
glGetPerfMonitorGroupsAMD(&num_groups, 0, NULL);
for (int group = 0; group < num_groups; group++) {
glGetPerfMonitorGroupStringAMD(group, 512, NULL, buffer);
LOGE("Perf Monitor Group [%d]: %s", group, buffer);
GLint num_counters, max_active_counters;
glGetPerfMonitorCountersAMD(group, &num_counters, &max_active_counters, 0, NULL);
LOGE(" Counters #: %d, Max Active: %d", num_counters, max_active_counters);
GLuint* counters = new GLuint[num_counters];
glGetPerfMonitorCountersAMD(group, NULL, NULL, num_counters, counters);
for (int c = 0; c < num_counters; c++) {
GLuint counter = counters[c];
glGetPerfMonitorCounterStringAMD(group, counter, 512, NULL, buffer);
LOGE(" %s (%u/0x%08x)", buffer, counter, counter);
}
delete [] counters;
}
//.........这里部分代码省略.........