summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/drm/dri1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/dri/drm/dri1.c')
-rw-r--r--src/gallium/state_trackers/dri/drm/dri1.c65
1 files changed, 26 insertions, 39 deletions
diff --git a/src/gallium/state_trackers/dri/drm/dri1.c b/src/gallium/state_trackers/dri/drm/dri1.c
index e216e46..23c21ed 100644
--- a/src/gallium/state_trackers/dri/drm/dri1.c
+++ b/src/gallium/state_trackers/dri/drm/dri1.c
@@ -104,13 +104,13 @@ dri1_propagate_drawable_change(struct dri_context *ctx)
if (dPriv && draw->texture_stamp != dPriv->lastStamp) {
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
flushed = TRUE;
- ctx->st->notify_invalid_framebuffer(ctx->st, draw->stfb);
+ ctx->st->notify_invalid_framebuffer(ctx->st, &draw->base);
}
if (rPriv && dPriv != rPriv && read->texture_stamp != rPriv->lastStamp) {
if (!flushed)
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- ctx->st->notify_invalid_framebuffer(ctx->st, read->stfb);
+ ctx->st->notify_invalid_framebuffer(ctx->st, &read->base);
}
}
@@ -253,13 +253,13 @@ dri1_copy_to_front(struct dri_context *ctx,
* Backend functions for st_framebuffer interface and swap_buffers.
*/
-void
+static void
dri1_flush_frontbuffer(struct dri_drawable *draw,
enum st_attachment_type statt)
{
- struct dri_context *ctx = dri_get_current();
+ struct dri_context *ctx = dri_get_current(draw->sPriv);
struct dri_screen *screen = dri_screen(draw->sPriv);
- struct pipe_screen *pipe_screen = screen->pipe_screen;
+ struct pipe_screen *pipe_screen = screen->base.screen;
struct pipe_fence_handle *dummy_fence;
struct pipe_resource *ptex;
@@ -280,10 +280,10 @@ dri1_flush_frontbuffer(struct dri_drawable *draw,
void
dri1_swap_buffers(__DRIdrawable * dPriv)
{
- struct dri_context *ctx = dri_get_current();
struct dri_drawable *draw = dri_drawable(dPriv);
+ struct dri_context *ctx = dri_get_current(draw->sPriv);
struct dri_screen *screen = dri_screen(draw->sPriv);
- struct pipe_screen *pipe_screen = screen->pipe_screen;
+ struct pipe_screen *pipe_screen = screen->base.screen;
struct pipe_fence_handle *fence;
struct pipe_resource *ptex;
@@ -309,9 +309,9 @@ dri1_swap_buffers(__DRIdrawable * dPriv)
void
dri1_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h)
{
- struct dri_context *ctx = dri_get_current();
+ struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
struct dri_screen *screen = dri_screen(dPriv->driScreenPriv);
- struct pipe_screen *pipe_screen = screen->pipe_screen;
+ struct pipe_screen *pipe_screen = screen->base.screen;
struct drm_clip_rect sub_bbox;
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_fence_handle *dummy_fence;
@@ -342,9 +342,10 @@ dri1_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h)
* as they are requested. Unused attachments are not removed, not until the
* framebuffer is resized or destroyed.
*/
-void
+static void
dri1_allocate_textures(struct dri_drawable *drawable,
- unsigned mask)
+ const enum st_attachment_type *statts,
+ unsigned count)
{
struct dri_screen *screen = dri_screen(drawable->sPriv);
struct pipe_resource templ;
@@ -371,40 +372,24 @@ dri1_allocate_textures(struct dri_drawable *drawable,
templ.depth0 = 1;
templ.last_level = 0;
- for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ for (i = 0; i < count; i++) {
enum pipe_format format;
- unsigned tex_usage;
+ unsigned bind;
- /* the texture already exists or not requested */
- if (drawable->textures[i] || !(mask & (1 << i))) {
+ /* the texture already exists */
+ if (drawable->textures[statts[i]])
continue;
- }
- switch (i) {
- case ST_ATTACHMENT_FRONT_LEFT:
- case ST_ATTACHMENT_BACK_LEFT:
- case ST_ATTACHMENT_FRONT_RIGHT:
- case ST_ATTACHMENT_BACK_RIGHT:
- format = drawable->stvis.color_format;
- 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_BIND_DEPTH_STENCIL;
- break;
- default:
- format = PIPE_FORMAT_NONE;
- break;
- }
+ dri_drawable_get_format(drawable, statts[i], &format, &bind);
+
+ if (format == PIPE_FORMAT_NONE)
+ continue;
- if (format != PIPE_FORMAT_NONE) {
- templ.format = format;
- templ.bind = tex_usage;
+ templ.format = format;
+ templ.bind = bind;
- drawable->textures[i] =
- screen->pipe_screen->resource_create(screen->pipe_screen, &templ);
- }
+ drawable->textures[statts[i]] =
+ screen->base.screen->resource_create(screen->base.screen, &templ);
}
drawable->old_w = width;
@@ -489,6 +474,8 @@ dri1_init_screen(__DRIscreen * sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
screen->drmLock = (drmLock *) & sPriv->pSAREA->lock;
+ screen->allocate_textures = dri1_allocate_textures;
+ screen->flush_frontbuffer = dri1_flush_frontbuffer;
sPriv->private = (void *)screen;
sPriv->extensions = dri1_screen_extensions;