libqservice: Add a client interface.

Add a client interface which interfaces with hwc.
qservice upon receiving IPC, provides a callback notification to the qclient
which does appropriate stuff in hwc.

In future, qservice can safely be even made a separate process with no changes
to exisiting code. This was not true earlier owing to the hwc pointer held by
qservice forcing it to be in the same process that hwc is in.

CRs-fixed: 452977
Change-Id: I05838c213f5d4606a6573693de1bacbc5876107e
This commit is contained in:
Saurabh Shah
2013-02-08 15:24:13 -08:00
parent 91dae25d49
commit 86c1729e75
12 changed files with 333 additions and 35 deletions

View File

@@ -19,6 +19,7 @@
*/
#define HWC_UTILS_DEBUG 0
#include <sys/ioctl.h>
#include <binder/IServiceManager.h>
#include <EGL/egl.h>
#include <cutils/properties.h>
#include <gralloc_priv.h>
@@ -30,8 +31,14 @@
#include "mdp_version.h"
#include "hwc_copybit.h"
#include "external.h"
#include "hwc_qclient.h"
#include "QService.h"
#include "comptype.h"
using namespace qClient;
using namespace qService;
using namespace android;
namespace qhwc {
// Opens Framebuffer device
@@ -60,7 +67,6 @@ void initContext(hwc_context_t *ctx)
openFramebufferDevice(ctx);
overlay::Overlay::initOverlay();
ctx->mOverlay = overlay::Overlay::getInstance();
ctx->mQService = qService::QService::getInstance(ctx);
ctx->mMDP.version = qdutils::MDPVersion::getInstance().getMDPVersion();
ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
@@ -93,6 +99,15 @@ void initContext(hwc_context_t *ctx)
pthread_cond_init(&(ctx->vstate.cond), NULL);
ctx->vstate.enable = false;
ctx->mExtDispConfiguring = false;
//Right now hwc starts the service but anybody could do it, or it could be
//independent process as well.
QService::init();
sp<IQClient> client = new QClient(ctx);
interface_cast<IQService>(
defaultServiceManager()->getService(
String16("display.qservice")))->connect(client);
ALOGI("Initializing Qualcomm Hardware Composer");
ALOGI("MDP version: %d", ctx->mMDP.version);
}