hardware/intel/hwcomposer
Revision | 112e172f7eaf8ab277f0e46b762a3becffe83892 (tree) |
---|---|
Time | 2013-03-07 16:20:38 |
Author | Tapani Pälli <tapani.palli@inte...> |
Commiter | Tapani Pälli |
hwcomposer: required hooks for display initialization
supports only 1 display and one config per display for now
Change-Id: I96f3002e4e99f9fd7931885f3014f4603681e99e
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
@@ -100,6 +100,60 @@ static int hwc_set(hwc_composer_device_1 *dev, | ||
100 | 100 | return 0; |
101 | 101 | } |
102 | 102 | |
103 | +// toggle display on or off | |
104 | +static int hwc_blank(struct hwc_composer_device_1* dev, int disp, int blank) | |
105 | +{ | |
106 | + // dummy implementation for now | |
107 | + return 0; | |
108 | +} | |
109 | + | |
110 | +// query number of different configurations available on display | |
111 | +static int hwc_get_display_cfgs(struct hwc_composer_device_1* dev, int disp, | |
112 | + uint32_t* configs, size_t* numConfigs) | |
113 | +{ | |
114 | + // support just one config per display for now | |
115 | + *configs = 1; | |
116 | + *numConfigs = 1; | |
117 | + | |
118 | + return 0; | |
119 | +} | |
120 | + | |
121 | +// query display attributes for a particular config | |
122 | +static int hwc_get_display_attrs(struct hwc_composer_device_1* dev, int disp, | |
123 | + uint32_t config, const uint32_t* attributes, int32_t* values) | |
124 | +{ | |
125 | + int attr = 0; | |
126 | + struct hwc_context_t* ctx = (struct hwc_context_t *) &dev->common; | |
127 | + | |
128 | + gralloc_drm_t *drm = ctx->gralloc_module->drm; | |
129 | + | |
130 | + // support only 1 display for now | |
131 | + if (disp > 0) | |
132 | + return -EINVAL; | |
133 | + | |
134 | + while(attributes[attr] != HWC_DISPLAY_NO_ATTRIBUTE) { | |
135 | + switch (attr) { | |
136 | + case HWC_DISPLAY_VSYNC_PERIOD: | |
137 | + values[attr] = drm->primary.mode.vrefresh; | |
138 | + break; | |
139 | + case HWC_DISPLAY_WIDTH: | |
140 | + values[attr] = drm->primary.mode.hdisplay; | |
141 | + break; | |
142 | + case HWC_DISPLAY_HEIGHT: | |
143 | + values[attr] = drm->primary.mode.vdisplay; | |
144 | + break; | |
145 | + case HWC_DISPLAY_DPI_X: | |
146 | + values[attr] = drm->primary.xdpi; | |
147 | + break; | |
148 | + case HWC_DISPLAY_DPI_Y: | |
149 | + values[attr] = drm->primary.ydpi; | |
150 | + break; | |
151 | + } | |
152 | + attr++; | |
153 | + } | |
154 | + return 0; | |
155 | +} | |
156 | + | |
103 | 157 | static int hwc_device_close(struct hw_device_t *dev) |
104 | 158 | { |
105 | 159 | struct hwc_context_t* ctx = (struct hwc_context_t*)dev; |
@@ -130,6 +184,9 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, | ||
130 | 184 | |
131 | 185 | dev->device.prepare = hwc_prepare; |
132 | 186 | dev->device.set = hwc_set; |
187 | + dev->device.blank = hwc_blank; | |
188 | + dev->device.getDisplayAttributes = hwc_get_display_attrs; | |
189 | + dev->device.getDisplayConfigs = hwc_get_display_cfgs; | |
133 | 190 | |
134 | 191 | *device = &dev->device.common; |
135 | 192 |