Commit e447aeff authored by Keith Whitwell's avatar Keith Whitwell

st/egl: update for pipe_resources

parent e4cc48da
......@@ -656,7 +656,7 @@ destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
if (!dpy->Initialized)
_eglLog(_EGL_FATAL, "destroy a surface with an unitialized display");
pipe_texture_reference(&gsurf->render_texture, NULL);
pipe_resource_reference(&gsurf->render_texture, NULL);
egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
gsurf->native->destroy(gsurf->native);
free(gsurf);
......@@ -777,7 +777,7 @@ static struct pipe_surface *
get_pipe_surface(struct native_display *ndpy, struct native_surface *nsurf,
enum native_attachment natt)
{
struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
struct pipe_surface *psurf;
textures[natt] = NULL;
......@@ -787,7 +787,7 @@ get_pipe_surface(struct native_display *ndpy, struct native_surface *nsurf,
psurf = ndpy->screen->get_tex_surface(ndpy->screen, textures[natt],
0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
pipe_texture_reference(&textures[natt], NULL);
pipe_resource_reference(&textures[natt], NULL);
return psurf;
}
......
......@@ -71,7 +71,7 @@ struct egl_g3d_surface {
struct st_framebuffer_iface *stfbi;
struct native_surface *native;
struct pipe_texture *render_texture;
struct pipe_resource *render_texture;
unsigned int sequence_number;
};
......@@ -83,7 +83,7 @@ struct egl_g3d_config {
struct egl_g3d_image {
_EGLImage base;
struct pipe_texture *texture;
struct pipe_resource *texture;
unsigned face;
unsigned level;
unsigned zslice;
......
......@@ -40,13 +40,13 @@
/**
* Reference and return the front left buffer of the native pixmap.
*/
static struct pipe_texture *
static struct pipe_resource *
egl_g3d_reference_native_pixmap(_EGLDisplay *dpy, EGLNativePixmapType pix)
{
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_config *gconf;
struct native_surface *nsurf;
struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
enum native_attachment natt;
gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, pix));
......@@ -72,7 +72,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer,
const EGLint *attribs)
{
struct pipe_texture *ptex;
struct pipe_resource *ptex;
struct egl_g3d_image *gimg;
unsigned face = 0, level = 0, zslice = 0;
......@@ -104,13 +104,13 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
if (level > ptex->last_level) {
_eglError(EGL_BAD_MATCH, "eglCreateEGLImageKHR");
pipe_texture_reference(&gimg->texture, NULL);
pipe_resource_reference(&gimg->texture, NULL);
free(gimg);
return NULL;
}
if (zslice > ptex->depth0) {
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
pipe_texture_reference(&gimg->texture, NULL);
pipe_resource_reference(&gimg->texture, NULL);
free(gimg);
return NULL;
}
......@@ -129,7 +129,7 @@ egl_g3d_destroy_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img)
{
struct egl_g3d_image *gimg = egl_g3d_image(img);
pipe_texture_reference(&gimg->texture, NULL);
pipe_resource_reference(&gimg->texture, NULL);
free(gimg);
return EGL_TRUE;
......
......@@ -122,11 +122,11 @@ static boolean
egl_g3d_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_texture **out)
struct pipe_resource **out)
{
_EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private;
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
uint attachment_mask = 0;
unsigned i;
......@@ -160,7 +160,7 @@ egl_g3d_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
return FALSE;
for (i = 0; i < count; i++) {
struct pipe_texture *tex;
struct pipe_resource *tex;
int natt;
switch (statts[i]) {
......@@ -185,7 +185,7 @@ egl_g3d_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
tex = textures[natt];
if (statts[i] == stfbi->visual->render_buffer)
pipe_texture_reference(&gsurf->render_texture, tex);
pipe_resource_reference(&gsurf->render_texture, tex);
if (attachment_mask & (1 << natt)) {
/* transfer the ownership to the caller */
......@@ -194,7 +194,7 @@ egl_g3d_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
}
else {
/* the attachment is listed more than once */
pipe_texture_reference(&out[i], tex);
pipe_resource_reference(&out[i], tex);
}
}
}
......
......@@ -112,7 +112,7 @@ struct native_surface {
* behavior might change in the future.
*/
boolean (*validate)(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_texture **textures,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height);
/**
......
......@@ -36,13 +36,13 @@
static boolean
kms_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_texture **textures,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
{
struct kms_surface *ksurf = kms_surface(nsurf);
struct kms_display *kdpy = ksurf->kdpy;
struct pipe_screen *screen = kdpy->base.screen;
struct pipe_texture templ, *ptex;
struct pipe_resource templ, *ptex;
int att;
if (attachment_mask) {
......@@ -66,13 +66,13 @@ kms_surface_validate(struct native_surface *nsurf, uint attachment_mask,
ptex = ksurf->textures[att];
if (!ptex) {
ptex = screen->texture_create(screen, &templ);
ptex = screen->resource_create(screen, &templ);
ksurf->textures[att] = ptex;
}
if (textures) {
textures[att] = NULL;
pipe_texture_reference(&textures[att], ptex);
pipe_resource_reference(&textures[att], ptex);
}
}
......@@ -118,7 +118,7 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
if (!ksurf->textures[natt])
return FALSE;
pipe_texture_reference(&fb->texture, ksurf->textures[natt]);
pipe_resource_reference(&fb->texture, ksurf->textures[natt]);
}
/* already initialized */
......@@ -131,7 +131,7 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_KMS;
if (!kdpy->base.screen->texture_get_handle(kdpy->base.screen,
if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen,
fb->texture, &whandle))
return FALSE;
......@@ -173,7 +173,7 @@ kms_surface_swap_buffers(struct native_surface *nsurf)
struct kms_crtc *kcrtc = &ksurf->current_crtc;
struct kms_display *kdpy = ksurf->kdpy;
struct kms_framebuffer tmp_fb;
struct pipe_texture *tmp_texture;
struct pipe_resource *tmp_texture;
int err;
/* pbuffer is private */
......@@ -228,15 +228,15 @@ kms_surface_destroy(struct native_surface *nsurf)
if (ksurf->front_fb.buffer_id)
drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id);
pipe_texture_reference(&ksurf->front_fb.texture, NULL);
pipe_resource_reference(&ksurf->front_fb.texture, NULL);
if (ksurf->back_fb.buffer_id)
drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id);
pipe_texture_reference(&ksurf->back_fb.texture, NULL);
pipe_resource_reference(&ksurf->back_fb.texture, NULL);
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
struct pipe_texture *ptex = ksurf->textures[i];
pipe_texture_reference(&ptex, NULL);
struct pipe_resource *ptex = ksurf->textures[i];
pipe_resource_reference(&ptex, NULL);
}
free(ksurf);
......
......@@ -69,7 +69,7 @@ struct kms_display {
};
struct kms_framebuffer {
struct pipe_texture *texture;
struct pipe_resource *texture;
boolean is_passive;
uint32_t buffer_id;
......@@ -82,7 +82,7 @@ struct kms_surface {
struct kms_display *kdpy;
int width, height;
struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
unsigned int sequence_number;
struct kms_framebuffer front_fb, back_fb;
......
......@@ -72,7 +72,7 @@ struct dri2_surface {
unsigned int server_stamp;
unsigned int client_stamp;
int width, height;
struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
uint valid_mask;
boolean have_back, have_fake;
......@@ -113,14 +113,14 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
{
struct dri2_surface *dri2surf = dri2_surface(nsurf);
struct dri2_display *dri2dpy = dri2surf->dri2dpy;
struct pipe_texture templ;
struct pipe_resource templ;
struct winsys_handle whandle;
uint valid_mask;
int i;
/* free the old textures */
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++)
pipe_texture_reference(&dri2surf->textures[i], NULL);
pipe_resource_reference(&dri2surf->textures[i], NULL);
dri2surf->valid_mask = 0x0;
dri2surf->have_back = FALSE;
......@@ -175,7 +175,7 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
memset(&whandle, 0, sizeof(whandle));
whandle.stride = xbuf->pitch;
whandle.handle = xbuf->name;
dri2surf->textures[natt] = dri2dpy->base.screen->texture_from_handle(
dri2surf->textures[natt] = dri2dpy->base.screen->resource_from_handle(
dri2dpy->base.screen, &templ, &whandle);
if (dri2surf->textures[natt])
valid_mask |= 1 << natt;
......@@ -262,7 +262,7 @@ dri2_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask)
/* create textures for pbuffer */
if (dri2surf->type == DRI2_SURFACE_TYPE_PBUFFER) {
struct pipe_screen *screen = dri2dpy->base.screen;
struct pipe_texture templ;
struct pipe_resource templ;
uint new_valid = 0x0;
int att;
......@@ -283,7 +283,7 @@ dri2_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask)
if (native_attachment_mask_test(buffer_mask, att)) {
assert(!dri2surf->textures[att]);
dri2surf->textures[att] = screen->texture_create(screen, &templ);
dri2surf->textures[att] = screen->resource_create(screen, &templ);
if (!dri2surf->textures[att])
break;
......@@ -372,7 +372,7 @@ dri2_surface_swap_buffers(struct native_surface *nsurf)
static boolean
dri2_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_texture **textures,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
{
struct dri2_surface *dri2surf = dri2_surface(nsurf);
......@@ -390,10 +390,10 @@ dri2_surface_validate(struct native_surface *nsurf, uint attachment_mask,
int att;
for (att = 0; att < NUM_NATIVE_ATTACHMENTS; att++) {
if (native_attachment_mask_test(attachment_mask, att)) {
struct pipe_texture *ptex = dri2surf->textures[att];
struct pipe_resource *ptex = dri2surf->textures[att];
textures[att] = NULL;
pipe_texture_reference(&textures[att], ptex);
pipe_resource_reference(&textures[att], ptex);
}
}
}
......@@ -429,8 +429,8 @@ dri2_surface_destroy(struct native_surface *nsurf)
free(dri2surf->last_xbufs);
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
struct pipe_texture *ptex = dri2surf->textures[i];
pipe_texture_reference(&ptex, NULL);
struct pipe_resource *ptex = dri2surf->textures[i];
pipe_resource_reference(&ptex, NULL);
}
if (dri2surf->drawable) {
......
......@@ -65,7 +65,7 @@ struct ximage_display {
};
struct ximage_buffer {
struct pipe_texture *texture;
struct pipe_resource *texture;
struct xlib_drawable xdraw;
};
......@@ -116,7 +116,7 @@ ximage_surface_free_buffer(struct native_surface *nsurf,
struct ximage_surface *xsurf = ximage_surface(nsurf);
struct ximage_buffer *xbuf = &xsurf->buffers[which];
pipe_texture_reference(&xbuf->texture, NULL);
pipe_resource_reference(&xbuf->texture, NULL);
}
static boolean
......@@ -126,7 +126,7 @@ ximage_surface_alloc_buffer(struct native_surface *nsurf,
struct ximage_surface *xsurf = ximage_surface(nsurf);
struct ximage_buffer *xbuf = &xsurf->buffers[which];
struct pipe_screen *screen = xsurf->xdpy->base.screen;
struct pipe_texture templ;
struct pipe_resource templ;
/* free old data */
if (xbuf->texture)
......@@ -154,7 +154,7 @@ ximage_surface_alloc_buffer(struct native_surface *nsurf,
break;
}
}
xbuf->texture = screen->texture_create(screen, &templ);
xbuf->texture = screen->resource_create(screen, &templ);
if (xbuf->texture) {
xbuf->xdraw.visual = xsurf->visual.visual;
xbuf->xdraw.depth = xsurf->visual.depth;
......@@ -329,7 +329,7 @@ ximage_surface_swap_buffers(struct native_surface *nsurf)
static boolean
ximage_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_texture **textures,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
{
struct ximage_surface *xsurf = ximage_surface(nsurf);
......@@ -350,7 +350,7 @@ ximage_surface_validate(struct native_surface *nsurf, uint attachment_mask,
struct ximage_buffer *xbuf = &xsurf->buffers[att];
textures[att] = NULL;
pipe_texture_reference(&textures[att], xbuf->texture);
pipe_resource_reference(&textures[att], xbuf->texture);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment