dra7xx: weston: add patches for weston 1.11 83/8883/3
authorKarthik Ramanan <a0393906@ti.com>
Thu, 23 Mar 2017 10:02:00 +0000 (15:32 +0530)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tue, 28 Mar 2017 10:00:18 +0000 (10:00 +0000)
These patches are rehosted from meta-arago
Reference: https://goo.gl/889cIi

Change-Id: I888303ddd99a431587ebb4f7ed5f0f90a6e6538d
Signed-off-by: Karthik Ramanan <a0393906@ti.com>
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-Add-soc-performance-monitor-utilites.patch
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-compositor-drm-fix-hotplug-weston-termination-proble.patch [new file with mode: 0644]
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-compositor-drm-support-RGB565-with-pixman-renderer.patch [new file with mode: 0644]
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-weston-Enabling-DRM-backend-with-multiple-displays.patch [new file with mode: 0644]
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0002-Weston-Allow-visual_id-to-be-0.patch [new file with mode: 0644]
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch [new file with mode: 0644]
meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0004-Weston-Fix-touch-screen-crash-issue.patch [new file with mode: 0644]
meta-agl-bsp/meta-ti/recipes-arago/weston/weston_%.bbappend

index 751a7ce..4268b7d 100644 (file)
@@ -7,7 +7,7 @@ Signed-off-by: Karthik Ramanan <a0393906@ti.com>
 ---
  Makefile.am                       |   17 +-
  clients/Dra7xx_ddrstat_speed.c    |  494 +++++++++++++
- clients/soc_performance_monitor.c |  625 ++++++++++++++++
+ clients/soc_performance_monitor.c |  630 ++++++++++++++++
  clients/soc_performance_monitor.h |   40 ++
  clients/statcoll.c                | 1433 +++++++++++++++++++++++++++++++++++++
  clients/statcoll.h                |  152 ++++
@@ -564,7 +564,7 @@ new file mode 100644
 index 0000000..5d1db32
 --- /dev/null
 +++ b/clients/soc_performance_monitor.c
-@@ -0,0 +1,625 @@
+@@ -0,0 +1,630 @@
 +/*
 + * Copyright (C) 2016 Texas Instruments
 + * Author: Karthik Ramanan <karthik.ramanan@ti.com>
@@ -666,9 +666,14 @@ index 0000000..5d1db32
 +
 +                                      for(i=cpu_load_offset; i<cpu_load_offset+total_cpu_load_items; i++) {
 +                                              if(strcmp(text[i*2], field) == 0) {
-+                                                      y[i*2+1] = atoi(value)/100.0;
-+                                                      sprintf(text[i*2+1], " %02s%s", value,"%");
-+                                                      printd("CPULOAD: Updating %s with %s\n", field, value);
++                                                      if(strlen(value) <= 2) {
++                                                              y[i*2+1] = atoi(value)/100.0;
++                                                              sprintf(text[i*2+1], " %02s%s", value,"%");
++                                                              printd("CPULOAD: Updating %s with %s\n", field, value);
++                                                      }
++                                                      else {
++                                                              printf("Ignoring value: %s\n", value);
++                                                      }
 +                                              }
 +                                      }
 +                              }
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-compositor-drm-fix-hotplug-weston-termination-proble.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-compositor-drm-fix-hotplug-weston-termination-proble.patch
new file mode 100644 (file)
index 0000000..fde38d5
--- /dev/null
@@ -0,0 +1,112 @@
+From 8497d95cc77af9bbdbbce03878e9fd273d94ba7f Mon Sep 17 00:00:00 2001
+From: Eric Ruei <e-ruei1@ti.com>
+Date: Wed, 7 Dec 2016 15:25:25 -0500
+Subject: [PATCH] compositor-drm: fix hotplug weston termination problem
+
+The weston_compositor_exit() is always invoked at function update_outputs()
+if all connector ids are greater than 31 because the 32-bit b->connector_allocator
+will be zero. Need to increase the size of both crtc_allocator and
+connector_allocator from 32-bit to 64-bit until a better solution is implemented.
+
+Upstream-Status: Submitted [wayland-devel@lists.freedesktop.org]
+
+Signed-off-by: Eric Ruei <e-ruei1@ti.com>
+---
+ src/compositor-drm.c | 30 +++++++++++++++---------------
+ 1 file changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/src/compositor-drm.c b/src/compositor-drm.c
+index 6485b39..e4d889f 100644
+--- a/src/compositor-drm.c
++++ b/src/compositor-drm.c
+@@ -103,8 +103,8 @@ struct drm_backend {
+       struct gbm_device *gbm;
+       uint32_t *crtcs;
+       int num_crtcs;
+-      uint32_t crtc_allocator;
+-      uint32_t connector_allocator;
++      uint64_t crtc_allocator;
++      uint64_t connector_allocator;
+       struct wl_listener session_listener;
+       uint32_t format;
+@@ -1360,8 +1360,8 @@ drm_output_destroy(struct weston_output *output_base)
+                      &output->connector_id, 1, &origcrtc->mode);
+       drmModeFreeCrtc(origcrtc);
+-      b->crtc_allocator &= ~(1 << output->crtc_id);
+-      b->connector_allocator &= ~(1 << output->connector_id);
++      b->crtc_allocator &= ~(1ULL << output->crtc_id);
++      b->connector_allocator &= ~(1ULL << output->connector_id);
+       if (b->use_pixman) {
+               drm_output_fini_pixman(output);
+@@ -1842,8 +1842,8 @@ find_crtc_for_connector(struct drm_backend *b,
+               drmModeFreeEncoder(encoder);
+               for (i = 0; i < resources->count_crtcs; i++) {
+-                      if (possible_crtcs & (1 << i) &&
+-                          !(b->crtc_allocator & (1 << resources->crtcs[i])))
++                      if (possible_crtcs & (1ULL << i) &&
++                          !(b->crtc_allocator & (1ULL << resources->crtcs[i])))
+                               return i;
+               }
+       }
+@@ -2404,9 +2404,9 @@ create_output_for_connector(struct drm_backend *b,
+       output->crtc_id = resources->crtcs[i];
+       output->pipe = i;
+-      b->crtc_allocator |= (1 << output->crtc_id);
++      b->crtc_allocator |= (1ULL << output->crtc_id);
+       output->connector_id = connector->connector_id;
+-      b->connector_allocator |= (1 << output->connector_id);
++      b->connector_allocator |= (1ULL << output->connector_id);
+       output->original_crtc = drmModeGetCrtc(b->drm.fd, output->crtc_id);
+       output->dpms_prop = drm_get_prop(b->drm.fd, connector, "DPMS");
+@@ -2511,8 +2511,8 @@ err_free:
+       }
+       drmModeFreeCrtc(output->original_crtc);
+-      b->crtc_allocator &= ~(1 << output->crtc_id);
+-      b->connector_allocator &= ~(1 << output->connector_id);
++      b->crtc_allocator &= ~(1ULL << output->crtc_id);
++      b->connector_allocator &= ~(1ULL << output->connector_id);
+       free(output);
+       return -1;
+@@ -2658,7 +2658,7 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
+       drmModeRes *resources;
+       struct drm_output *output, *next;
+       int x = 0, y = 0;
+-      uint32_t connected = 0, disconnects = 0;
++      uint64_t connected = 0, disconnects = 0;
+       int i;
+       resources = drmModeGetResources(b->drm.fd);
+@@ -2680,9 +2680,9 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
+                       continue;
+               }
+-              connected |= (1 << connector_id);
++              connected |= (1ULL << connector_id);
+-              if (!(b->connector_allocator & (1 << connector_id))) {
++              if (!(b->connector_allocator & (1ULL << connector_id))) {
+                       struct weston_output *last =
+                               container_of(b->compositor->output_list.prev,
+                                            struct weston_output, link);
+@@ -2707,8 +2707,8 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
+       if (disconnects) {
+               wl_list_for_each_safe(output, next, &b->compositor->output_list,
+                                     base.link) {
+-                      if (disconnects & (1 << output->connector_id)) {
+-                              disconnects &= ~(1 << output->connector_id);
++                      if (disconnects & (1ULL << output->connector_id)) {
++                              disconnects &= ~(1ULL << output->connector_id);
+                               weston_log("connector %d disconnected\n",
+                                      output->connector_id);
+                               drm_output_destroy(&output->base);
+-- 
+1.9.1
+
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-compositor-drm-support-RGB565-with-pixman-renderer.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-compositor-drm-support-RGB565-with-pixman-renderer.patch
new file mode 100644 (file)
index 0000000..0d77f52
--- /dev/null
@@ -0,0 +1,125 @@
+From 91b452fa515b94928d32af6e1b1b0405469747fd Mon Sep 17 00:00:00 2001
+From: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Date: Wed, 8 Mar 2017 13:05:38 -0500
+Subject: [PATCH] compositor-drm: support RGB565 with pixman renderer
+
+At the moment only XRGB8888 is supported when using pixman renderer.
+This patch adds support also for RGB565.
+
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Reviewed-by: Daniel Stone <daniels@collabora.com>
+Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
+Signed-off-by: Daniel Stone <daniels@collabora.com>
+---
+ src/compositor-drm.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 55 insertions(+), 7 deletions(-)
+
+diff --git a/src/compositor-drm.c b/src/compositor-drm.c
+index fd89627..443b69a 100644
+--- a/src/compositor-drm.c
++++ b/src/compositor-drm.c
+@@ -262,10 +262,12 @@ drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
+ }
+ static struct drm_fb *
+-drm_fb_create_dumb(struct drm_backend *b, unsigned width, unsigned height)
++drm_fb_create_dumb(struct drm_backend *b, unsigned width, unsigned height,
++                 uint32_t format)
+ {
+       struct drm_fb *fb;
+       int ret;
++      uint32_t bpp, depth;
+       struct drm_mode_create_dumb create_arg;
+       struct drm_mode_destroy_dumb destroy_arg;
+@@ -275,8 +277,20 @@ drm_fb_create_dumb(struct drm_backend *b, unsigned width, unsigned height)
+       if (!fb)
+               return NULL;
++      switch (format) {
++              case GBM_FORMAT_XRGB8888:
++                      bpp = 32;
++                      depth = 24;
++                      break;
++              case GBM_FORMAT_RGB565:
++                      bpp = depth = 16;
++                      break;
++              default:
++                      return NULL;
++      }
++
+       memset(&create_arg, 0, sizeof create_arg);
+-      create_arg.bpp = 32;
++      create_arg.bpp = bpp;
+       create_arg.width = width;
+       create_arg.height = height;
+@@ -289,8 +303,29 @@ drm_fb_create_dumb(struct drm_backend *b, unsigned width, unsigned height)
+       fb->size = create_arg.size;
+       fb->fd = b->drm.fd;
+-      ret = drmModeAddFB(b->drm.fd, width, height, 24, 32,
+-                         fb->stride, fb->handle, &fb->fb_id);
++      ret = -1;
++
++      if (!b->no_addfb2) {
++              uint32_t handles[4], pitches[4], offsets[4];
++
++              handles[0] = fb->handle;
++              pitches[0] = fb->stride;
++              offsets[0] = 0;
++
++              ret = drmModeAddFB2(b->drm.fd, width, height,
++                                  format, handles, pitches, offsets,
++                                  &fb->fb_id, 0);
++              if (ret) {
++                      weston_log("addfb2 failed: %m\n");
++                      b->no_addfb2 = 1;
++              }
++      }
++
++      if (ret) {
++              ret = drmModeAddFB(b->drm.fd, width, height, depth, bpp,
++                                 fb->stride, fb->handle, &fb->fb_id);
++      }
++
+       if (ret)
+               goto err_bo;
+@@ -1879,17 +1914,30 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
+ {
+       int w = output->base.current_mode->width;
+       int h = output->base.current_mode->height;
++      uint32_t format = output->gbm_format;
++      uint32_t pixman_format;
+       unsigned int i;
+-      /* FIXME error checking */
++      switch (format) {
++              case GBM_FORMAT_XRGB8888:
++                      pixman_format = PIXMAN_x8r8g8b8;
++                      break;
++              case GBM_FORMAT_RGB565:
++                      pixman_format = PIXMAN_r5g6b5;
++                      break;
++              default:
++                      weston_log("Unsupported pixman format 0x%x\n", format);
++                      return -1;
++      }
++      /* FIXME error checking */
+       for (i = 0; i < ARRAY_LENGTH(output->dumb); i++) {
+-              output->dumb[i] = drm_fb_create_dumb(b, w, h);
++              output->dumb[i] = drm_fb_create_dumb(b, w, h, format);
+               if (!output->dumb[i])
+                       goto err;
+               output->image[i] =
+-                      pixman_image_create_bits(PIXMAN_x8r8g8b8, w, h,
++                      pixman_image_create_bits(pixman_format, w, h,
+                                                output->dumb[i]->map,
+                                                output->dumb[i]->stride);
+               if (!output->image[i])
+-- 
+1.9.1
+
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-weston-Enabling-DRM-backend-with-multiple-displays.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-weston-Enabling-DRM-backend-with-multiple-displays.patch
new file mode 100644 (file)
index 0000000..2f215c9
--- /dev/null
@@ -0,0 +1,60 @@
+From b1829ce962aa4e13d737edb54130bdce05f068f0 Mon Sep 17 00:00:00 2001
+From: Karthik Ramanan <a0393906@ti.com>
+Date: Wed, 17 Dec 2014 09:21:49 +0530
+Subject: [PATCH] weston: Enabling DRM backend with multiple displays
+
+There are three main issues that this patch tries to address
+
+ 1. Black screen when running weston
+ 2. Support for multiple displays
+ 3. Handling missing VBlanks
+
+There is an issue with missing VBlanks for LCD and
+HDMI connectors which leads to display not getting refreshed.
+This patch can be considered as a workaround.
+
+Signed-off-by: Karthik Ramanan <a0393906@ti.com>
+---
+ src/compositor-drm.c |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/compositor-drm.c b/src/compositor-drm.c
+index e4496e7..3b22aa3 100644
+--- a/src/compositor-drm.c
++++ b/src/compositor-drm.c
+@@ -646,7 +646,7 @@ drm_output_repaint(struct weston_output *output_base,
+                       .request.sequence = 1,
+               };
+-              if ((!s->current && !s->next) ||
++              if ((!s->current && !s->next) &&
+                   !drm_sprite_crtc_supported(output_base, s->possible_crtcs))
+                       continue;
+@@ -757,6 +757,7 @@ page_flip_handler(int fd, unsigned int frame,
+ {
+       struct drm_output *output = (struct drm_output *) data;
+       uint32_t msecs;
++      uint32_t bail;
+       /* We don't set page_flip_pending on start_repaint_loop, in that case
+        * we just want to page flip to the current buffer to get an accurate
+@@ -769,9 +770,14 @@ page_flip_handler(int fd, unsigned int frame,
+       output->page_flip_pending = 0;
++      if(output->vblank_pending) {
++              weston_log("VBlank is pending for connector = %d, frame = %d\n", output->connector_id, frame);
++              bail = 1;
++      }
++
+       if (output->destroy_pending)
+               drm_output_destroy(&output->base);
+-      else if (!output->vblank_pending) {
++      else if (!output->vblank_pending || bail ) {
+               msecs = sec * 1000 + usec / 1000;
+               weston_output_finish_frame(&output->base, msecs);
+-- 
+1.7.9.5
+
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0002-Weston-Allow-visual_id-to-be-0.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0002-Weston-Allow-visual_id-to-be-0.patch
new file mode 100644 (file)
index 0000000..39c8401
--- /dev/null
@@ -0,0 +1,31 @@
+From 5b5de6a814b43ca023a92b85b407b3d061dbc64f Mon Sep 17 00:00:00 2001
+From: Eric Ruei <e-ruei1@ti.com>
+Date: Thu, 9 Mar 2017 14:32:24 -0500
+Subject: [PATCH 2/4] Weston: Allow visual_id to be 0
+
+The inquiry of visual id from egl API eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID)
+is an optional feature. The visual id will be set to 0 if this feature is
+not supported. Therefore, the return condition @function match_config_to_visual()
+should be (id == visual_id || id == 0) instead of (id == visual_id)
+
+Signed-off-by: Eric Ruei <e-ruei1@ti.com>
+---
+ src/gl-renderer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 23c0cd7..4c1f170 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -2462,7 +2462,7 @@ match_config_to_visual(EGLDisplay egl_display,
+                               &id))
+                       continue;
+-              if (id == visual_id)
++              if (id == visual_id || id == 0)
+                       return i;
+       }
+-- 
+1.9.1
+
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch
new file mode 100644 (file)
index 0000000..bdf5626
--- /dev/null
@@ -0,0 +1,39 @@
+From 0d15218ced5bf2e6f3d05758f0f5f21c2a0303f2 Mon Sep 17 00:00:00 2001
+From: Eric Ruei <e-ruei1@ti.com>
+Date: Thu, 9 Mar 2017 14:33:08 -0500
+Subject: [PATCH 3/4] Weston: Fix virtual keyboard display issue for QT5
+ application
+
+The virtual keyboard does pop up as expected, however, it will never hide
+even when the application is terminated. This problem is due to the order
+of the text APIs( text_input_activate and test_input_show_input_panel) are
+invoked in QT5 and a potential bug of the API implementation. The virtual
+keyboard works as expected if the test_input_show_input_panel() is invoked
+prior to the test_input_activate() as most of the weston sample applications
+do. However, the problem will show up if that order is reversed and the reason
+why is that the current_panel is not set in this case and hence this panel
+cannot be hidden.
+
+It is required to set the current_panel to the text_input when the input_panel
+becomes visible at the first time.
+
+Signed-off-by: Eric Ruei <e-ruei1@ti.com>
+---
+ src/text-backend.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/text-backend.c b/src/text-backend.c
+index ab4667f..36c70a5 100644
+--- a/src/text-backend.c
++++ b/src/text-backend.c
+@@ -337,6 +337,7 @@ text_input_show_input_panel(struct wl_client *client,
+                              text_input->surface);
+               wl_signal_emit(&ec->update_input_panel_signal,
+                              &text_input->cursor_rectangle);
++              text_input->manager->current_panel = text_input;
+       }
+ }
+-- 
+1.9.1
+
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0004-Weston-Fix-touch-screen-crash-issue.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0004-Weston-Fix-touch-screen-crash-issue.patch
new file mode 100644 (file)
index 0000000..673ca3d
--- /dev/null
@@ -0,0 +1,36 @@
+From 8958bf21960a475d2933e688d0da9a0d2186d509 Mon Sep 17 00:00:00 2001
+From: Eric Ruei <e-ruei1@ti.com>
+Date: Thu, 9 Mar 2017 14:34:18 -0500
+Subject: [PATCH 4/4] Weston: Fix touch screen crash issue
+
+Touch screen operation causes the weston to crash with segment fault sometimes.
+The crash occurs when the coordinate (x,y) passed to the weston input module
+is outside the view window, hence the weston compositor is not able to pick
+up a display view and there is no code to detect this condition at function
+notify_touch().
+
+Signed-off-by: Eric Ruei <e-ruei1@ti.com>
+---
+ src/input.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/input.c b/src/input.c
+index 8fe898c..0f72d23 100644
+--- a/src/input.c
++++ b/src/input.c
+@@ -1848,6 +1848,12 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
+                * until all touch points are up again. */
+               if (touch->num_tp == 1) {
+                       ev = weston_compositor_pick_view(ec, x, y, &sx, &sy);
++                      if (!ev)
++                      {
++                              weston_log("notify_touch: weston_compositor_pick_view(%d, %d) failed to find a view!\n",
++                                                      wl_fixed_to_int(x), wl_fixed_to_int(y));
++                              return;
++                      }
+                       weston_touch_set_focus(touch, ev);
+               } else if (!touch->focus) {
+                       /* Unexpected condition: We have non-initial touch but
+-- 
+1.9.1
+
index 1ceba7f..5f22fcc 100644 (file)
@@ -1,17 +1,22 @@
-#inherit append-code-change
 # When configured for fbdev compositor, make it the default
 PACKAGECONFIG[fbdev] = "--enable-fbdev-compositor WESTON_NATIVE_BACKEND="fbdev-backend.so",--disable-fbdev-compositor,udev mtdev"
 PACKAGECONFIG[kms] = "--enable-drm-compositor,--disable-drm-compositor,drm udev libgbm mtdev"
 
-PR_append = ".agl_arago_16"
+PR_append = ".agl_arago22"
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
 RDEPENDS_${PN} += "weston-conf"
 
+
 SRC_URI += " \
        file://0001-udev-seat-restrict-udev-enumeration-to-card0.patch \
        file://0001-Add-soc-performance-monitor-utilites.patch \
+       file://0002-Weston-Allow-visual_id-to-be-0.patch \
+       file://0003-Weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch \
+       file://0004-Weston-Fix-touch-screen-crash-issue.patch \
+       file://0001-compositor-drm-fix-hotplug-weston-termination-proble.patch \
+       file://0001-compositor-drm-support-RGB565-with-pixman-renderer.patch \
 "
 
 RDEPENDS_${PN}_remove = "weston-conf"