+ if (templat->bind & PIPE_BIND_SCANOUT) {
+ struct pipe_resource scanout_templat = *templat;
+ struct renderonly_scanout *scanout;
+ struct winsys_handle 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);
+
+ scanout = renderonly_scanout_for_resource(&scanout_templat,
+ screen->ro, &handle);
+ if (!scanout)
+ return NULL;
+
+ assert(handle.type == DRM_API_HANDLE_TYPE_FD);
+ rsc = etna_resource(pscreen->resource_from_handle(pscreen, templat,
+ &handle,
+ PIPE_HANDLE_USAGE_WRITE));
+ close(handle.handle);
+ if (!rsc)
+ return NULL;
+
+ rsc->scanout = scanout;
+
+ return &rsc->base;
+ }