diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 4c97c045354..1ef528f21e5 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -275,101 +275,6 @@ dri_image_drawable_get_buffers(struct dri_drawable *drawable, images); } -static __DRIbuffer * -dri2_allocate_buffer(struct dri_screen *screen, - unsigned attachment, unsigned format, - int width, int height) -{ - struct dri2_buffer *buffer; - struct pipe_resource templ; - enum pipe_format pf; - unsigned bind = 0; - struct winsys_handle whandle; - - /* struct pipe_resource height0 is 16-bit, avoid overflow */ - if (height > 0xffff) - return NULL; - - switch (attachment) { - case __DRI_BUFFER_FRONT_LEFT: - case __DRI_BUFFER_FAKE_FRONT_LEFT: - bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; - break; - case __DRI_BUFFER_BACK_LEFT: - bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; - break; - case __DRI_BUFFER_DEPTH: - case __DRI_BUFFER_DEPTH_STENCIL: - case __DRI_BUFFER_STENCIL: - bind = PIPE_BIND_DEPTH_STENCIL; /* XXX sampler? */ - break; - } - - /* because we get the handle and stride */ - bind |= PIPE_BIND_SHARED; - - switch (format) { - case 64: - pf = PIPE_FORMAT_R16G16B16A16_FLOAT; - break; - case 48: - pf = PIPE_FORMAT_R16G16B16X16_FLOAT; - break; - case 32: - pf = PIPE_FORMAT_BGRA8888_UNORM; - break; - case 30: - pf = PIPE_FORMAT_B10G10R10X2_UNORM; - break; - case 24: - pf = PIPE_FORMAT_BGRX8888_UNORM; - break; - case 16: - pf = PIPE_FORMAT_Z16_UNORM; - break; - default: - return NULL; - } - - buffer = CALLOC_STRUCT(dri2_buffer); - if (!buffer) - return NULL; - - memset(&templ, 0, sizeof(templ)); - templ.bind = bind; - templ.format = pf; - templ.target = PIPE_TEXTURE_2D; - templ.last_level = 0; - templ.width0 = width; - templ.height0 = height; - templ.depth0 = 1; - templ.array_size = 1; - - buffer->resource = - screen->base.screen->resource_create(screen->base.screen, &templ); - if (!buffer->resource) { - FREE(buffer); - return NULL; - } - - memset(&whandle, 0, sizeof(whandle)); - if (screen->can_share_buffer) - whandle.type = WINSYS_HANDLE_TYPE_SHARED; - else - whandle.type = WINSYS_HANDLE_TYPE_KMS; - - screen->base.screen->resource_get_handle(screen->base.screen, NULL, - buffer->resource, &whandle, - PIPE_HANDLE_USAGE_EXPLICIT_FLUSH); - - buffer->base.attachment = attachment; - buffer->base.name = whandle.handle; - buffer->base.cpp = util_format_get_blocksize(pf); - buffer->base.pitch = whandle.stride; - - return &buffer->base; -} - static void dri2_release_buffer(__DRIbuffer *bPriv) {