/*! \reimp */ void QQnxScreen::disconnect() { if (d->context) gf_context_free(d->context); if (d->memSurface) gf_surface_free(d->memSurface); if (d->hwSurface) gf_surface_free(d->hwSurface); if (d->layer) gf_layer_detach(d->layer); if (d->display) gf_display_detach(d->display); if (d->device) gf_dev_detach(d->device); d->memSurface = 0; d->hwSurface = 0; d->context = 0; d->layer = 0; d->display = 0; d->device = 0; }
void QQnxScreenContext::cleanup() { if (context) { gf_context_free(context); context = 0; } if (memSurface) { gf_surface_free(memSurface); memSurface = 0; } if (hwSurface) { gf_surface_free(hwSurface); hwSurface = 0; } if (layer) { gf_layer_detach(layer); layer = 0; } if (display) { gf_display_detach(display); display = 0; } if (device) { gf_dev_detach(device); device = 0; } }
/* * Function : Release Framebuffer Instance (Same For All Colorspace) * */ void QNXGF_release(LIBAROMA_FBP me) { /* Is Framebuffer Initialized ? */ if (me == NULL) { return; } /* Get Internal Data */ QNXGF_INTERNALP mi = (QNXGF_INTERNALP) me->internal; /* Release GF */ ALOGV("QNXGF Release Graphic Frameworks"); gf_context_free(mi->context); gf_surface_free(mi->surface); gf_layer_detach(mi->layer); gf_display_detach(mi->display); gf_dev_detach(mi->gdev); /* Free Internal Data */ ALOGV("QNXGF free internal data"); free(me->internal); libaroma_mutex_free(___qnxfbmutex); }
/* * Function : Framebuffer Driver Initializer * */ byte QNXGF_init(LIBAROMA_FBP me) { /* Allocating Internal Data */ ALOGV("QNXGF Initialized Internal Data"); QNXGF_INTERNALP mi = (QNXGF_INTERNALP) calloc(sizeof(QNXGF_INTERNAL),1); if (!mi) { ALOGE("QNXGF malloc internal data - Memory Error"); return 0; } libaroma_mutex_init(___qnxfbmutex); /* Set Internal Address */ me->internal = (voidp) mi; me->release = &QNXGF_release; me->double_buffer = 0; // 1; /************************* Init of Init QNX GF ******************************/ /* Device Attach */ if (gf_dev_attach( &mi->gdev, GF_DEVICE_INDEX(0), &mi->gdev_info ) != GF_ERR_OK) { ALOGE("QNXGF gf_dev_attach failed"); goto error; } /* Display Attach */ if (gf_display_attach( &mi->display, mi->gdev, 0, &mi->display_info ) != GF_ERR_OK) { ALOGE("QNXGF gf_display_attach failed"); gf_dev_detach(mi->gdev); goto error; } /* Layer Attach */ if (gf_layer_attach( &mi->layer, mi->display, 0, 0 ) != GF_ERR_OK) { ALOGE("QNXGF gf_layer_attach failed"); gf_display_detach(mi->display); gf_dev_detach(mi->gdev); goto error; } /* Create Surface */ if (gf_surface_create_layer( &mi->surface, &mi->layer, 1, 0, mi->display_info.xres, mi->display_info.yres, GF_FORMAT_PKLE_RGB565, NULL, 0 ) != GF_ERR_OK) { ALOGE("QNXGF gf_surface_create_layer failed"); gf_layer_detach(mi->layer); gf_display_detach(mi->display); gf_dev_detach(mi->gdev); goto error; } /* Set Surface */ gf_layer_set_surfaces(mi->layer, &mi->surface, 1); /* Create Context */ if (gf_context_create(&mi->context) != GF_ERR_OK) { ALOGE("QNXGF gf_context_create failed"); gf_surface_free(mi->surface); gf_layer_detach(mi->layer); gf_display_detach(mi->display); gf_dev_detach(mi->gdev); goto error; } /* Context Set Layer */ if (gf_context_set_surface(mi->context, mi->surface) != GF_ERR_OK) { ALOGE("QNXGF gf_context_set_surface failed"); gf_context_free(mi->context); gf_surface_free(mi->surface); gf_layer_detach(mi->layer); gf_display_detach(mi->display); gf_dev_detach(mi->gdev); goto error; } /* if (gf_display_set_dpms(mi->display,GF_DPMS_ON) != GF_ERR_OK) { ALOGI("QNXGF gf_display_set_dpms failed"); } else{ ALOGI("QNXGF gf_display_set_dpms OK"); } */ /************************* End of Init QNX GF *******************************/ /* Set AROMA Core Framebuffer Instance Values */ me->w = mi->display_info.xres; /* Width */ me->h = mi->display_info.yres; /* Height */ me->sz = me->w * me->h; /* Width x Height */ /* Set Callbacks */ me->start_post = &QNXGF_start_post; me->post = &QNXGF_post; me->end_post = &QNXGF_end_post; me->snapshoot = NULL; /* DUMP INFO */ QNXGF_dump(mi); /* Fixed DPI */ me->dpi = 160; /* OK */ goto ok; /* Return */ error: free(mi); return 0; ok: return 1; }