static cairo_surface_t * gallium_surface_create_internal (gallium_device_t *device, enum pipe_format pipe_format, int width, int height) { gallium_surface_t *surface; struct pipe_resource template; cairo_status_t status; cairo_format_t format; int stride, size; surface = malloc (sizeof (gallium_surface_t)); if (unlikely (surface == NULL)) return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); format = _cairo_format_from_pipe_format (pipe_format); _cairo_surface_init (&surface->drm.base, &gallium_surface_backend, &device->drm.base, _cairo_content_from_format (format)); _cairo_drm_surface_init (&surface->drm, format, width, height); stride = gallium_format_stride_for_width (pipe_format, width); size = stride * height; surface->drm.stride = stride; surface->drm.bo = _gallium_fake_bo_create (size, 0); memset(&template, 0, sizeof(template));
static void radeon_surface_init (radeon_surface_t *surface, cairo_drm_device_t *device, cairo_format_t format, int width, int height) { _cairo_surface_init (&surface->base.base, &radeon_surface_backend, &device->base, _cairo_content_from_format (format)); _cairo_drm_surface_init (&surface->base, format, width, height); }
void intel_surface_init (intel_surface_t *surface, const cairo_surface_backend_t *backend, cairo_drm_device_t *device, cairo_format_t format, int width, int height) { _cairo_surface_init (&surface->drm.base, backend, &device->base, _cairo_content_from_format (format)); _cairo_drm_surface_init (&surface->drm, format, width, height); surface->snapshot_cache_entry.hash = 0; }