static boolean wayland_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, int *width, int *height) { struct wayland_surface *surface = wayland_surface(nsurf); if (surface->type == WL_WINDOW_SURFACE) wayland_window_surface_handle_resize(surface); if (!resource_surface_add_resources(surface->rsurf, attachment_mask | surface->attachment_mask)) return FALSE; if (textures) resource_surface_get_resources(surface->rsurf, textures, attachment_mask); if (seq_num) *seq_num = surface->sequence_number; resource_surface_get_size(surface->rsurf, (uint *) width, (uint *) height); if (surface->type == WL_PIXMAP_SURFACE) wayland_pixmap_surface_initialize(surface); return TRUE; }
/** * Add textures as DRM framebuffers. */ static boolean drm_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) { struct drm_surface *drmsurf = drm_surface(nsurf); struct drm_display *drmdpy = drmsurf->drmdpy; int num_framebuffers = (need_back) ? 2 : 1; int i, err; for (i = 0; i < num_framebuffers; i++) { struct drm_framebuffer *fb; enum native_attachment natt; struct winsys_handle whandle; uint block_bits; if (i == 0) { fb = &drmsurf->front_fb; natt = NATIVE_ATTACHMENT_FRONT_LEFT; } else { fb = &drmsurf->back_fb; natt = NATIVE_ATTACHMENT_BACK_LEFT; } if (!fb->texture) { /* make sure the texture has been allocated */ resource_surface_add_resources(drmsurf->rsurf, 1 << natt); fb->texture = resource_surface_get_single_resource(drmsurf->rsurf, natt); if (!fb->texture) return FALSE; } /* already initialized */ if (fb->buffer_id) continue; /* TODO detect the real value */ fb->is_passive = TRUE; memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_KMS; if (!drmdpy->base.screen->resource_get_handle(drmdpy->base.screen, fb->texture, &whandle)) return FALSE; block_bits = util_format_get_blocksizebits(drmsurf->color_format); err = drmModeAddFB(drmdpy->fd, drmsurf->width, drmsurf->height, block_bits, block_bits, whandle.stride, whandle.handle, &fb->buffer_id); if (err) { fb->buffer_id = 0; return FALSE; } } return TRUE; }
/** * Update the buffers of the surface. */ static boolean ximage_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask) { struct ximage_surface *xsurf = ximage_surface(nsurf); if (xsurf->client_stamp != xsurf->server_stamp) { ximage_surface_update_geometry(&xsurf->base); xsurf->client_stamp = xsurf->server_stamp; } return resource_surface_add_resources(xsurf->rsurf, buffer_mask); }
/** * Update the buffers of the surface. */ static boolean gdi_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask) { struct gdi_surface *gsurf = gdi_surface(nsurf); if (gsurf->client_stamp != gsurf->server_stamp) { gdi_surface_update_geometry(&gsurf->base); gsurf->client_stamp = gsurf->server_stamp; } return resource_surface_add_resources(gsurf->rsurf, buffer_mask); }
static boolean psl1ght_display_program(struct native_display *ndpy, int crtc_idx, struct native_surface *nsurf, uint x, uint y, const struct native_connector **nconns, int num_nconns, const struct native_mode *nmode) { struct psl1ght_display *psdpy = psl1ght_display(ndpy); struct psl1ght_surface *pssurf = psl1ght_surface(nsurf); struct psl1ght_mode *psmode = psl1ght_mode(nmode); if (x || y) return FALSE; if (pssurf) { const videoDisplayMode *vmode = psmode->vmode; videoConfiguration config; int i; if(!resource_surface_add_resources(pssurf->rsurf, (1 << NATIVE_ATTACHMENT_FRONT_LEFT) | (1 << NATIVE_ATTACHMENT_BACK_LEFT))) return FALSE; memset(&config, 0, sizeof(config)); config.resolution = vmode->resolution; config.format = pssurf->format; config.aspect = vmode->aspect; config.pitch = pssurf->width * 4; /* FIXME: scan mode & refresh rate? */ for(i=0; i<num_nconns; i++) { u32 videoOut = psl1ght_connector(nconns[i])->videoOut; if (videoConfigure(videoOut, &config, NULL, 1)) return FALSE; } } if (psdpy->current_surface) { if (psdpy->current_surface == pssurf) return TRUE; /*...*/ psdpy->current_surface->is_current = FALSE; psdpy->current_surface = NULL; } if (pssurf) { /*...*/ pssurf->is_current = TRUE; } psdpy->current_surface = pssurf; return TRUE; }
static boolean fbdev_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, int *width, int *height) { struct fbdev_surface *fbsurf = fbdev_surface(nsurf); if (!resource_surface_add_resources(fbsurf->rsurf, attachment_mask)) return FALSE; if (textures) resource_surface_get_resources(fbsurf->rsurf, textures, attachment_mask); if (seq_num) *seq_num = fbsurf->sequence_number; if (width) *width = fbsurf->width; if (height) *height = fbsurf->height; return TRUE; }