mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-08 13:29:47 -05:00
Create front buffer with eagle.
This removes the intel dependencies from the system compositor.
This commit is contained in:
parent
820a877428
commit
b22382bfdc
2 changed files with 25 additions and 39 deletions
4
gears.c
4
gears.c
|
|
@ -315,9 +315,9 @@ handle_frame(void *data,
|
||||||
uint32_t frame, uint32_t timestamp)
|
uint32_t frame, uint32_t timestamp)
|
||||||
{
|
{
|
||||||
struct gears *gears = data;
|
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);
|
window_copy(gears->window, &gears->rectangle, name, stride);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <i915_drm.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -69,7 +68,7 @@ struct wlsc_output {
|
||||||
struct wlsc_compositor *compositor;
|
struct wlsc_compositor *compositor;
|
||||||
struct wlsc_surface *background;
|
struct wlsc_surface *background;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
int32_t x, y, width, height, stride;
|
int32_t x, y, width, height;
|
||||||
|
|
||||||
drmModeModeInfo *mode;
|
drmModeModeInfo *mode;
|
||||||
uint32_t fb_id;
|
uint32_t fb_id;
|
||||||
|
|
@ -170,7 +169,6 @@ static const GOptionEntry option_entries[] = {
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct screenshooter {
|
struct screenshooter {
|
||||||
struct wl_object base;
|
struct wl_object base;
|
||||||
struct wlsc_compositor *ec;
|
struct wlsc_compositor *ec;
|
||||||
|
|
@ -1231,9 +1229,8 @@ create_output(struct wlsc_compositor *ec, struct udev_device *device)
|
||||||
drmModeRes *resources;
|
drmModeRes *resources;
|
||||||
drmModeEncoder *encoder;
|
drmModeEncoder *encoder;
|
||||||
drmModeModeInfo *mode;
|
drmModeModeInfo *mode;
|
||||||
struct drm_i915_gem_create create;
|
|
||||||
struct drm_gem_flink flink;
|
|
||||||
struct wlsc_output *output;
|
struct wlsc_output *output;
|
||||||
|
uint32_t name, handle, stride;
|
||||||
int i, ret, fd;
|
int i, ret, fd;
|
||||||
|
|
||||||
if (ec->display == NULL && init_egl(ec, device) < 0) {
|
if (ec->display == NULL && init_egl(ec, device) < 0) {
|
||||||
|
|
@ -1283,15 +1280,30 @@ create_output(struct wlsc_compositor *ec, struct udev_device *device)
|
||||||
drmModeFreeEncoder(encoder);
|
drmModeFreeEncoder(encoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mode size at 32 bpp */
|
output->compositor = ec;
|
||||||
create.size = mode->hdisplay * mode->vdisplay * 4;
|
output->crtc_id = encoder->crtc_id;
|
||||||
if (ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) != 0) {
|
output->connector_id = connector->connector_id;
|
||||||
fprintf(stderr, "gem create failed: %m\n");
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drmModeAddFB(fd, mode->hdisplay, mode->vdisplay,
|
eglGetNativeBuffer(output->surface,
|
||||||
32, 32, mode->hdisplay * 4, create.handle, &output->fb_id);
|
GL_FRONT_LEFT, &name, &handle, &stride);
|
||||||
|
ret = drmModeAddFB(fd, output->width, output->height,
|
||||||
|
32, 32, stride, handle, &output->fb_id);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf(stderr, "failed to add fb: %m\n");
|
fprintf(stderr, "failed to add fb: %m\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -1304,32 +1316,6 @@ create_output(struct wlsc_compositor *ec, struct udev_device *device)
|
||||||
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;
|
output->base.interface = &wl_output_interface;
|
||||||
wl_display_add_object(ec->wl_display, &output->base);
|
wl_display_add_object(ec->wl_display, &output->base);
|
||||||
wl_display_add_global(ec->wl_display, &output->base, post_output_geometry);
|
wl_display_add_global(ec->wl_display, &output->base, post_output_geometry);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue