etnaviv: pad scanout buffer size to RS alignment
authorLucas Stach <l.stach@pengutronix.de>
Fri, 9 Jun 2017 16:44:46 +0000 (18:44 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Wed, 19 Jul 2017 14:26:49 +0000 (16:26 +0200)
This fixes failures to import the scanout buffer with screen resolutions
that don't satisfy the RS alignment restrictions, like 1680x1050.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_resource.c

index 1cd906d4afa5dd08232bc007d065f7a7ff79cc36..8e39461ec67cfd1c32a2cdd71e5996ad5e0d570c 100644 (file)
@@ -212,9 +212,15 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
    rsc->ts_bo = 0; /* TS is only created when first bound to surface */
 
    if (templat->bind & PIPE_BIND_SCANOUT) {
+      struct pipe_resource scanout_templat = *templat;
       struct winsys_handle handle;
-      rsc->scanout = renderonly_scanout_for_resource(&rsc->base, screen->ro,
-                                                     &handle);
+
+      /* pad scanout buffer size to be compatible with the RS */
+      etna_adjust_rs_align(screen->specs.pixel_pipes,
+                           &scanout_templat.width0, &scanout_templat.height0);
+
+      rsc->scanout = renderonly_scanout_for_resource(&scanout_templat,
+                                                     screen->ro, &handle);
       if (!rsc->scanout)
          goto free_rsc;