From beb77957691641467212e437a7bf6af4c3c9efef Mon Sep 17 00:00:00 2001 From: Jeykumar Sankaran Date: Mon, 19 Mar 2012 17:52:40 -0700 Subject: [PATCH] libhwcomposer: Implement register_proc in HWC register_proc in HWC is used by SurfaceFlinger to register callback functions with HWC. This can be used by HWC to invoke SurfaceFlinger functions. Currently invalidate is the only function registerd and can be used by HWC to trigger a screen re-draw. CRs-Fixed: 342060 (cherry picked from commit 03a5cf4b9c52da2bfbd9706e85fddae63110ee9b) Change-Id: I464370ebf63b93e0ce238395b5c165647d777575 --- libhwcomposer/hwcomposer.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 54fdfed..7491276 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -912,6 +912,20 @@ static void handleHDMIStateChange(hwc_composer_device_t *dev, int externaltype) #endif } +/* + * Save callback functions registered to HWC + */ +static void hwc_registerProcs(struct hwc_composer_device* dev, hwc_procs_t const* procs) { + hwc_context_t* ctx = (hwc_context_t*)(dev); + + if(!ctx) { + LOGE("%s: Invalid context", __FUNCTION__); + return; + } + + ctx->device.reserved_proc[0] = (void*)procs; +} + /* * function to set the status of external display in hwc * Just mark flags and do stuff after eglSwapBuffers @@ -1819,6 +1833,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, dev->device.prepare = hwc_prepare; dev->device.set = hwc_set; + dev->device.registerProcs = hwc_registerProcs; dev->device.enableHDMIOutput = hwc_enableHDMIOutput; *device = &dev->device.common;