summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_fb.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-05-13 14:33:08 -0400
committerChris Michael <cp.michael@samsung.com>2015-05-13 14:42:10 -0400
commit443010b465fec213f9a1f084328cc285591586e6 (patch)
tree092bd4a935730400657838903cd49789ef24c6d8 /src/lib/ecore_drm/ecore_drm_fb.c
parent3aaa9f2f9f2c998207eb3ad13876d70532e6bd0c (diff)
ecore-drm: Greatly improve drm rendering speed
Summary: This greatly improves rendering speed in evas drm engine. Previously we would always call drmModeSetCrtc regardless if it was needed or not. These changes greatly improve rendering speed in drm as we now only call drmModeSetCrtc if it is needed. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_fb.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_fb.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_fb.c b/src/lib/ecore_drm/ecore_drm_fb.c
index 982f962f7c..03a2a99a3b 100644
--- a/src/lib/ecore_drm/ecore_drm_fb.c
+++ b/src/lib/ecore_drm/ecore_drm_fb.c
@@ -183,22 +183,39 @@ ecore_drm_fb_set(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb)
183 return; 183 return;
184 } 184 }
185 185
186 if (!dev->next) dev->next = fb;
187 if (!dev->next) return;
188
186 EINA_LIST_FOREACH(dev->outputs, l, output) 189 EINA_LIST_FOREACH(dev->outputs, l, output)
187 { 190 {
188 int x = 0, y = 0; 191 int x = 0, y = 0;
189 192
193 if ((!output->enabled) || (!output->current_mode)) continue;
194
190 if (!output->cloned) 195 if (!output->cloned)
191 { 196 {
192 x = output->x; 197 x = output->x;
193 y = output->y; 198 y = output->y;
194 } 199 }
195 200
196 if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, fb->id, x, y, 201 if ((!dev->current) ||
197 &output->conn_id, 1, &output->current_mode->info)) 202 (dev->current->stride != dev->next->stride))
198 { 203 {
199 ERR("Failed to set Mode %dx%d for Output %s: %m", 204 DBG("Set Framebuffer %d For Output %s - %d %d",
200 output->current_mode->width, output->current_mode->height, 205 dev->next->id, output->name, x, y);
201 output->name); 206 DBG("\tOutput Geom: %d %d", output->x, output->y);
207 DBG("\tOutput Crtc Buffer: %d", output->crtc->buffer_id);
208
209 if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, dev->next->id,
210 x, y, &output->conn_id, 1,
211 &output->current_mode->info))
212 {
213 ERR("Failed to set Mode %dx%d for Output %s: %m",
214 output->current_mode->width, output->current_mode->height,
215 output->name);
216 }
217
218 /* TODO: set dpms on ?? */
202 } 219 }
203 } 220 }
204} 221}
@@ -219,12 +236,19 @@ ecore_drm_fb_send(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb, Ecore_Drm_Pageflip_Cb
219 if (!(cb = calloc(1, sizeof(Ecore_Drm_Pageflip_Callback)))) 236 if (!(cb = calloc(1, sizeof(Ecore_Drm_Pageflip_Callback))))
220 return; 237 return;
221 238
239 cb->dev = dev;
222 cb->func = func; 240 cb->func = func;
223 cb->data = data; 241 cb->data = data;
224 cb->count = eina_list_count(dev->outputs); 242
243 EINA_LIST_FOREACH(dev->outputs, l, output)
244 if (output->enabled) cb->count++;
245
246 /* cb->count = eina_list_count(dev->outputs); */
225 247
226 EINA_LIST_FOREACH(dev->outputs, l, output) 248 EINA_LIST_FOREACH(dev->outputs, l, output)
227 { 249 {
250 if ((!output->enabled) || (!output->current_mode)) continue;
251
228 if (drmModePageFlip(dev->drm.fd, output->crtc_id, fb->id, 252 if (drmModePageFlip(dev->drm.fd, output->crtc_id, fb->id,
229 DRM_MODE_PAGE_FLIP_EVENT, cb) < 0) 253 DRM_MODE_PAGE_FLIP_EVENT, cb) < 0)
230 { 254 {