Commit a455d3814d692d22cd2b18f6f85ee96d6bf5ec76
- Diff rendering mode:
- inline
- side by side
include/ui/EGLKMSSurface.h
(1 / 1)
|   | |||
| 92 | 92 | uint32_t handle; | |
| 93 | 93 | size_t size; | |
| 94 | 94 | int width, height; | |
| 95 | int stride; | ||
| 95 | int pitch; | ||
| 96 | 96 | int bpp; | |
| 97 | 97 | int format; | |
| 98 | 98 | char *base; |
libs/ui/EGLKMSSurface.cpp
(16 / 7)
|   | |||
| 98 | 98 | egl_native_window_t::width = mFb[1 - mIndex].width; | |
| 99 | 99 | egl_native_window_t::height = mFb[1 - mIndex].height; | |
| 100 | 100 | egl_native_window_t::stride = | |
| 101 | mFb[1 - mIndex].stride / (mFb[1 - mIndex].bpp / 8); | ||
| 101 | mFb[1 - mIndex].pitch / (mFb[1 - mIndex].bpp / 8); | ||
| 102 | 102 | egl_native_window_t::format = mFb[1 - mIndex].format; | |
| 103 | 103 | #if AGL_SUPPORT | |
| 104 | 104 | egl_native_window_t::base = intptr_t(mFb[0].base); | |
| … | … | ||
| 414 | 414 | #if AGL_SUPPORT | |
| 415 | 415 | struct drm_i915_gem_mmap gmap; | |
| 416 | 416 | #endif | |
| 417 | int ret; | ||
| 417 | int pitch, ret; | ||
| 418 | size_t size; | ||
| 418 | 419 | ||
| 419 | 420 | mFb[i].width = mMode->hdisplay; | |
| 420 | 421 | mFb[i].height = mMode->vdisplay; | |
| 421 | 422 | mFb[i].format = GGL_PIXEL_FORMAT_RGB_565; | |
| 422 | 423 | mFb[i].bpp = bytesPerPixel(mFb[i].format) * 8; | |
| 423 | mFb[i].stride = mFb[i].width * mFb[i].bpp / 8; | ||
| 424 | mFb[i].size = mFb[i].stride * mFb[i].height; | ||
| 425 | 424 | ||
| 425 | pitch = mFb[i].width * mFb[i].bpp / 8; | ||
| 426 | /* align to 64 bytes */ | ||
| 427 | pitch = (pitch + 63) & ~63; | ||
| 428 | size = pitch * mFb[i].height; | ||
| 429 | /* align to page size */ | ||
| 430 | size = (size + 4095) & ~4095; | ||
| 431 | |||
| 432 | mFb[i].pitch = pitch; | ||
| 433 | mFb[i].size = size; | ||
| 434 | |||
| 426 | 435 | memset(&create, 0, sizeof(create)); | |
| 427 | 436 | memset(&flink, 0, sizeof(flink)); | |
| 428 | 437 | ||
| … | … | ||
| 464 | 464 | #endif | |
| 465 | 465 | ||
| 466 | 466 | ret = drmModeAddFB(fd, mFb[i].width, mFb[i].height, | |
| 467 | mFb[i].bpp, mFb[i].bpp, mFb[i].stride, | ||
| 467 | mFb[i].bpp, mFb[i].bpp, mFb[i].pitch, | ||
| 468 | 468 | mFb[i].handle, &mFb[i].id); | |
| 469 | 469 | if (ret) { | |
| 470 | 470 | LOGE("failed to add frame buffer"); | |
| … | … | ||
| 570 | 570 | "size = %d\n" | |
| 571 | 571 | "width = %d\n" | |
| 572 | 572 | "height = %d\n" | |
| 573 | "stride = %d\n" | ||
| 573 | "pitch = %d\n" | ||
| 574 | 574 | "bpp = %d\n", | |
| 575 | 575 | mFb[0].id, mFb[1].id, | |
| 576 | 576 | mFb[0].name, mFb[1].name, | |
| 577 | 577 | mFb[0].handle, mFb[1].handle, | |
| 578 | 578 | mFb[0].size, mFb[0].width, mFb[0].height, | |
| 579 | mFb[0].stride, mFb[0].bpp); | ||
| 579 | mFb[0].pitch, mFb[0].bpp); | ||
| 580 | 580 | ||
| 581 | 581 | mFlags = PAGE_FLIP; | |
| 582 | 582 | mIndex = 0; |

