|
37 | 37 | #include <presentation-time-client-protocol.h>
|
38 | 38 | #include <viewporter-client-protocol.h>
|
39 | 39 | #include <gralloc_handle.h>
|
| 40 | +#include <cros_gralloc/cros_gralloc_handle.h> |
40 | 41 |
|
41 | 42 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS
|
42 | 43 | #include <cutils/trace.h>
|
@@ -179,11 +180,19 @@ static struct buffer *get_wl_buffer(struct waydroid_hwc_composer_device_1 *pdev,
|
179 | 180 | if (pdev->display->gtype == GRALLOC_GBM) {
|
180 | 181 | struct gralloc_handle_t *drm_handle = (struct gralloc_handle_t *)layer->handle;
|
181 | 182 | if (pdev->display->dmabuf) {
|
182 |
| - ret = create_dmabuf_wl_buffer(pdev->display, buf, drm_handle->width, drm_handle->height, drm_handle->format, drm_handle->prime_fd, drm_handle->stride, drm_handle->modifier); |
| 183 | + ret = create_dmabuf_wl_buffer(pdev->display, buf, drm_handle->width, drm_handle->height, drm_handle->format, drm_handle->prime_fd, drm_handle->stride, 0 /* offset */, drm_handle->modifier, false /* format_is_drm */); |
183 | 184 | } else {
|
184 | 185 | ret = create_shm_wl_buffer(pdev->display, buf, drm_handle->width, drm_handle->height, drm_handle->format, drm_handle->stride, layer->handle);
|
185 | 186 | update_shm_buffer(pdev->display, buf);
|
186 | 187 | }
|
| 188 | + } else if (pdev->display->gtype == GRALLOC_CROS) { |
| 189 | + const struct cros_gralloc_handle *cros_handle = (const struct cros_gralloc_handle *)layer->handle; |
| 190 | + if (pdev->display->dmabuf) { |
| 191 | + ret = create_dmabuf_wl_buffer(pdev->display, buf, cros_handle->width, cros_handle->height, cros_handle->format, cros_handle->fds[0], cros_handle->strides[0], cros_handle->offsets[0], cros_handle->format_modifier, true /* format_is_drm */); |
| 192 | + } else { |
| 193 | + ret = create_shm_wl_buffer(pdev->display, buf, cros_handle->width, cros_handle->height, cros_handle->droid_format, cros_handle->strides[0], layer->handle); |
| 194 | + update_shm_buffer(pdev->display, buf); |
| 195 | + } |
187 | 196 | } else {
|
188 | 197 | // TODO: use the actual buffer size
|
189 | 198 | uint32_t format;
|
@@ -249,7 +258,7 @@ static struct wl_surface *get_surface(struct waydroid_hwc_composer_device_1 *pde
|
249 | 258 |
|
250 | 259 | if (pdev->display->viewporter) {
|
251 | 260 | // can't correctly crop on other gralloc implementations yet
|
252 |
| - if (pdev->display->gtype == GRALLOC_GBM) { |
| 261 | + if (pdev->display->gtype == GRALLOC_GBM || pdev->display->gtype == GRALLOC_CROS) { |
253 | 262 | wp_viewport_set_source(window->viewports[window->lastLayer],
|
254 | 263 | wl_fixed_from_double(fmax(0, sourceCrop.left / (double)pdev->display->scale)),
|
255 | 264 | wl_fixed_from_double(fmax(0, sourceCrop.top / (double)pdev->display->scale)),
|
|
0 commit comments