aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blit.c3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_texture.c11
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_texture.h5
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c4
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c14
-rw-r--r--mesalib/src/mesa/program/program_parse.y7
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_feedback.c6
-rw-r--r--xorg-server/present/present.c52
-rw-r--r--xorg-server/present/present_event.c2
-rw-r--r--xorg-server/present/present_fake.c2
-rw-r--r--xorg-server/present/present_fence.c29
-rw-r--r--xorg-server/present/present_priv.h17
-rw-r--r--xorg-server/present/present_screen.c2
15 files changed, 127 insertions, 33 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c
index 4ba71b929..595287d3b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blit.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blit.c
@@ -272,7 +272,8 @@ setup_vertex_data_tex(struct blit_state *ctx,
const unsigned stride = sizeof ctx->vertices[0] / sizeof ctx->vertices[0][0][0];
util_map_texcoords2d_onto_cubemap(src_face,
&ctx->vertices[0][1][0], stride,
- &ctx->vertices[0][1][0], stride);
+ &ctx->vertices[0][1][0], stride,
+ TRUE);
}
offset = get_next_slot( ctx );
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 096d3bc2b..b95cbab12 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -659,7 +659,8 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
util_map_texcoords2d_onto_cubemap(layer % 6,
/* pointer, stride in floats */
&face_coord[0][0], 2,
- &ctx->vertices[0][1][0], 8);
+ &ctx->vertices[0][1][0], 8,
+ TRUE);
} else {
set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index a885f2b0f..84bf30f08 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1409,7 +1409,8 @@ set_vertex_data(struct gen_mipmap_state *ctx,
};
util_map_texcoords2d_onto_cubemap(layer, &st[0][0], 2,
- &ctx->vertices[0][1][0], 8);
+ &ctx->vertices[0][1][0], 8,
+ FALSE);
}
else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
/* 1D texture array */
diff --git a/mesalib/src/gallium/auxiliary/util/u_texture.c b/mesalib/src/gallium/auxiliary/util/u_texture.c
index d97e57a79..e865f8e73 100644
--- a/mesalib/src/gallium/auxiliary/util/u_texture.c
+++ b/mesalib/src/gallium/auxiliary/util/u_texture.c
@@ -42,7 +42,8 @@
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
- float *out_str, unsigned out_stride)
+ float *out_str, unsigned out_stride,
+ boolean allow_scale)
{
int i;
float rx, ry, rz;
@@ -52,8 +53,14 @@ void util_map_texcoords2d_onto_cubemap(unsigned face,
/* Compute sc = +/-scale and tc = +/-scale.
* Not +/-1 to avoid cube face selection ambiguity near the edges,
* though that can still sometimes happen with this scale factor...
+ *
+ * XXX: Yep, there is no safe scale factor that will prevent sampling
+ * the neighbouring face when stretching out. A more reliable solution
+ * would be to clamp (sc, tc) against +/- 1.0-1.0/mipsize, in the shader.
+ *
+ * Also, this is not necessary when minifying, or 1:1 blits.
*/
- const float scale = 0.9999f;
+ const float scale = allow_scale ? 0.9999f : 1.0f;
const float sc = (2 * in_st[0] - 1) * scale;
const float tc = (2 * in_st[1] - 1) * scale;
diff --git a/mesalib/src/gallium/auxiliary/util/u_texture.h b/mesalib/src/gallium/auxiliary/util/u_texture.h
index 93b2f1e4c..b1c8c7091 100644
--- a/mesalib/src/gallium/auxiliary/util/u_texture.h
+++ b/mesalib/src/gallium/auxiliary/util/u_texture.h
@@ -27,6 +27,8 @@
#ifndef U_TEXTURE_H
#define U_TEXTURE_H
+#include "pipe/p_compiler.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -44,7 +46,8 @@ extern "C" {
*/
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
- float *out_str, unsigned out_stride);
+ float *out_str, unsigned out_stride,
+ boolean allow_scale);
#ifdef __cplusplus
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index c062071b0..73dc5c4c0 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -406,8 +406,8 @@ swrast_map_renderbuffer(struct gl_context *ctx,
(char *) xrb->Base.Buffer,
dPriv->loaderPrivate);
- *out_map = xrb->Base.Buffer;
- *out_stride = stride;
+ *out_map = xrb->Base.Buffer + (h - 1) * stride;
+ *out_stride = -stride;
return;
}
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index f6fd53576..58e1f496e 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -368,6 +368,13 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
return;
case STATE_LOCAL:
+ if (!ctx->FragmentProgram.Current->Base.LocalParams) {
+ ctx->FragmentProgram.Current->Base.LocalParams =
+ calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+ if (!ctx->FragmentProgram.Current->Base.LocalParams)
+ return;
+ }
+
COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]);
return;
default:
@@ -387,6 +394,13 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
return;
case STATE_LOCAL:
+ if (!ctx->VertexProgram.Current->Base.LocalParams) {
+ ctx->VertexProgram.Current->Base.LocalParams =
+ calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+ if (!ctx->VertexProgram.Current->Base.LocalParams)
+ return;
+ }
+
COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
return;
default:
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index 03c0a3dba..a76db4e86 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
-#include "main/macros.h"
#include "main/mtypes.h"
#include "main/imports.h"
#include "program/program.h"
@@ -2560,12 +2559,6 @@ initialize_symbol_from_param(struct gl_program *prog,
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_STATE_VAR;
- /* Dynamically allocate LocalParams, since it's a large array to have
- * statically in every gl_program otherwise.
- */
- if (state_tokens[1] == STATE_LOCAL && !prog->LocalParams)
- prog->LocalParams = calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
-
/* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
* we need to unroll it and call add_state_reference() for each row
*/
diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c
index d2e4346b7..34a16ccf9 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c
@@ -85,9 +85,11 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
const GLfloat *color, *texcoord;
GLuint slot;
- /* Recall that Y=0=Top of window for Gallium wincoords */
win[0] = v->data[0][0];
- win[1] = ctx->DrawBuffer->Height - v->data[0][1];
+ if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
+ win[1] = ctx->DrawBuffer->Height - v->data[0][1];
+ else
+ win[1] = v->data[0][1];
win[2] = v->data[0][2];
win[3] = 1.0F / v->data[0][3];
diff --git a/xorg-server/present/present.c b/xorg-server/present/present.c
index 228d43a20..f9eef6b26 100644
--- a/xorg-server/present/present.c
+++ b/xorg-server/present/present.c
@@ -171,7 +171,8 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_
{
int n;
- present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
+ if (vblank->window)
+ present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
for (n = 0; n < vblank->num_notifies; n++) {
WindowPtr window = vblank->notifies[n].window;
CARD32 serial = vblank->notifies[n].serial;
@@ -320,8 +321,8 @@ present_unflip(ScreenPtr screen)
/* Update the screen pixmap with the current flip pixmap contents
*/
- if (screen_priv->flip_pixmap) {
- present_copy_region(&screen->GetScreenPixmap(screen)->drawable,
+ if (screen_priv->flip_pixmap && screen_priv->flip_window) {
+ present_copy_region(&screen_priv->flip_window->drawable,
screen_priv->flip_pixmap,
NULL, 0, 0);
}
@@ -336,8 +337,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
static void
present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
{
- WindowPtr window = vblank->window;
- ScreenPtr screen = window->drawable.pScreen;
+ ScreenPtr screen = vblank->screen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
DebugPresent(("\tn %p %8lld: %08lx -> %08lx\n", vblank, vblank->target_msc,
@@ -363,8 +363,7 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
if (vblank->abort_flip)
present_unflip(screen);
- if (!vblank->window_destroyed)
- present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
+ present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
present_vblank_destroy(vblank);
}
@@ -374,6 +373,8 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
present_vblank_ptr vblank, tmp;
int s;
+ if (!event_id)
+ return;
DebugPresent(("\te %lld ust %lld msc %lld\n", event_id, ust, msc));
xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
if (vblank->event_id == event_id) {
@@ -398,6 +399,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
DebugPresent(("\tun %lld\n", event_id));
screen_priv->unflip_event_id = 0;
present_flip_idle(screen);
+ return;
}
}
}
@@ -451,6 +453,26 @@ present_check_flip_window (WindowPtr window)
}
/*
+ * Called when the wait fence is triggered; just gets the current msc/ust and
+ * calls present_execute again. That will re-check the fence and pend the
+ * request again if it's still not actually ready
+ */
+static void
+present_wait_fence_triggered(void *param)
+{
+ present_vblank_ptr vblank = param;
+ WindowPtr window = vblank->window;
+ uint64_t ust = 0, crtc_msc = 0;
+
+ if (window) {
+ present_window_priv_ptr window_priv = present_get_window_priv(window, TRUE);
+ if (window_priv)
+ (void) present_get_ust_msc(window, window_priv->crtc, &ust, &crtc_msc);
+ }
+ present_execute(vblank, ust, crtc_msc);
+}
+
+/*
* Once the required MSC has been reached, execute the pending request.
*
* For requests to actually present something, either blt contents to
@@ -467,11 +489,14 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
present_screen_priv_ptr screen_priv = present_screen_priv(window->drawable.pScreen);
if (vblank->wait_fence) {
- /* XXX check fence, queue if not ready */
+ if (!present_fence_check_triggered(vblank->wait_fence)) {
+ present_fence_set_callback(vblank->wait_fence, present_wait_fence_triggered, vblank);
+ return;
+ }
}
xorg_list_del(&vblank->event_queue);
- if (vblank->pixmap) {
+ if (vblank->pixmap && vblank->window) {
if (vblank->flip && screen_priv->flip_pending == NULL && !screen_priv->unflip_event_id) {
@@ -652,6 +677,12 @@ present_pixmap(WindowPtr window,
target_msc--;
}
+ if (wait_fence) {
+ vblank->wait_fence = present_fence_create(wait_fence);
+ if (!vblank->wait_fence)
+ goto no_mem;
+ }
+
if (idle_fence) {
vblank->idle_fence = present_fence_create(idle_fence);
if (!vblank->idle_fence)
@@ -762,6 +793,9 @@ present_vblank_destroy(present_vblank_ptr vblank)
if (vblank->update)
RegionDestroy(vblank->update);
+ if (vblank->wait_fence)
+ present_fence_destroy(vblank->wait_fence);
+
if (vblank->idle_fence)
present_fence_destroy(vblank->idle_fence);
diff --git a/xorg-server/present/present_event.c b/xorg-server/present/present_event.c
index a30bc8286..a8f7176eb 100644
--- a/xorg-server/present/present_event.c
+++ b/xorg-server/present/present_event.c
@@ -26,8 +26,6 @@
#include "present_priv.h"
-#include "present_priv.h"
-
RESTYPE present_event_type;
static int
diff --git a/xorg-server/present/present_fake.c b/xorg-server/present/present_fake.c
index a67759254..e550e98f8 100644
--- a/xorg-server/present/present_fake.c
+++ b/xorg-server/present/present_fake.c
@@ -42,7 +42,7 @@ present_fake_get_ust_msc(ScreenPtr screen, uint64_t *ust, uint64_t *msc)
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
*ust = GetTimeInMicros();
- *msc = *ust / screen_priv->fake_interval;
+ *msc = (*ust + screen_priv->fake_interval / 2) / screen_priv->fake_interval;
return Success;
}
diff --git a/xorg-server/present/present_fence.c b/xorg-server/present/present_fence.c
index db5efcaad..e09657d31 100644
--- a/xorg-server/present/present_fence.c
+++ b/xorg-server/present/present_fence.c
@@ -37,6 +37,8 @@
struct present_fence {
SyncTrigger trigger;
SyncFence *fence;
+ void (*callback)(void *param);
+ void *param;
};
/*
@@ -45,12 +47,18 @@ struct present_fence {
static Bool
present_fence_sync_check_trigger(SyncTrigger *trigger, XSyncValue oldval)
{
- return FALSE;
+ struct present_fence *present_fence = container_of(trigger, struct present_fence, trigger);
+
+ return present_fence->callback != NULL;
}
static void
present_fence_sync_trigger_fired(SyncTrigger *trigger)
{
+ struct present_fence *present_fence = container_of(trigger, struct present_fence, trigger);
+
+ if (present_fence->callback)
+ (*present_fence->callback)(present_fence->param);
}
static void
@@ -101,6 +109,25 @@ present_fence_set_triggered(struct present_fence *present_fence)
(*present_fence->fence->funcs.SetTriggered) (present_fence->fence);
}
+Bool
+present_fence_check_triggered(struct present_fence *present_fence)
+{
+ if (!present_fence)
+ return TRUE;
+ if (!present_fence->fence)
+ return TRUE;
+ return (*present_fence->fence->funcs.CheckTriggered)(present_fence->fence);
+}
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+ void (*callback) (void *param),
+ void *param)
+{
+ present_fence->callback = callback;
+ present_fence->param = param;
+}
+
XID
present_fence_id(struct present_fence *present_fence)
{
diff --git a/xorg-server/present/present_priv.h b/xorg-server/present/present_priv.h
index a92b62a2d..500c7c265 100644
--- a/xorg-server/present/present_priv.h
+++ b/xorg-server/present/present_priv.h
@@ -72,8 +72,6 @@ struct present_vblank {
Bool flip;
Bool sync_flip;
Bool abort_flip;
-
- Bool window_destroyed;
};
typedef struct present_screen_priv {
@@ -251,6 +249,14 @@ present_fence_destroy(struct present_fence *present_fence);
void
present_fence_set_triggered(struct present_fence *present_fence);
+Bool
+present_fence_check_triggered(struct present_fence *present_fence);
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+ void (*callback)(void *param),
+ void *param);
+
XID
present_fence_id(struct present_fence *present_fence);
@@ -273,6 +279,13 @@ void
present_destroy_notifies(present_notify_ptr notifies, int num_notifies);
/*
+ * present_redirect.c
+ */
+
+WindowPtr
+present_redirect(ClientPtr client, WindowPtr target);
+
+/*
* present_request.c
*/
int
diff --git a/xorg-server/present/present_screen.c b/xorg-server/present/present_screen.c
index 50b2b2d23..2702cd6ca 100644
--- a/xorg-server/present/present_screen.c
+++ b/xorg-server/present/present_screen.c
@@ -92,7 +92,7 @@ present_clear_window_flip(WindowPtr window)
if (flip_pending && flip_pending->window == window) {
assert (flip_pending->abort_flip);
- flip_pending->window_destroyed = TRUE;
+ flip_pending->window = NULL;
}
if (screen_priv->flip_window == window)
screen_priv->flip_window = NULL;