summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/glx/xlib/xm_st.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/glx/xlib/xm_st.c')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index e7466bdbee..6bfe8b0788 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -42,7 +42,7 @@ struct xmesa_st_framebuffer {
unsigned texture_width, texture_height, texture_mask;
struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
- struct pipe_surface *display_surface;
+ struct pipe_resource *display_resource;
};
static INLINE struct xmesa_st_framebuffer *
@@ -60,25 +60,19 @@ xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
{
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
struct pipe_resource *ptex = xstfb->textures[statt];
- struct pipe_surface *psurf;
+ struct pipe_resource *pres;
if (!ptex)
return TRUE;
- psurf = xstfb->display_surface;
+ pres = xstfb->display_resource;
/* (re)allocate the surface for the texture to be displayed */
- if (!psurf || psurf->texture != ptex) {
- pipe_surface_reference(&xstfb->display_surface, NULL);
-
- psurf = xstfb->screen->get_tex_surface(xstfb->screen,
- ptex, 0, 0, 0, PIPE_BIND_DISPLAY_TARGET);
- if (!psurf)
- return FALSE;
-
- xstfb->display_surface = psurf;
+ if (!pres || pres != ptex) {
+ pipe_resource_reference(&xstfb->display_resource, ptex);
+ pres = xstfb->display_resource;
}
- xstfb->screen->flush_frontbuffer(xstfb->screen, psurf, &xstfb->buffer->ws);
+ xstfb->screen->flush_frontbuffer(xstfb->screen, pres, 0, 0, &xstfb->buffer->ws);
return TRUE;
}
@@ -96,7 +90,7 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
struct pipe_resource *src_ptex = xstfb->textures[src_statt];
struct pipe_resource *dst_ptex = xstfb->textures[dst_statt];
- struct pipe_subresource subsrc, subdst;
+ struct pipe_box src_box;
struct pipe_context *pipe;
if (!src_ptex || !dst_ptex)
@@ -110,14 +104,11 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
xstfb->display->pipe = pipe;
}
- subsrc.face = 0;
- subsrc.level = 0;
- subdst.face = 0;
- subdst.level = 0;
+ u_box_2d(x, y, width, height, &src_box);
if (src_ptex && dst_ptex)
- pipe->resource_copy_region(pipe, dst_ptex, subdst, x, y, 0,
- src_ptex, subsrc, x, y, 0, width, height);
+ pipe->resource_copy_region(pipe, dst_ptex, 0, x, y, 0,
+ src_ptex, 0, &src_box);
}
/**
@@ -144,6 +135,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.last_level = 0;
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
@@ -321,7 +313,7 @@ xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
int i;
- pipe_surface_reference(&xstfb->display_surface, NULL);
+ pipe_resource_reference(&xstfb->display_resource, NULL);
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(&xstfb->textures[i], NULL);