static void
dri1_present_texture_locked(__DRIdrawable * dPriv,
- struct pipe_texture *ptex,
+ struct pipe_resource *ptex,
const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence)
{
static void
dri1_copy_to_front(struct dri_context *ctx,
- struct pipe_texture *ptex,
+ struct pipe_resource *ptex,
__DRIdrawable * dPriv,
const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence)
struct dri_screen *screen = dri_screen(draw->sPriv);
struct pipe_screen *pipe_screen = screen->pipe_screen;
struct pipe_fence_handle *dummy_fence;
- struct pipe_texture *ptex;
+ struct pipe_resource *ptex;
if (!ctx)
return; /* For now */
struct dri_screen *screen = dri_screen(draw->sPriv);
struct pipe_screen *pipe_screen = screen->pipe_screen;
struct pipe_fence_handle *fence;
- struct pipe_texture *ptex;
+ struct pipe_resource *ptex;
assert(__dri1_api_hooks != NULL);
struct drm_clip_rect sub_bbox;
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_fence_handle *dummy_fence;
- struct pipe_texture *ptex;
+ struct pipe_resource *ptex;
assert(__dri1_api_hooks != NULL);
unsigned mask)
{
struct dri_screen *screen = dri_screen(drawable->sPriv);
- struct pipe_texture templ;
+ struct pipe_resource templ;
unsigned width, height;
boolean resized;
int i;
/* remove outdated textures */
if (resized) {
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
- pipe_texture_reference(&drawable->textures[i], NULL);
+ pipe_resource_reference(&drawable->textures[i], NULL);
}
memset(&templ, 0, sizeof(templ));
case ST_ATTACHMENT_FRONT_RIGHT:
case ST_ATTACHMENT_BACK_RIGHT:
format = drawable->stvis.color_format;
- tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ tex_usage = PIPE_BIND_DISPLAY_TARGET |
+ PIPE_BIND_RENDER_TARGET;
break;
case ST_ATTACHMENT_DEPTH_STENCIL:
format = drawable->stvis.depth_stencil_format;
- tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
+ tex_usage = PIPE_BIND_DEPTH_STENCIL;
break;
default:
format = PIPE_FORMAT_NONE;
if (format != PIPE_FORMAT_NONE) {
templ.format = format;
- templ.tex_usage = tex_usage;
+ templ.bind = tex_usage;
drawable->textures[i] =
- screen->pipe_screen->texture_create(screen->pipe_screen, &templ);
+ screen->pipe_screen->resource_create(screen->pipe_screen, &templ);
}
}
drawable->old_h = height;
}
+/*
+ * Backend function for init_screen.
+ */
+
+static const __DRIextension *dri1_screen_extensions[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ NULL
+};
+
static void
st_dri_lock(struct pipe_context *pipe)
{
.clear_lost_lock = st_dri_clear_lost_lock
};
-/*
- * Backend function for init_screen.
- */
-
-static const __DRIextension *dri1_screen_extensions[] = {
- &driReadDrawableExtension,
- &driCopySubBufferExtension.base,
- &driSwapControlExtension.base,
- &driFrameTrackingExtension.base,
- &driMediaStreamCounterExtension.base,
- NULL
-};
-
-struct dri1_api *__dri1_api_hooks = NULL;
-
static INLINE void
dri1_copy_version(struct dri1_api_version *dst,
const struct __DRIversionRec *src)
dst->patch_level = src->patch;
}
+struct dri1_api *__dri1_api_hooks = NULL;
+
const __DRIconfig **
dri1_init_screen(__DRIscreen * sPriv)
{
- struct dri_screen *screen;
const __DRIconfig **configs;
+ struct dri_screen *screen;
struct dri1_create_screen_arg arg;
screen = CALLOC_STRUCT(dri_screen);
dri1_copy_version(&arg.drm_version, &sPriv->drm_version);
arg.api = NULL;
- screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg.base);
-
- if (!screen->pipe_screen || !arg.api) {
- debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
- goto out_no_screen;
- }
-
- __dri1_api_hooks = arg.api;
-
- driParseOptionInfo(&screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
/**
* FIXME: If the driver supports format conversion swapbuffer blits, we might
* want to support other color bit depths than the server is currently
* using.
*/
- configs = dri_fill_in_modes(screen, sPriv->fbBPP);
+ configs = dri_init_screen_helper(screen, &arg.base, sPriv->fbBPP);
if (!configs)
- goto out_no_configs;
+ goto fail;
+
+ if (!arg.api) {
+ debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
+ goto fail;
+ }
+
+ __dri1_api_hooks = arg.api;
return configs;
- out_no_configs:
- screen->pipe_screen->destroy(screen->pipe_screen);
- out_no_screen:
+fail:
+ if (configs)
+ FREE(configs);
+ dri_destroy_screen_helper(screen);
FREE(screen);
return NULL;
}