/*! @function getApertureRange @abstract Return reference to IODeviceMemory object representing memory range of framebuffer. @discussion IOFramebuffer subclasses must implement this method to describe the memory used by the framebuffer in the current mode. The OS will map this memory range into user space for client access - the range should only include vram memory not hardware registers. how is the connection specified? @param aperture The system will only access the aperture kIOFBSystemAperture. @result an IODeviceMemory instance. A reference will be consumed by the caller for each call of this method - the implementatation should create a new instance of IODeviceMemory for each call, or return one instance with a retain for each call. */ IODeviceMemory * com_doequalsglory_driver_IOProxyFramebuffer::getApertureRange(IOPixelAperture aper) { #if defined(DEBUG_CALLS) IOLog(kDebugStr "getApertureRange(%p)\n", aper); #endif if (fCurrentDisplayMode == 0) { return NULL; } if (aper != kIOFBSystemAperture) { return NULL; } IODeviceMemory *deviceMemory = getVRAMRange(); if (deviceMemory == NULL) { return NULL; } IODeviceMemory *apertureRange = IODeviceMemory::withSubRange(deviceMemory, 0, getApertureSize(fCurrentDisplayMode, fCurrentDepth)); deviceMemory->release(); // since getNVRAMRange() does a retain() return apertureRange; }
/*! @method enableController @abstract Perform first time setup of the framebuffer. @discussion IOFramebuffer subclasses should perform their initialization of the hardware here. The IOService start() method is not called at a time appropriate for this initialization. @param <#name#> <#description#> @result <#description#> */ IOReturn com_doequalsglory_driver_IOProxyFramebuffer::enableController(void) { #if defined(DEBUG_CALLS) IOLog(kDebugStr "enableController()\n"); #endif // set up initial display mode. should setDisplayMode do the // framebuffer memory allocation? I think so IODisplayModeID initialDisplayMode; IOIndex initialDepth; getStartupDisplayMode(&initialDisplayMode, &initialDepth); setDisplayMode(initialDisplayMode, initialDepth); // set up power management fPowerState = kDFBWakeState; IOPMPowerState powerStates [] = { {kIOPMPowerStateVersion1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // kDFBSleepState {kIOPMPowerStateVersion1, 0, 0, IOPMPowerOn, 0, 0, 0, 0, 0, 0, 0, 0 }, // kDFBDozeState {kIOPMPowerStateVersion1, IOPMDeviceUsable, IOPMPowerOn, IOPMPowerOn, 0, 0, 0, 0, 0, 0, 0, 0 } // kDFBWakeState }; registerPowerDriver(this, powerStates, 3); temporaryPowerClampOn(); changePowerStateTo(kDFBDozeState); getProvider()->setProperty(kIOPMIsPowerManagedKey, true); // we only allocate memory at enableController time instead of at // setDisplayMode, so make sure we have enough to handle whatever sized // display modes we might want to switch to fBuffer = IOBufferMemoryDescriptor::withCapacity(getApertureSize(kLargestDisplayMode, kDepth32Bit), kIODirectionInOut); return kIOReturnSuccess; }
cv::Mat CannyEdges::processImage(cv::Mat image) const{ double up = getUpThreshold(); double low = getLowThreshold(); int aperture = getApertureSize(); bool L2 = getUseL2(); if (image.channels() == 3){ cv::cvtColor(image,image,cv::COLOR_RGB2GRAY); } cv::Canny(image,image,up,low,aperture,L2); return image; }