Guest User

Untitled

a guest
Jul 1st, 2014
220
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/hwcomposer/hwcomposer_backend.cpp b/hwcomposer/hwcomposer_backend.cpp
  2. index 3b7864a..b46f418 100644
  3. --- a/hwcomposer/hwcomposer_backend.cpp
  4. +++ b/hwcomposer/hwcomposer_backend.cpp
  5. @@ -64,9 +64,8 @@ HwComposerBackend::create()
  6. // Some implementations insist on having the framebuffer module opened before loading
  7. // the hardware composer one. Therefor we rely on using the fbdev HYBRIS_EGLPLATFORM
  8. // here and use eglGetDisplay to initialize it.
  9. - if (qEnvironmentVariableIsEmpty("QT_QPA_NO_FRAMEBUFFER_FIRST")) {
  10. - eglGetDisplay(EGL_DEFAULT_DISPLAY);
  11. - }
  12. + if (qEnvironmentVariableIsEmpty("QT_QPA_NO_FRAMEBUFFER_FIRST"))
  13. + eglGetDisplay(EGL_DEFAULT_DISPLAY);
  14.  
  15. // Open hardware composer
  16. HWC_PLUGIN_ASSERT_ZERO(hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **)(&hwc_module)));
  17. @@ -133,7 +132,7 @@ HwComposerBackend::create()
  18. #ifdef HWC_DEVICE_API_VERSION_1_3
  19. case HWC_DEVICE_API_VERSION_1_3:
  20. /* Do not use virtual displays */
  21. - return new HwComposerBackend_v11(hwc_module, hwc_device, HWC_NUM_PHYSICAL_DISPLAY_TYPES);
  22. + return new HwComposerBackend_v11(hwc_module, hwc_device, HWC_NUM_DISPLAY_TYPES);
  23. break;
  24. #endif /* HWC_DEVICE_API_VERSION_1_3 */
  25. #endif /* HWC_PLUGIN_HAVE_HWCOMPOSER1_API */
  26. diff --git a/hwcomposer/hwcomposer_backend_v11.cpp b/hwcomposer/hwcomposer_backend_v11.cpp
  27. index 6edcb02..45ebdaf 100644
  28. --- a/hwcomposer/hwcomposer_backend_v11.cpp
  29. +++ b/hwcomposer/hwcomposer_backend_v11.cpp
  30. @@ -88,13 +88,32 @@ void HWComposer::present(HWComposerNativeWindowBuffer *buffer)
  31.  
  32. setFenceBufferFd(buffer, fblayer->releaseFenceFd);
  33.  
  34. - if (oldretire != -1)
  35. - {
  36. + if (oldretire != -1) {
  37. sync_wait(oldretire, -1);
  38. close(oldretire);
  39. }
  40. }
  41.  
  42. +void hwcv11_proc_invalidate(const struct hwc_procs* procs)
  43. +{
  44. + fprintf(stderr, "%s: procs=%x\n", __func__, procs);
  45. +}
  46. +
  47. +void hwcv11_proc_vsync(const struct hwc_procs* procs, int disp, int64_t timestamp)
  48. +{
  49. +}
  50. +
  51. +void hwcv11_proc_hotplug(const struct hwc_procs* procs, int disp, int connected)
  52. +{
  53. + fprintf(stderr, "%s: procs=%x, disp=%d, connected=%d\n", __func__, procs, disp, connected);
  54. +}
  55. +
  56. +static hwc_procs_t global_procs = {
  57. + hwcv11_proc_invalidate,
  58. + hwcv11_proc_vsync,
  59. + hwcv11_proc_hotplug,
  60. +};
  61. +
  62. HwComposerBackend_v11::HwComposerBackend_v11(hw_module_t *hwc_module, hw_device_t *hw_device, int num_displays)
  63. : HwComposerBackend(hwc_module)
  64. , hwc_device((hwc_composer_device_1_t *)hw_device)
  65. @@ -106,6 +125,7 @@ HwComposerBackend_v11::HwComposerBackend_v11(hw_module_t *hwc_module, hw_device_
  66. , oldrelease2(-1)
  67. , num_displays(num_displays)
  68. {
  69. + hwc_device->registerProcs(hwc_device, &global_procs);
  70. sleepDisplay(false);
  71.  
  72. @@ -143,11 +163,13 @@ HwComposerBackend_v11::createWindow(int width, int height)
  73. HWC_PLUGIN_EXPECT_NULL(hwc_list);
  74. HWC_PLUGIN_EXPECT_NULL(hwc_mList);
  75.  
  76. -
  77. size_t neededsize = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t);
  78. hwc_list = (hwc_display_contents_1_t *) malloc(neededsize);
  79. hwc_mList = (hwc_display_contents_1_t **) malloc(num_displays * sizeof(hwc_display_contents_1_t *));
  80. const hwc_rect_t r = { 0, 0, width, height };
  81. +#ifdef HWC_DEVICE_API_VERSION_1_3
  82. + const hwc_frect_t rf { 0.0f, 0.0f, width, height };
  83. +#endif
  84.  
  85. for (int i = 0; i < num_displays; i++) {
  86. hwc_mList[i] = hwc_list;
  87. @@ -164,11 +186,17 @@ HwComposerBackend_v11::createWindow(int width, int height)
  88. layer->transform = 0;
  89. layer->blending = HWC_BLENDING_NONE;
  90. layer->sourceCrop = r;
  91. +#ifdef HWC_DEVICE_API_VERSION_1_3
  92. + layer->sourceCropf = rf;
  93. +#endif
  94. layer->displayFrame = r;
  95. layer->visibleRegionScreen.numRects = 1;
  96. layer->visibleRegionScreen.rects = &layer->displayFrame;
  97. layer->acquireFenceFd = -1;
  98. layer->releaseFenceFd = -1;
  99. +#ifdef HWC_DEVICE_API_VERSION_1_2
  100. + layer->planeAlpha = 0xff;
  101. +#endif
  102.  
  103. layer = &hwc_list->hwLayers[1];
  104. memset(layer, 0, sizeof(hwc_layer_1_t));
  105. @@ -179,11 +207,17 @@ HwComposerBackend_v11::createWindow(int width, int height)
  106. layer->transform = 0;
  107. layer->blending = HWC_BLENDING_NONE;
  108. layer->sourceCrop = r;
  109. +#ifdef HWC_DEVICE_API_VERSION_1_3
  110. + layer->sourceCropf = rf;
  111. +#endif
  112. layer->displayFrame = r;
  113. layer->visibleRegionScreen.numRects = 1;
  114. layer->visibleRegionScreen.rects = &layer->displayFrame;
  115. layer->acquireFenceFd = -1;
  116. layer->releaseFenceFd = -1;
  117. +#ifdef HWC_DEVICE_API_VERSION_1_2
  118. + layer->planeAlpha = 0xff;
  119. +#endif
  120.  
  121. hwc_list->retireFenceFd = -1;
  122. hwc_list->flags = HWC_GEOMETRY_CHANGED;
  123. @@ -208,7 +242,7 @@ HwComposerBackend_v11::swap(EGLNativeDisplayType display, EGLSurface surface)
  124. // TODO: Wait for vsync?
  125.  
  126. HWC_PLUGIN_ASSERT_NOT_NULL(hwc_win);
  127. -
  128. +
  129. eglSwapBuffers(display, surface);
  130. }
RAW Paste Data