uint32_t frame, uint32_t timestamp)
{
struct gears *gears = data;
- uint32_t name, stride;
+ uint32_t name, handle, stride;
- eglGetNativeBuffer(gears->surface, GL_FRONT_LEFT, &name, &stride);
+ eglGetNativeBuffer(gears->surface, GL_FRONT_LEFT, &name, &handle, &stride);
window_copy(gears->window, &gears->rectangle, name, stride);
#include <stdint.h>
#include <stdarg.h>
#include <termios.h>
-#include <i915_drm.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
struct wlsc_compositor *compositor;
struct wlsc_surface *background;
EGLSurface surface;
- int32_t x, y, width, height, stride;
+ int32_t x, y, width, height;
drmModeModeInfo *mode;
uint32_t fb_id;
{ NULL }
};
-
struct screenshooter {
struct wl_object base;
struct wlsc_compositor *ec;
drmModeRes *resources;
drmModeEncoder *encoder;
drmModeModeInfo *mode;
- struct drm_i915_gem_create create;
- struct drm_gem_flink flink;
struct wlsc_output *output;
+ uint32_t name, handle, stride;
int i, ret, fd;
if (ec->display == NULL && init_egl(ec, device) < 0) {
drmModeFreeEncoder(encoder);
}
- /* Mode size at 32 bpp */
- create.size = mode->hdisplay * mode->vdisplay * 4;
- if (ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) != 0) {
- fprintf(stderr, "gem create failed: %m\n");
+ output->compositor = ec;
+ output->crtc_id = encoder->crtc_id;
+ output->connector_id = connector->connector_id;
+ output->mode = mode;
+ output->x = 0;
+ output->y = 0;
+ output->width = mode->hdisplay;
+ output->height = mode->vdisplay;
+
+ output->surface = eglCreateSurfaceForName(ec->display,
+ ec->config,
+ 0,
+ output->width,
+ output->height,
+ 0, surface_attribs);
+ if (output->surface == NULL) {
+ fprintf(stderr, "failed to create surface\n");
return -1;
}
- ret = drmModeAddFB(fd, mode->hdisplay, mode->vdisplay,
- 32, 32, mode->hdisplay * 4, create.handle, &output->fb_id);
+ eglGetNativeBuffer(output->surface,
+ GL_FRONT_LEFT, &name, &handle, &stride);
+ ret = drmModeAddFB(fd, output->width, output->height,
+ 32, 32, stride, handle, &output->fb_id);
if (ret) {
fprintf(stderr, "failed to add fb: %m\n");
return -1;
return -1;
}
- flink.handle = create.handle;
- if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) != 0) {
- fprintf(stderr, "gem flink failed: %m\n");
- return -1;
- }
-
- output->compositor = ec;
- output->crtc_id = encoder->crtc_id;
- output->connector_id = connector->connector_id;
- output->mode = mode;
- output->x = 0;
- output->y = 0;
- output->width = mode->hdisplay;
- output->height = mode->vdisplay;
- output->stride = mode->hdisplay * 4;
-
- output->surface = eglCreateSurfaceForName(ec->display, ec->config,
- flink.name,
- output->width, output->height,
- output->stride,
- surface_attribs);
- if (output->surface == NULL) {
- fprintf(stderr, "failed to create surface\n");
- return -1;
- }
-
output->base.interface = &wl_output_interface;
wl_display_add_object(ec->wl_display, &output->base);
wl_display_add_global(ec->wl_display, &output->base, post_output_geometry);