1 #define LOG_TAG "hwc-platform-imagination"
3 #include "platformimagination.h"
7 #include "img_gralloc1_public.h"
11 Importer *Importer::CreateInstance(DrmDevice *drm) {
12 ImaginationImporter *importer = new ImaginationImporter(drm);
16 int ret = importer->Init();
18 ALOGE("Failed to initialize the Imagination importer %d", ret);
25 int ImaginationImporter::ConvertBoInfo(buffer_handle_t handle,
27 IMG_native_handle_t *hnd = (IMG_native_handle_t *)handle;
31 /* Extra bits are responsible for buffer compression and memory layout */
32 if (hnd->iFormat & ~0x10f) {
33 ALOGV("Special buffer formats are not supported");
37 bo->width = hnd->iWidth;
38 bo->height = hnd->iHeight;
39 bo->usage = hnd->usage;
40 bo->hal_format = hnd->iFormat;
41 bo->pixel_stride = hnd->aiStride[0];
43 int sub = std::min(hnd->iNumSubAllocs, HWC_DRM_BO_MAX_PLANES);
44 for (int i = 0; i < sub; i++) {
45 bo->prime_fds[i] = hnd->fd[i];
46 bo->offsets[i] = hnd->aulPlaneOffset[i];
47 bo->pitches[i] = ALIGN(hnd->iWidth, HW_ALIGN) * hnd->uiBpp >> 3;
50 switch (hnd->iFormat) {
51 #ifdef HAL_PIXEL_FORMAT_BGRX_8888
52 case HAL_PIXEL_FORMAT_BGRX_8888:
53 bo->format = DRM_FORMAT_XRGB8888;
57 bo->format = ConvertHalFormatToDrm(hnd->iFormat & 0xf);
58 if (bo->format == DRM_FORMAT_INVALID) {
59 ALOGV("Cannot convert hal format to drm format %u", hnd->iFormat);
67 std::unique_ptr<Planner> Planner::CreateInstance(DrmDevice *) {
68 std::unique_ptr<Planner> planner(new Planner);
69 planner->AddStage<PlanStageGreedy>();
72 } // namespace android