Compare commits
46 Commits
mesa-7.7-4
...
mesa_7_7_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e33121b2d8 | ||
|
|
415d0326bb | ||
|
|
7e24ce2d9b | ||
|
|
2ae754b7b9 | ||
|
|
501156b36b | ||
|
|
4ff3244457 | ||
|
|
3889556d70 | ||
|
|
6412046f65 | ||
|
|
6e96cea6e2 | ||
|
|
3a3ef3d6c9 | ||
|
|
98aed6dc69 | ||
|
|
d3a607f889 | ||
|
|
00e41e007e | ||
|
|
6624845a5d | ||
|
|
c9c54180e4 | ||
|
|
93e77b0028 | ||
|
|
0c9e8e6c6e | ||
|
|
c50477c255 | ||
|
|
3bf13656d3 | ||
|
|
fa4083d38b | ||
|
|
d311ded31d | ||
|
|
34f0207161 | ||
|
|
8d3f629a13 | ||
|
|
b98ef495d4 | ||
|
|
21c91b410a | ||
|
|
a8f3b3f88a | ||
|
|
e8a8c5e339 | ||
|
|
7941d31ee6 | ||
|
|
842351dd76 | ||
|
|
d74929702f | ||
|
|
1e431f0454 | ||
|
|
4cc8d1d79f | ||
|
|
3d2bc6848a | ||
|
|
d5327538e7 | ||
|
|
86ac140937 | ||
|
|
b584e780ab | ||
|
|
981e8a2087 | ||
|
|
72d380b363 | ||
|
|
cf8af9bcf1 | ||
|
|
7123f3d77a | ||
|
|
2edb1b9534 | ||
|
|
69334d6784 | ||
|
|
61482ddc1c | ||
|
|
b0e84e22d5 | ||
|
|
c0e8d443fe | ||
|
|
b95d4cd680 |
2
Makefile
2
Makefile
@@ -182,7 +182,7 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.7.1-devel
|
||||
VERSION=7.7.1-rc2
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
|
||||
@@ -30,12 +30,6 @@ tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>tbd
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Assorted fixes to VMware SVGA gallium driver.
|
||||
@@ -45,6 +39,12 @@ tbd
|
||||
<li>Gallium SSE codegen for XPD didn't always work.
|
||||
<li>Fixed Windows build.
|
||||
<li>Fixed broken glMultiDrawElements().
|
||||
<li>Silence bogus GL errors generated in glxinfo.
|
||||
<li>Fixed several render to texture bugs.
|
||||
<li>Assorted bug fixes in Mesa/Gallium state tracker including
|
||||
glCopy/DrawPixels() to FBOs.
|
||||
<li>Assorted fixes to Gallium drivers.
|
||||
<li>Fixed broken glPush/PopClientAttrib() for vertex arrays in GLX code.
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -644,6 +644,57 @@ void debug_dump_image(const char *prefix,
|
||||
}
|
||||
|
||||
EngUnmapFile(iFile);
|
||||
#elif defined(PIPE_OS_UNIX)
|
||||
/* write a ppm file */
|
||||
char filename[256];
|
||||
FILE *f;
|
||||
|
||||
util_snprintf(filename, sizeof(filename), "%s.ppm", prefix);
|
||||
|
||||
f = fopen(filename, "w");
|
||||
if (f) {
|
||||
int i, x, y;
|
||||
int r, g, b;
|
||||
const uint8_t *ptr = (uint8_t *) data;
|
||||
|
||||
/* XXX this is a hack */
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_B8G8R8A8_UNORM:
|
||||
r = 2;
|
||||
g = 1;
|
||||
b = 0;
|
||||
break;
|
||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||
b = 0;
|
||||
g = 1;
|
||||
r = 2;
|
||||
break;
|
||||
default:
|
||||
r = 0;
|
||||
g = 1;
|
||||
b = 2;
|
||||
}
|
||||
|
||||
fprintf(f, "P6\n");
|
||||
fprintf(f, "# ppm-file created by osdemo.c\n");
|
||||
fprintf(f, "%i %i\n", width, height);
|
||||
fprintf(f, "255\n");
|
||||
fclose(f);
|
||||
|
||||
f = fopen(filename, "ab"); /* reopen in binary append mode */
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
i = y * stride + x * cpp;
|
||||
fputc(ptr[i + r], f); /* write red */
|
||||
fputc(ptr[i + g], f); /* write green */
|
||||
fputc(ptr[i + b], f); /* write blue */
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Can't open %s for writing\n", filename);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -297,13 +297,14 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc)
|
||||
x, y, TILE_SIZE, TILE_SIZE,
|
||||
tc->tile.data.color32, 0/*STRIDE*/);
|
||||
|
||||
/* do this? */
|
||||
clear_clear_flag(tc->clear_flags, addr);
|
||||
|
||||
numCleared++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* reset all clear flags to zero */
|
||||
memset(tc->clear_flags, 0, sizeof(tc->clear_flags));
|
||||
|
||||
#if 0
|
||||
debug_printf("num cleared: %u\n", numCleared);
|
||||
#endif
|
||||
|
||||
@@ -284,3 +284,8 @@ void svga_hwtnl_flush_retry( struct svga_context *svga )
|
||||
assert(ret == 0);
|
||||
}
|
||||
|
||||
struct svga_winsys_context *
|
||||
svga_winsys_context( struct pipe_context *pipe )
|
||||
{
|
||||
return svga_context( pipe )->swc;
|
||||
}
|
||||
|
||||
@@ -192,15 +192,24 @@ static int emit_rss( struct svga_context *svga,
|
||||
}
|
||||
|
||||
|
||||
if (dirty & SVGA_NEW_RAST)
|
||||
if (dirty & (SVGA_NEW_RAST | SVGA_NEW_NEED_PIPELINE))
|
||||
{
|
||||
const struct svga_rasterizer_state *curr = svga->curr.rast;
|
||||
unsigned cullmode = curr->cullmode;
|
||||
|
||||
/* Shademode: still need to rearrange index list to move
|
||||
* flat-shading PV first vertex.
|
||||
*/
|
||||
EMIT_RS( svga, curr->shademode, SHADEMODE, fail );
|
||||
EMIT_RS( svga, curr->cullmode, CULLMODE, fail );
|
||||
|
||||
/* Don't do culling while the software pipeline is active. It
|
||||
* does it for us, and additionally introduces potentially
|
||||
* back-facing triangles.
|
||||
*/
|
||||
if (svga->state.sw.need_pipeline)
|
||||
cullmode = SVGA3D_FACE_NONE;
|
||||
|
||||
EMIT_RS( svga, cullmode, CULLMODE, fail );
|
||||
EMIT_RS( svga, curr->scissortestenable, SCISSORTESTENABLE, fail );
|
||||
EMIT_RS( svga, curr->multisampleantialias, MULTISAMPLEANTIALIAS, fail );
|
||||
EMIT_RS( svga, curr->lastpixel, LASTPIXEL, fail );
|
||||
|
||||
@@ -281,6 +281,9 @@ svga_screen_create(struct svga_winsys_screen *sws);
|
||||
struct svga_winsys_screen *
|
||||
svga_winsys_screen(struct pipe_screen *screen);
|
||||
|
||||
struct svga_winsys_context *
|
||||
svga_winsys_context(struct pipe_context *context);
|
||||
|
||||
struct pipe_buffer *
|
||||
svga_screen_buffer_wrap_surface(struct pipe_screen *screen,
|
||||
enum SVGA3dSurfaceFormat format,
|
||||
|
||||
@@ -80,6 +80,9 @@ dri_fill_in_modes(struct dri_screen *screen,
|
||||
unsigned pixel_bits)
|
||||
{
|
||||
__DRIconfig **configs = NULL;
|
||||
__DRIconfig **configs_r5g6b5 = NULL;
|
||||
__DRIconfig **configs_a8r8g8b8 = NULL;
|
||||
__DRIconfig **configs_x8r8g8b8 = NULL;
|
||||
unsigned num_modes;
|
||||
uint8_t depth_bits_array[5];
|
||||
uint8_t stencil_bits_array[5];
|
||||
@@ -117,25 +120,23 @@ dri_fill_in_modes(struct dri_screen *screen,
|
||||
pf_x8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8R8G8B8_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
|
||||
pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_R5G6B5_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
|
||||
|
||||
/* we support buffers with different depths only if we can tell the driver
|
||||
* the actual depth of each of them. */
|
||||
if (screen->sPriv->dri2.loader
|
||||
&& (screen->sPriv->dri2.loader->base.version > 2)
|
||||
&& (screen->sPriv->dri2.loader->getBuffersWithFormat != NULL)) {
|
||||
/* We can only get a 16 or 32 bit depth buffer with getBuffersWithFormat */
|
||||
if (screen->sPriv->dri2.loader &&
|
||||
(screen->sPriv->dri2.loader->base.version > 2) &&
|
||||
(screen->sPriv->dri2.loader->getBuffersWithFormat != NULL)) {
|
||||
pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
|
||||
pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
|
||||
pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_R5G6B5_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
|
||||
} else {
|
||||
pf_z16 = FALSE;
|
||||
pf_z32 = FALSE;
|
||||
pf_r5g6b5 = FALSE;
|
||||
}
|
||||
|
||||
if (pf_z16) {
|
||||
@@ -164,41 +165,43 @@ dri_fill_in_modes(struct dri_screen *screen,
|
||||
num_modes =
|
||||
depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
|
||||
|
||||
if (pixel_bits == 16 && pf_r5g6b5) {
|
||||
configs = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
|
||||
depth_bits_array, stencil_bits_array,
|
||||
depth_buffer_factor, back_buffer_modes,
|
||||
back_buffer_factor,
|
||||
msaa_samples_array, 1);
|
||||
if (pf_r5g6b5)
|
||||
configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
|
||||
depth_bits_array, stencil_bits_array,
|
||||
depth_buffer_factor, back_buffer_modes,
|
||||
back_buffer_factor,
|
||||
msaa_samples_array, 1);
|
||||
|
||||
if (pf_a8r8g8b8)
|
||||
configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
depth_bits_array,
|
||||
stencil_bits_array,
|
||||
depth_buffer_factor,
|
||||
back_buffer_modes,
|
||||
back_buffer_factor,
|
||||
msaa_samples_array, 1);
|
||||
|
||||
if (pf_x8r8g8b8)
|
||||
configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
depth_bits_array,
|
||||
stencil_bits_array,
|
||||
depth_buffer_factor,
|
||||
back_buffer_modes,
|
||||
back_buffer_factor,
|
||||
msaa_samples_array, 1);
|
||||
|
||||
if (pixel_bits == 16) {
|
||||
configs = configs_r5g6b5;
|
||||
if (configs_a8r8g8b8)
|
||||
configs = configs ? driConcatConfigs(configs, configs_a8r8g8b8) : configs_a8r8g8b8;
|
||||
if (configs_x8r8g8b8)
|
||||
configs = configs ? driConcatConfigs(configs, configs_x8r8g8b8) : configs_x8r8g8b8;
|
||||
} else {
|
||||
__DRIconfig **configs_a8r8g8b8 = NULL;
|
||||
__DRIconfig **configs_x8r8g8b8 = NULL;
|
||||
|
||||
if (pf_a8r8g8b8)
|
||||
configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
depth_bits_array,
|
||||
stencil_bits_array,
|
||||
depth_buffer_factor,
|
||||
back_buffer_modes,
|
||||
back_buffer_factor,
|
||||
msaa_samples_array, 1);
|
||||
if (pf_x8r8g8b8)
|
||||
configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
depth_bits_array,
|
||||
stencil_bits_array,
|
||||
depth_buffer_factor,
|
||||
back_buffer_modes,
|
||||
back_buffer_factor,
|
||||
msaa_samples_array, 1);
|
||||
|
||||
if (configs_a8r8g8b8 && configs_x8r8g8b8)
|
||||
configs = driConcatConfigs(configs_x8r8g8b8, configs_a8r8g8b8);
|
||||
else if (configs_a8r8g8b8)
|
||||
configs = configs_a8r8g8b8;
|
||||
else if (configs_x8r8g8b8)
|
||||
configs = configs_x8r8g8b8;
|
||||
else
|
||||
configs = NULL;
|
||||
configs = configs_a8r8g8b8;
|
||||
if (configs_x8r8g8b8)
|
||||
configs = configs ? driConcatConfigs(configs, configs_x8r8g8b8) : configs_x8r8g8b8;
|
||||
if (configs_r5g6b5)
|
||||
configs = configs ? driConcatConfigs(configs, configs_r5g6b5) : configs_r5g6b5;
|
||||
}
|
||||
|
||||
if (configs == NULL) {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <xf86.h>
|
||||
#include <xf86i2c.h>
|
||||
#include <xf86Crtc.h>
|
||||
#include <cursorstr.h>
|
||||
#include "xorg_tracker.h"
|
||||
#include "xf86Modes.h"
|
||||
|
||||
@@ -146,6 +147,7 @@ crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
|
||||
/* XXX: hockup */
|
||||
}
|
||||
|
||||
#if 0 /* Implement and enable to enable rotation and reflection. */
|
||||
static void *
|
||||
crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
|
||||
{
|
||||
@@ -168,6 +170,8 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
|
||||
/* ScrnInfoPtr pScrn = crtc->scrn; */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Cursor functions
|
||||
*/
|
||||
@@ -276,7 +280,21 @@ err_bo_destroy:
|
||||
static void
|
||||
crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
|
||||
modesettingPtr ms = modesettingPTR(crtc->scrn);
|
||||
|
||||
/* Older X servers have cursor reference counting bugs leading to use of
|
||||
* freed memory and consequently random crashes. Should be fixed as of
|
||||
* xserver 1.8, but this workaround shouldn't hurt anyway.
|
||||
*/
|
||||
if (config->cursor)
|
||||
config->cursor->refcnt++;
|
||||
|
||||
if (ms->cursor)
|
||||
FreeCursor(ms->cursor, None);
|
||||
|
||||
ms->cursor = config->cursor;
|
||||
|
||||
if (ms->screen)
|
||||
crtc_load_cursor_argb_ga3d(crtc, image);
|
||||
#ifdef HAVE_LIBKMS
|
||||
@@ -348,9 +366,9 @@ static const xf86CrtcFuncsRec crtc_funcs = {
|
||||
.hide_cursor = crtc_hide_cursor,
|
||||
.load_cursor_argb = crtc_load_cursor_argb,
|
||||
|
||||
.shadow_create = crtc_shadow_create,
|
||||
.shadow_allocate = crtc_shadow_allocate,
|
||||
.shadow_destroy = crtc_shadow_destroy,
|
||||
.shadow_create = NULL,
|
||||
.shadow_allocate = NULL,
|
||||
.shadow_destroy = NULL,
|
||||
|
||||
.gamma_set = crtc_gamma_set,
|
||||
.destroy = crtc_destroy,
|
||||
|
||||
@@ -295,6 +295,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
|
||||
GCPtr gc;
|
||||
RegionPtr copy_clip;
|
||||
Bool save_accel;
|
||||
CustomizerPtr cust = ms->cust;
|
||||
|
||||
/*
|
||||
* In driCreateBuffers we dewrap windows into the
|
||||
@@ -348,7 +349,8 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
|
||||
ValidateGC(dst_draw, gc);
|
||||
|
||||
/* If this is a full buffer swap, throttle on the previous one */
|
||||
if (dst_priv->fence && REGION_NUM_RECTS(pRegion) == 1) {
|
||||
if (ms->swapThrottling &&
|
||||
dst_priv->fence && REGION_NUM_RECTS(pRegion) == 1) {
|
||||
BoxPtr extents = REGION_EXTENTS(pScreen, pRegion);
|
||||
|
||||
if (extents->x1 == 0 && extents->y1 == 0 &&
|
||||
@@ -370,6 +372,9 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
|
||||
DamageRegionAppend(src_draw, pRegion);
|
||||
DamageRegionProcessPending(src_draw);
|
||||
|
||||
if (cust && cust->winsys_context_throttle)
|
||||
cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_SWAP);
|
||||
|
||||
(*gc->ops->CopyArea)(src_draw, dst_draw, gc,
|
||||
0, 0, pDraw->width, pDraw->height, 0, 0);
|
||||
ms->exa->accel = save_accel;
|
||||
@@ -377,8 +382,13 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
|
||||
FreeScratchGC(gc);
|
||||
|
||||
ms->ctx->flush(ms->ctx, PIPE_FLUSH_SWAPBUFFERS,
|
||||
pDestBuffer->attachment == DRI2BufferFrontLeft ?
|
||||
(pDestBuffer->attachment == DRI2BufferFrontLeft
|
||||
&& ms->swapThrottling) ?
|
||||
&dst_priv->fence : NULL);
|
||||
|
||||
if (cust && cust->winsys_context_throttle)
|
||||
cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_RENDER);
|
||||
|
||||
}
|
||||
|
||||
Bool
|
||||
|
||||
@@ -79,12 +79,16 @@ typedef enum
|
||||
OPTION_SW_CURSOR,
|
||||
OPTION_2D_ACCEL,
|
||||
OPTION_DEBUG_FALLBACK,
|
||||
OPTION_THROTTLE_SWAP,
|
||||
OPTION_THROTTLE_DIRTY
|
||||
} drv_option_enums;
|
||||
|
||||
static const OptionInfoRec drv_options[] = {
|
||||
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
|
||||
{OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE},
|
||||
{OPTION_DEBUG_FALLBACK, "DebugFallback", OPTV_BOOLEAN, {0}, FALSE},
|
||||
{OPTION_THROTTLE_SWAP, "SwapThrottling", OPTV_BOOLEAN, {0}, FALSE},
|
||||
{OPTION_THROTTLE_DIRTY, "DirtyThrottling", OPTV_BOOLEAN, {0}, FALSE},
|
||||
{-1, NULL, OPTV_NONE, {0}, FALSE}
|
||||
};
|
||||
|
||||
@@ -183,10 +187,12 @@ drv_probe_ddc(ScrnInfoPtr pScrn, int index)
|
||||
static Bool
|
||||
drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height)
|
||||
{
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
modesettingPtr ms = modesettingPTR(pScrn);
|
||||
ScreenPtr pScreen = pScrn->pScreen;
|
||||
int old_width, old_height;
|
||||
PixmapPtr rootPixmap;
|
||||
int i;
|
||||
|
||||
if (width == pScrn->virtualX && height == pScrn->virtualY)
|
||||
return TRUE;
|
||||
@@ -204,13 +210,29 @@ drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height)
|
||||
|
||||
pScrn->displayWidth = rootPixmap->devKind / (rootPixmap->drawable.bitsPerPixel / 8);
|
||||
|
||||
if (ms->create_front_buffer(pScrn) && ms->bind_front_buffer(pScrn))
|
||||
return TRUE;
|
||||
if (!ms->create_front_buffer(pScrn) || !ms->bind_front_buffer(pScrn))
|
||||
goto error_create;
|
||||
|
||||
/*
|
||||
* create && bind will turn off all crtc(s) in the kernel so we need to
|
||||
* re-enable all the crtcs again. For real HW we might want to do this
|
||||
* before destroying the old framebuffer.
|
||||
*/
|
||||
for (i = 0; i < xf86_config->num_crtc; i++) {
|
||||
xf86CrtcPtr crtc = xf86_config->crtc[i];
|
||||
|
||||
if (!crtc->enabled)
|
||||
continue;
|
||||
|
||||
crtc->funcs->set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* This is the error recovery path.
|
||||
*/
|
||||
|
||||
error_create:
|
||||
if (!pScreen->ModifyPixmapHeader(rootPixmap, old_width, old_height, -1, -1, -1, NULL))
|
||||
FatalError("failed to resize rootPixmap error path\n");
|
||||
|
||||
@@ -532,23 +554,29 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
|
||||
if (ms->ctx) {
|
||||
int j;
|
||||
|
||||
ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, &ms->fence[XORG_NR_FENCES-1]);
|
||||
ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE,
|
||||
ms->dirtyThrottling ?
|
||||
&ms->fence[XORG_NR_FENCES-1] :
|
||||
NULL);
|
||||
|
||||
if (ms->fence[0])
|
||||
ms->ctx->screen->fence_finish(ms->ctx->screen, ms->fence[0], 0);
|
||||
if (ms->dirtyThrottling) {
|
||||
if (ms->fence[0])
|
||||
ms->ctx->screen->fence_finish(ms->ctx->screen,
|
||||
ms->fence[0], 0);
|
||||
|
||||
/* The amount of rendering generated by a block handler can be
|
||||
* quite small. Let us get a fair way ahead of hardware before
|
||||
* throttling.
|
||||
*/
|
||||
for (j = 0; j < XORG_NR_FENCES - 1; j++)
|
||||
ms->screen->fence_reference(ms->screen,
|
||||
&ms->fence[j],
|
||||
ms->fence[j+1]);
|
||||
/* The amount of rendering generated by a block handler can be
|
||||
* quite small. Let us get a fair way ahead of hardware before
|
||||
* throttling.
|
||||
*/
|
||||
for (j = 0; j < XORG_NR_FENCES - 1; j++)
|
||||
ms->screen->fence_reference(ms->screen,
|
||||
&ms->fence[j],
|
||||
ms->fence[j+1]);
|
||||
|
||||
ms->screen->fence_reference(ms->screen,
|
||||
&ms->fence[XORG_NR_FENCES-1],
|
||||
NULL);
|
||||
ms->screen->fence_reference(ms->screen,
|
||||
&ms->fence[XORG_NR_FENCES-1],
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -632,6 +660,8 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
||||
unsigned max_width, max_height;
|
||||
VisualPtr visual;
|
||||
CustomizerPtr cust = ms->cust;
|
||||
MessageType from_st;
|
||||
MessageType from_dt;
|
||||
|
||||
if (!drv_init_drm(pScrn)) {
|
||||
FatalError("Could not init DRM");
|
||||
@@ -719,6 +749,19 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
||||
ms->accelerate_2d = xf86ReturnOptValBool(ms->Options, OPTION_2D_ACCEL, FALSE);
|
||||
ms->debug_fallback = xf86ReturnOptValBool(ms->Options, OPTION_DEBUG_FALLBACK, ms->accelerate_2d);
|
||||
|
||||
if (cust && cust->winsys_screen_init)
|
||||
cust->winsys_screen_init(cust, ms->fd);
|
||||
|
||||
ms->swapThrottling = cust ? cust->swap_throttling : TRUE;
|
||||
from_st = xf86GetOptValBool(ms->Options, OPTION_THROTTLE_SWAP,
|
||||
&ms->swapThrottling) ?
|
||||
X_CONFIG : X_DEFAULT;
|
||||
|
||||
ms->dirtyThrottling = cust ? cust->dirty_throttling : TRUE;
|
||||
from_dt = xf86GetOptValBool(ms->Options, OPTION_THROTTLE_DIRTY,
|
||||
&ms->dirtyThrottling) ?
|
||||
X_CONFIG : X_DEFAULT;
|
||||
|
||||
if (ms->screen) {
|
||||
ms->exa = xorg_exa_init(pScrn, ms->accelerate_2d);
|
||||
|
||||
@@ -743,6 +786,11 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
||||
#else
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is disabled\n");
|
||||
#endif
|
||||
xf86DrvMsg(pScrn->scrnIndex, from_st, "Swap Throttling is %s.\n",
|
||||
ms->swapThrottling ? "enabled" : "disabled");
|
||||
xf86DrvMsg(pScrn->scrnIndex, from_dt, "Dirty Throttling is %s.\n",
|
||||
ms->dirtyThrottling ? "enabled" : "disabled");
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "##################################\n");
|
||||
|
||||
miInitializeBackingStore(pScreen);
|
||||
@@ -775,9 +823,6 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
||||
if (serverGeneration == 1)
|
||||
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
|
||||
|
||||
if (cust && cust->winsys_screen_init)
|
||||
cust->winsys_screen_init(cust, ms->fd);
|
||||
|
||||
return drv_enter_vt(scrnIndex, 1);
|
||||
}
|
||||
|
||||
@@ -904,6 +949,11 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
|
||||
drv_leave_vt(scrnIndex, 0);
|
||||
}
|
||||
|
||||
if (ms->cursor) {
|
||||
FreeCursor(ms->cursor, None);
|
||||
ms->cursor = NULL;
|
||||
}
|
||||
|
||||
if (cust && cust->winsys_screen_close)
|
||||
cust->winsys_screen_close(cust);
|
||||
|
||||
@@ -955,7 +1005,7 @@ drv_destroy_front_buffer_ga3d(ScrnInfoPtr pScrn)
|
||||
{
|
||||
modesettingPtr ms = modesettingPTR(pScrn);
|
||||
|
||||
if (!ms->root_bo)
|
||||
if (!ms->root_texture)
|
||||
return TRUE;
|
||||
|
||||
if (ms->fb_id != -1) {
|
||||
|
||||
@@ -1035,6 +1035,7 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
|
||||
modesettingPtr ms = modesettingPTR(pScrn);
|
||||
struct exa_context *exa;
|
||||
ExaDriverPtr pExa;
|
||||
CustomizerPtr cust = ms->cust;
|
||||
|
||||
exa = xcalloc(1, sizeof(struct exa_context));
|
||||
if (!exa)
|
||||
@@ -1093,6 +1094,8 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
|
||||
exa->pipe = ms->api->create_context(ms->api, exa->scrn);
|
||||
/* Share context with DRI */
|
||||
ms->ctx = exa->pipe;
|
||||
if (cust && cust->winsys_context_throttle)
|
||||
cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_RENDER);
|
||||
|
||||
exa->renderer = renderer_create(exa->pipe);
|
||||
exa->accel = accel;
|
||||
|
||||
@@ -586,7 +586,7 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
|
||||
|
||||
|
||||
void renderer_draw_yuv(struct xorg_renderer *r,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
float src_x, float src_y, float src_w, float src_h,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
struct pipe_texture **textures)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ void renderer_set_constants(struct xorg_renderer *r,
|
||||
|
||||
|
||||
void renderer_draw_yuv(struct xorg_renderer *r,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
float src_x, float src_y, float src_w, float src_h,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h,
|
||||
struct pipe_texture **textures);
|
||||
|
||||
|
||||
@@ -65,12 +65,22 @@ typedef struct
|
||||
|
||||
#define XORG_NR_FENCES 3
|
||||
|
||||
enum xorg_throttling_reason {
|
||||
THROTTLE_RENDER,
|
||||
THROTTLE_SWAP
|
||||
};
|
||||
|
||||
typedef struct _CustomizerRec
|
||||
{
|
||||
Bool dirty_throttling;
|
||||
Bool swap_throttling;
|
||||
Bool (*winsys_screen_init)(struct _CustomizerRec *cust, int fd);
|
||||
Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
|
||||
Bool (*winsys_enter_vt)(struct _CustomizerRec *cust);
|
||||
Bool (*winsys_leave_vt)(struct _CustomizerRec *cust);
|
||||
void (*winsys_context_throttle)(struct _CustomizerRec *cust,
|
||||
struct pipe_context *pipe,
|
||||
enum xorg_throttling_reason reason);
|
||||
} CustomizerRec, *CustomizerPtr;
|
||||
|
||||
typedef struct _modesettingRec
|
||||
@@ -88,6 +98,9 @@ typedef struct _modesettingRec
|
||||
|
||||
Bool noAccel;
|
||||
Bool SWCursor;
|
||||
CursorPtr cursor;
|
||||
Bool swapThrottling;
|
||||
Bool dirtyThrottling;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
|
||||
/* Broken-out options. */
|
||||
|
||||
@@ -384,7 +384,7 @@ setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv)
|
||||
|
||||
static void
|
||||
draw_yuv(struct xorg_xv_port_priv *port,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
float src_x, float src_y, float src_w, float src_h,
|
||||
int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
struct pipe_texture **textures = port->yuv[port->current_set];
|
||||
@@ -533,10 +533,10 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
|
||||
int box_y2 = pbox->y2;
|
||||
float diff_x = (float)src_w / (float)dst_w;
|
||||
float diff_y = (float)src_h / (float)dst_h;
|
||||
int offset_x = box_x1 - dstX + pPixmap->screen_x;
|
||||
int offset_y = box_y1 - dstY + pPixmap->screen_y;
|
||||
int offset_w;
|
||||
int offset_h;
|
||||
float offset_x = box_x1 - dstX + pPixmap->screen_x;
|
||||
float offset_y = box_y1 - dstY + pPixmap->screen_y;
|
||||
float offset_w;
|
||||
float offset_h;
|
||||
|
||||
x = box_x1;
|
||||
y = box_y1;
|
||||
@@ -547,8 +547,8 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
|
||||
offset_h = dst_h - h;
|
||||
|
||||
draw_yuv(pPriv,
|
||||
src_x + offset_x*diff_x, src_y + offset_y*diff_y,
|
||||
src_w - offset_w*diff_x, src_h - offset_h*diff_y,
|
||||
(float) src_x + offset_x*diff_x, (float) src_y + offset_y*diff_y,
|
||||
(float) src_w - offset_w*diff_x, (float) src_h - offset_h*diff_y,
|
||||
x, y, w, h);
|
||||
|
||||
pbox++;
|
||||
|
||||
@@ -103,6 +103,9 @@ struct vmw_svga_winsys_context
|
||||
* referred.
|
||||
*/
|
||||
boolean preemptive_flush;
|
||||
|
||||
boolean throttle_set;
|
||||
uint32_t throttle_us;
|
||||
};
|
||||
|
||||
|
||||
@@ -122,6 +125,7 @@ vmw_swc_flush(struct svga_winsys_context *swc,
|
||||
struct pipe_fence_handle *fence = NULL;
|
||||
unsigned i;
|
||||
enum pipe_error ret;
|
||||
uint32_t throttle_us;
|
||||
|
||||
ret = pb_validate_validate(vswc->validate);
|
||||
assert(ret == PIPE_OK);
|
||||
@@ -140,8 +144,13 @@ vmw_swc_flush(struct svga_winsys_context *swc,
|
||||
*reloc->where = ptr;
|
||||
}
|
||||
|
||||
throttle_us = vswc->throttle_set ?
|
||||
vswc->throttle_us : vswc->vws->default_throttle_us;
|
||||
|
||||
if (vswc->command.used)
|
||||
vmw_ioctl_command(vswc->vws,
|
||||
vswc->base.cid,
|
||||
throttle_us,
|
||||
vswc->command.buffer,
|
||||
vswc->command.used,
|
||||
&vswc->last_fence);
|
||||
@@ -385,3 +394,14 @@ vmw_svga_context_create(struct pipe_screen *screen)
|
||||
{
|
||||
return svga_context_create(screen);
|
||||
}
|
||||
|
||||
void
|
||||
vmw_svga_context_set_throttling(struct pipe_context *pipe,
|
||||
uint32_t throttle_us)
|
||||
{
|
||||
struct svga_winsys_context *swc = svga_winsys_context(pipe);
|
||||
struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
|
||||
|
||||
vswc->throttle_us = throttle_us;
|
||||
vswc->throttle_set = TRUE;
|
||||
}
|
||||
|
||||
@@ -55,5 +55,8 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws);
|
||||
struct pipe_context *
|
||||
vmw_svga_context_create(struct pipe_screen *screen);
|
||||
|
||||
void
|
||||
vmw_svga_context_set_throttling(struct pipe_context *pipe,
|
||||
uint32_t throttle_us);
|
||||
|
||||
#endif /* VMW_CONTEXT_H_ */
|
||||
|
||||
@@ -75,3 +75,13 @@ vmw_winsys_destroy(struct vmw_winsys_screen *vws)
|
||||
vmw_ioctl_cleanup(vws);
|
||||
FREE(vws);
|
||||
}
|
||||
|
||||
void
|
||||
vmw_winsys_screen_set_throttling(struct pipe_screen *screen,
|
||||
uint32_t throttle_us)
|
||||
{
|
||||
struct vmw_winsys_screen *vws =
|
||||
vmw_winsys_screen(svga_winsys_screen(screen));
|
||||
|
||||
vws->default_throttle_us = throttle_us;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ struct vmw_winsys_screen
|
||||
struct svga_winsys_screen base;
|
||||
|
||||
boolean use_old_scanout_flag;
|
||||
uint32_t default_throttle_us;
|
||||
|
||||
struct {
|
||||
volatile uint32_t *fifo_map;
|
||||
@@ -96,9 +97,11 @@ vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws,
|
||||
|
||||
void
|
||||
vmw_ioctl_command(struct vmw_winsys_screen *vws,
|
||||
void *commands,
|
||||
uint32_t size,
|
||||
uint32_t *fence);
|
||||
int32_t cid,
|
||||
uint32_t throttle_us,
|
||||
void *commands,
|
||||
uint32_t size,
|
||||
uint32_t *fence);
|
||||
|
||||
struct vmw_region *
|
||||
vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size);
|
||||
@@ -135,6 +138,7 @@ void vmw_pools_cleanup(struct vmw_winsys_screen *vws);
|
||||
|
||||
struct vmw_winsys_screen *vmw_winsys_create(int fd, boolean use_old_scanout_flag);
|
||||
void vmw_winsys_destroy(struct vmw_winsys_screen *sws);
|
||||
|
||||
void vmw_winsys_screen_set_throttling(struct pipe_screen *screen,
|
||||
uint32_t throttle_us);
|
||||
|
||||
#endif /* VMW_SCREEN_H_ */
|
||||
|
||||
@@ -238,7 +238,7 @@ vmw_dri1_present_locked(struct pipe_context *locked_pipe,
|
||||
cmd.rect.y,
|
||||
cmd.rect.w, cmd.rect.h, cmd.rect.srcx, cmd.rect.srcy);
|
||||
|
||||
vmw_ioctl_command(vws, &cmd, sizeof cmd.header + cmd.header.size,
|
||||
vmw_ioctl_command(vws, -1, 0, &cmd, sizeof cmd.header + cmd.header.size,
|
||||
&fence_seq);
|
||||
visible = TRUE;
|
||||
}
|
||||
|
||||
@@ -241,8 +241,9 @@ vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, uint32 sid)
|
||||
}
|
||||
|
||||
void
|
||||
vmw_ioctl_command(struct vmw_winsys_screen *vws, void *commands, uint32_t size,
|
||||
uint32_t * pfence)
|
||||
vmw_ioctl_command(struct vmw_winsys_screen *vws, int32_t cid,
|
||||
uint32_t throttle_us, void *commands, uint32_t size,
|
||||
uint32_t *pfence)
|
||||
{
|
||||
struct drm_vmw_execbuf_arg arg;
|
||||
struct drm_vmw_fence_rep rep;
|
||||
@@ -275,6 +276,7 @@ vmw_ioctl_command(struct vmw_winsys_screen *vws, void *commands, uint32_t size,
|
||||
arg.fence_rep = (unsigned long)&rep;
|
||||
arg.commands = (unsigned long)commands;
|
||||
arg.command_size = size;
|
||||
arg.throttle_us = throttle_us;
|
||||
|
||||
do {
|
||||
ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg));
|
||||
|
||||
@@ -32,9 +32,14 @@
|
||||
|
||||
#include "vmw_hook.h"
|
||||
#include "vmw_driver.h"
|
||||
#include <pipe/p_context.h>
|
||||
|
||||
#include "cursorstr.h"
|
||||
|
||||
void vmw_winsys_screen_set_throttling(struct pipe_screen *screen,
|
||||
uint32_t throttle_us);
|
||||
|
||||
|
||||
/* modified version of crtc functions */
|
||||
xf86CrtcFuncsRec vmw_screen_crtc_funcs;
|
||||
|
||||
@@ -83,14 +88,55 @@ vmw_screen_cursor_close(struct vmw_customizer *vmw)
|
||||
config->crtc[i]->funcs = vmw->cursor_priv;
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_context_throttle(CustomizerPtr cust,
|
||||
struct pipe_context *pipe,
|
||||
enum xorg_throttling_reason reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case THROTTLE_RENDER:
|
||||
vmw_winsys_screen_set_throttling(pipe->screen, 20000);
|
||||
break;
|
||||
default:
|
||||
vmw_winsys_screen_set_throttling(pipe->screen, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_context_no_throttle(CustomizerPtr cust,
|
||||
struct pipe_context *pipe,
|
||||
enum xorg_throttling_reason reason)
|
||||
{
|
||||
vmw_winsys_screen_set_throttling(pipe->screen, 0);
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_screen_init(CustomizerPtr cust, int fd)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(cust);
|
||||
drmVersionPtr ver;
|
||||
|
||||
vmw->fd = fd;
|
||||
ver = drmGetVersion(fd);
|
||||
if (ver == NULL ||
|
||||
(ver->version_major == 1 && ver->version_minor < 1)) {
|
||||
cust->swap_throttling = TRUE;
|
||||
cust->dirty_throttling = TRUE;
|
||||
cust->winsys_context_throttle = vmw_context_no_throttle;
|
||||
} else {
|
||||
cust->swap_throttling = TRUE;
|
||||
cust->dirty_throttling = FALSE;
|
||||
cust->winsys_context_throttle = vmw_context_throttle;
|
||||
debug_printf("%s: Enabling kernel throttling.\n", __func__);
|
||||
}
|
||||
|
||||
if (ver)
|
||||
drmFreeVersion(ver);
|
||||
|
||||
vmw_screen_cursor_init(vmw);
|
||||
|
||||
|
||||
|
||||
/* if gallium is used then we don't need to do anything more. */
|
||||
if (xorg_has_gallium(vmw->pScrn))
|
||||
return TRUE;
|
||||
|
||||
@@ -385,7 +385,8 @@ CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
|
||||
req->glxwindow = (GLXWindow) XAllocID(dpy);
|
||||
req->numAttribs = (CARD32) i;
|
||||
|
||||
memcpy(data, attrib_list, 8 * i);
|
||||
if (attrib_list)
|
||||
memcpy(data, attrib_list, 8 * i);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
@@ -291,7 +291,8 @@ __glXInitVertexArrayState(__GLXcontext * gc)
|
||||
|
||||
arrays->stack_index = 0;
|
||||
arrays->stack = malloc(sizeof(struct array_stack_state)
|
||||
* arrays->num_arrays);
|
||||
* arrays->num_arrays
|
||||
* __GL_CLIENT_ATTRIB_STACK_DEPTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ void intel_flush_prim(struct intel_context *intel)
|
||||
BEGIN_BATCH(5, LOOP_CLIPRECTS);
|
||||
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
|
||||
I1_LOAD_S(0) | I1_LOAD_S(1) | 1);
|
||||
assert((offset & !S0_VB_OFFSET_MASK) == 0);
|
||||
assert((offset & ~S0_VB_OFFSET_MASK) == 0);
|
||||
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, offset);
|
||||
OUT_BATCH((intel->vertex_size << S1_VERTEX_WIDTH_SHIFT) |
|
||||
(intel->vertex_size << S1_VERTEX_PITCH_SHIFT));
|
||||
@@ -273,7 +273,7 @@ void intel_flush_prim(struct intel_context *intel)
|
||||
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
|
||||
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
|
||||
/* S0 */
|
||||
assert((offset & !S0_VB_OFFSET_MASK_830) == 0);
|
||||
assert((offset & ~S0_VB_OFFSET_MASK_830) == 0);
|
||||
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
|
||||
offset | (intel->vertex_size << S0_VB_PITCH_SHIFT_830) |
|
||||
S0_VB_ENABLE_830);
|
||||
|
||||
@@ -70,8 +70,10 @@
|
||||
|
||||
/** @{
|
||||
* 915 definitions
|
||||
*
|
||||
* 915 documents say that bits 31:28 and 1 are "undefined, must be zero."
|
||||
*/
|
||||
#define S0_VB_OFFSET_MASK 0xffffffc0
|
||||
#define S0_VB_OFFSET_MASK 0x0ffffffc
|
||||
#define S0_AUTO_CACHE_INV_DISABLE (1<<0)
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -193,7 +193,8 @@ void r200FlushElts(GLcontext *ctx)
|
||||
if (R200_ELT_BUF_SZ > elt_used)
|
||||
radeonReturnDmaRegion(&rmesa->radeon, R200_ELT_BUF_SZ - elt_used);
|
||||
|
||||
if (radeon_is_debug_enabled(RADEON_SYNC, RADEON_CRITICAL)) {
|
||||
if (radeon_is_debug_enabled(RADEON_SYNC, RADEON_CRITICAL)
|
||||
&& !rmesa->radeon.radeonScreen->kernel_mm) {
|
||||
radeon_print(RADEON_SYNC, RADEON_NORMAL, "%s: Syncing\n", __FUNCTION__);
|
||||
radeonFinish( rmesa->radeon.glCtx );
|
||||
}
|
||||
|
||||
@@ -405,8 +405,9 @@ static GLuint r200EnsureEmitSize( GLcontext * ctx , GLubyte* vimap_rev )
|
||||
rendering code may decide convert to elts.
|
||||
In that case we have to make pessimistic prediction.
|
||||
and use larger of 2 paths. */
|
||||
const GLuint elts = ELTS_BUFSZ(nr_aos);
|
||||
const GLuint index = INDEX_BUFSZ;
|
||||
const GLuint elt_count =(VB->Primitive[i].count/GET_MAX_HW_ELTS() + 1);
|
||||
const GLuint elts = ELTS_BUFSZ(nr_aos) * elt_count;
|
||||
const GLuint index = INDEX_BUFSZ * elt_count;
|
||||
const GLuint vbuf = VBUF_BUFSZ;
|
||||
if ( (!VB->Elts && VB->Primitive[i].count >= MAX_CONVERSION_SIZE)
|
||||
|| vbuf > index + elts)
|
||||
@@ -688,25 +689,34 @@ static char *getFallbackString(GLuint bit)
|
||||
|
||||
void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
|
||||
{
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx);
|
||||
GLuint oldfallback = rmesa->radeon.TclFallback;
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx);
|
||||
GLuint oldfallback = rmesa->radeon.TclFallback;
|
||||
|
||||
if (mode) {
|
||||
rmesa->radeon.TclFallback |= bit;
|
||||
if (oldfallback == 0) {
|
||||
if (R200_DEBUG & RADEON_FALLBACKS)
|
||||
fprintf(stderr, "R200 begin tcl fallback %s\n",
|
||||
getFallbackString( bit ));
|
||||
transition_to_swtnl( ctx );
|
||||
}
|
||||
}
|
||||
else {
|
||||
rmesa->radeon.TclFallback &= ~bit;
|
||||
if (oldfallback == bit) {
|
||||
if (R200_DEBUG & RADEON_FALLBACKS)
|
||||
fprintf(stderr, "R200 end tcl fallback %s\n",
|
||||
getFallbackString( bit ));
|
||||
transition_to_hwtnl( ctx );
|
||||
}
|
||||
}
|
||||
if (mode) {
|
||||
if (oldfallback == 0) {
|
||||
/* We have to flush before transition */
|
||||
if ( rmesa->radeon.dma.flush )
|
||||
rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
|
||||
|
||||
if (R200_DEBUG & RADEON_FALLBACKS)
|
||||
fprintf(stderr, "R200 begin tcl fallback %s\n",
|
||||
getFallbackString( bit ));
|
||||
rmesa->radeon.TclFallback |= bit;
|
||||
transition_to_swtnl( ctx );
|
||||
} else
|
||||
rmesa->radeon.TclFallback |= bit;
|
||||
} else {
|
||||
if (oldfallback == bit) {
|
||||
/* We have to flush before transition */
|
||||
if ( rmesa->radeon.dma.flush )
|
||||
rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
|
||||
|
||||
if (R200_DEBUG & RADEON_FALLBACKS)
|
||||
fprintf(stderr, "R200 end tcl fallback %s\n",
|
||||
getFallbackString( bit ));
|
||||
rmesa->radeon.TclFallback &= ~bit;
|
||||
transition_to_hwtnl( ctx );
|
||||
} else
|
||||
rmesa->radeon.TclFallback &= ~bit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,12 +794,14 @@ static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa
|
||||
R300_STATECHANGE(r300, ga_point_minmax);
|
||||
r300->hw.ga_point_minmax.cmd[1] &= ~R300_GA_POINT_MINMAX_MIN_MASK;
|
||||
r300->hw.ga_point_minmax.cmd[1] |= (GLuint)(ctx->Point.MinSize * 6.0);
|
||||
r300PointSize(ctx, ctx->Point.Size);
|
||||
break;
|
||||
case GL_POINT_SIZE_MAX:
|
||||
R300_STATECHANGE(r300, ga_point_minmax);
|
||||
r300->hw.ga_point_minmax.cmd[1] &= ~R300_GA_POINT_MINMAX_MAX_MASK;
|
||||
r300->hw.ga_point_minmax.cmd[1] |= (GLuint)(ctx->Point.MaxSize * 6.0)
|
||||
<< R300_GA_POINT_MINMAX_MAX_SHIFT;
|
||||
r300PointSize(ctx, ctx->Point.Size);
|
||||
break;
|
||||
case GL_POINT_DISTANCE_ATTENUATION:
|
||||
break;
|
||||
@@ -1762,8 +1764,6 @@ static void r300ResetHwState(r300ContextPtr r300)
|
||||
if (RADEON_DEBUG & RADEON_STATE)
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
|
||||
radeon_firevertices(&r300->radeon);
|
||||
|
||||
r300ColorMask(ctx,
|
||||
ctx->Color.ColorMask[RCOMP],
|
||||
ctx->Color.ColorMask[GCOMP],
|
||||
@@ -1984,23 +1984,6 @@ void r300UpdateShaders(r300ContextPtr rmesa)
|
||||
if (rmesa->options.hw_tcl_enabled) {
|
||||
struct r300_vertex_program *vp;
|
||||
|
||||
if (rmesa->radeon.NewGLState) {
|
||||
int i;
|
||||
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
|
||||
rmesa->temp_attrib[i] =
|
||||
TNL_CONTEXT(ctx)->vb.AttribPtr[i];
|
||||
TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
|
||||
&rmesa->dummy_attrib[i];
|
||||
}
|
||||
|
||||
_tnl_UpdateFixedFunctionProgram(ctx);
|
||||
|
||||
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
|
||||
TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
|
||||
rmesa->temp_attrib[i];
|
||||
}
|
||||
}
|
||||
|
||||
vp = r300SelectAndTranslateVertexShader(ctx);
|
||||
|
||||
r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, vp->error);
|
||||
|
||||
@@ -320,9 +320,12 @@ static void r600InitGLExtensions(GLcontext *ctx)
|
||||
_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
|
||||
}
|
||||
|
||||
/* XXX: RV740 only seems to report results from half of its DBs */
|
||||
if (r600->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV740)
|
||||
_mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
|
||||
/* RV740 had a broken pipe config prior to drm 1.32 */
|
||||
if (!r600->radeon.radeonScreen->kernel_mm) {
|
||||
if ((r600->radeon.dri.drmMinor < 32) &&
|
||||
(r600->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV740))
|
||||
_mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the device specific rendering context.
|
||||
|
||||
@@ -374,17 +374,11 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
|
||||
break;
|
||||
*/
|
||||
case MESA_FORMAT_RGB_DXT1: /* not supported yet */
|
||||
|
||||
break;
|
||||
case MESA_FORMAT_RGBA_DXT1: /* not supported yet */
|
||||
|
||||
break;
|
||||
case MESA_FORMAT_RGBA_DXT3: /* not supported yet */
|
||||
|
||||
break;
|
||||
case MESA_FORMAT_RGBA_DXT5: /* not supported yet */
|
||||
return GL_FALSE;
|
||||
|
||||
break;
|
||||
case MESA_FORMAT_RGBA_FLOAT32:
|
||||
SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_32_32_FLOAT,
|
||||
SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
|
||||
@@ -671,8 +665,8 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
|
||||
|
||||
t = radeon_tex_obj(tObj);
|
||||
|
||||
r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat);
|
||||
|
||||
if(!r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat))
|
||||
t->validated = GL_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -681,7 +675,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
|
||||
* \param rmesa Context pointer
|
||||
* \param t the r300 texture object
|
||||
*/
|
||||
static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *texObj)
|
||||
static GLboolean setup_hardware_state(context_t *rmesa, struct gl_texture_object *texObj)
|
||||
{
|
||||
radeonTexObj *t = radeon_tex_obj(texObj);
|
||||
const struct gl_texture_image *firstImage;
|
||||
@@ -690,15 +684,15 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
|
||||
if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled &&
|
||||
t->image_override &&
|
||||
t->bo)
|
||||
return;
|
||||
return GL_TRUE;
|
||||
|
||||
firstImage = t->base.Image[0][t->minLod];
|
||||
|
||||
if (!t->image_override) {
|
||||
if (!r600GetTexFormat(texObj, firstImage->TexFormat)) {
|
||||
radeon_error("unexpected texture format in %s\n",
|
||||
__FUNCTION__);
|
||||
return;
|
||||
radeon_warning("unsupported texture format in %s\n",
|
||||
__FUNCTION__);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +717,7 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
|
||||
break;
|
||||
default:
|
||||
radeon_error("unexpected texture target type in %s\n", __FUNCTION__);
|
||||
return;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
row_align = rmesa->radeon.texture_row_align - 1;
|
||||
@@ -749,6 +743,7 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
|
||||
SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask);
|
||||
SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask);
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -766,7 +761,8 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object
|
||||
|
||||
/* Configure the hardware registers (more precisely, the cached version
|
||||
* of the hardware registers). */
|
||||
setup_hardware_state(rmesa, texObj);
|
||||
if (!setup_hardware_state(rmesa, texObj))
|
||||
return GL_FALSE;
|
||||
|
||||
t->validated = GL_TRUE;
|
||||
return GL_TRUE;
|
||||
|
||||
@@ -815,11 +815,10 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
|
||||
|
||||
#if MESA_BIG_ENDIAN
|
||||
if (mesa_ind_buf->type == GL_UNSIGNED_INT)
|
||||
{
|
||||
#else
|
||||
if (mesa_ind_buf->type != GL_UNSIGNED_BYTE)
|
||||
{
|
||||
#endif
|
||||
{
|
||||
const GLvoid *src_ptr;
|
||||
GLvoid *dst_ptr;
|
||||
GLboolean mapped_named_bo = GL_FALSE;
|
||||
@@ -856,6 +855,14 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
|
||||
}
|
||||
}
|
||||
|
||||
static GLboolean check_fallbacks(GLcontext *ctx)
|
||||
{
|
||||
if (ctx->RenderMode != GL_RENDER)
|
||||
return GL_TRUE;
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static GLboolean r700TryDrawPrims(GLcontext *ctx,
|
||||
const struct gl_client_array *arrays[],
|
||||
const struct _mesa_prim *prim,
|
||||
@@ -872,6 +879,9 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx,
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state( ctx );
|
||||
|
||||
if (check_fallbacks(ctx))
|
||||
return GL_FALSE;
|
||||
|
||||
_tnl_UpdateFixedFunctionProgram(ctx);
|
||||
r700SetVertexFormat(ctx, arrays, max_index + 1);
|
||||
/* shaders need to be updated before buffers are validated */
|
||||
@@ -966,8 +976,10 @@ static void r700DrawPrims(GLcontext *ctx,
|
||||
retval = r700TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
|
||||
|
||||
/* If failed run tnl pipeline - it should take care of fallbacks */
|
||||
if (!retval)
|
||||
if (!retval) {
|
||||
_swsetup_Wakeup(ctx);
|
||||
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
|
||||
}
|
||||
}
|
||||
|
||||
void r700InitDraw(GLcontext *ctx)
|
||||
|
||||
@@ -616,7 +616,7 @@ static GLuint translate_logicop(GLenum logicop)
|
||||
case GL_XOR:
|
||||
return 0x66;
|
||||
case GL_EQUIV:
|
||||
return 0xaa;
|
||||
return 0x99;
|
||||
case GL_AND_REVERSE:
|
||||
return 0x44;
|
||||
case GL_AND_INVERTED:
|
||||
@@ -910,10 +910,12 @@ static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa
|
||||
case GL_POINT_SIZE_MIN:
|
||||
SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0),
|
||||
MIN_SIZE_shift, MIN_SIZE_mask);
|
||||
r700PointSize(ctx, ctx->Point.Size);
|
||||
break;
|
||||
case GL_POINT_SIZE_MAX:
|
||||
SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0),
|
||||
MAX_SIZE_shift, MAX_SIZE_mask);
|
||||
r700PointSize(ctx, ctx->Point.Size);
|
||||
break;
|
||||
case GL_POINT_DISTANCE_ATTENUATION:
|
||||
break;
|
||||
@@ -1625,8 +1627,6 @@ void r700InitState(GLcontext * ctx) //-------------------
|
||||
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
|
||||
int id = 0;
|
||||
|
||||
radeon_firevertices(&context->radeon);
|
||||
|
||||
r700->TA_CNTL_AUX.u32All = 0;
|
||||
SETfield(r700->TA_CNTL_AUX.u32All, 28, TD_FIFO_CREDIT_shift, TD_FIFO_CREDIT_mask);
|
||||
r700->VC_ENHANCE.u32All = 0;
|
||||
|
||||
@@ -340,6 +340,7 @@
|
||||
#define PCI_CHIP_RS880_9712 0x9712
|
||||
#define PCI_CHIP_RS880_9713 0x9713
|
||||
#define PCI_CHIP_RS880_9714 0x9714
|
||||
#define PCI_CHIP_RS880_9715 0x9715
|
||||
|
||||
#define PCI_CHIP_RV770_9440 0x9440
|
||||
#define PCI_CHIP_RV770_9441 0x9441
|
||||
|
||||
@@ -828,6 +828,7 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
|
||||
case PCI_CHIP_RS880_9712:
|
||||
case PCI_CHIP_RS880_9713:
|
||||
case PCI_CHIP_RS880_9714:
|
||||
case PCI_CHIP_RS880_9715:
|
||||
screen->chip_family = CHIP_FAMILY_RS880;
|
||||
screen->chip_flags = RADEON_CHIPSET_TCL;
|
||||
break;
|
||||
|
||||
@@ -45,6 +45,18 @@ static const struct {
|
||||
const char *name;
|
||||
int flag_offset;
|
||||
} default_extensions[] = {
|
||||
/*
|
||||
* TODO: Sort by year, to ensure that old extensions are listed first, so
|
||||
* that old applications that truncate the extension string get the basic
|
||||
* extensions, roughly corresponding to what existed then.
|
||||
*
|
||||
* The best example is quake3demo, which often misses
|
||||
* GL_EXT_compiled_vertex_array because it gets truncated.
|
||||
*/
|
||||
{ ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
|
||||
{ OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
|
||||
{ OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
|
||||
|
||||
{ OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) },
|
||||
{ OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) },
|
||||
{ OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) },
|
||||
@@ -99,7 +111,6 @@ static const struct {
|
||||
{ OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) },
|
||||
{ OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) },
|
||||
{ OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) },
|
||||
{ ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
|
||||
{ OFF, "GL_EXT_convolution", F(EXT_convolution) },
|
||||
{ ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
|
||||
{ OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
|
||||
@@ -128,10 +139,8 @@ static const struct {
|
||||
{ ON, "GL_EXT_subtexture", F(EXT_subtexture) },
|
||||
{ ON, "GL_EXT_texture", F(EXT_texture) },
|
||||
{ ON, "GL_EXT_texture3D", F(EXT_texture3D) },
|
||||
{ OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
|
||||
{ OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) },
|
||||
{ ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
|
||||
{ OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
|
||||
{ OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) },
|
||||
{ OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) },
|
||||
{ OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) },
|
||||
|
||||
@@ -1142,7 +1142,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
|
||||
rb->Width = width;
|
||||
rb->Height = height;
|
||||
rb->_BaseFormat = _mesa_base_fbo_format(ctx, rb->InternalFormat);
|
||||
rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
|
||||
ASSERT(rb->_BaseFormat);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -499,21 +499,24 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
|
||||
if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) {
|
||||
trb->Base.Format = MESA_FORMAT_Z24_S8;
|
||||
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||
trb->Base._BaseFormat = GL_DEPTH_STENCIL;
|
||||
}
|
||||
else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) {
|
||||
trb->Base.Format = MESA_FORMAT_Z16;
|
||||
trb->Base.DataType = GL_UNSIGNED_SHORT;
|
||||
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
}
|
||||
else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) {
|
||||
trb->Base.Format = MESA_FORMAT_Z32;
|
||||
trb->Base.DataType = GL_UNSIGNED_INT;
|
||||
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
}
|
||||
else {
|
||||
trb->Base.Format = trb->TexImage->TexFormat;
|
||||
trb->Base.DataType = CHAN_TYPE;
|
||||
trb->Base._BaseFormat = GL_RGBA;
|
||||
}
|
||||
trb->Base.Data = trb->TexImage->Data;
|
||||
trb->Base._BaseFormat = _mesa_base_fbo_format(ctx, trb->Base.InternalFormat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define MESA_MAJOR 7
|
||||
#define MESA_MINOR 7
|
||||
#define MESA_PATCH 1
|
||||
#define MESA_VERSION_STRING "7.7.1-DEVEL"
|
||||
#define MESA_VERSION_STRING "7.7.1-rc2"
|
||||
|
||||
/* To make version comparison easy */
|
||||
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
||||
|
||||
@@ -434,7 +434,7 @@ make_texture(struct st_context *st,
|
||||
|
||||
/**
|
||||
* Draw quad with texcoords and optional color.
|
||||
* Coords are window coords with y=0=bottom.
|
||||
* Coords are gallium window coords with y=0=top.
|
||||
* \param color may be null
|
||||
* \param invertTex if true, flip texcoords vertically
|
||||
*/
|
||||
@@ -621,10 +621,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
||||
pipe->set_sampler_textures(pipe, 1, &pt);
|
||||
}
|
||||
|
||||
/* Compute window coords (y=0=bottom) with pixel zoom.
|
||||
/* Compute Gallium window coords (y=0=top) with pixel zoom.
|
||||
* Recall that these coords are transformed by the current
|
||||
* vertex shader and viewport transformation.
|
||||
*/
|
||||
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) {
|
||||
y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY);
|
||||
invertTex = !invertTex;
|
||||
}
|
||||
|
||||
x0 = (GLfloat) x;
|
||||
x1 = x + width * ctx->Pixel.ZoomX;
|
||||
y0 = (GLfloat) y;
|
||||
@@ -963,6 +968,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
GLfloat *color;
|
||||
enum pipe_format srcFormat, texFormat;
|
||||
int ptw, pth;
|
||||
GLboolean invertTex = GL_FALSE;
|
||||
|
||||
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
|
||||
|
||||
@@ -1038,8 +1044,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
}
|
||||
}
|
||||
|
||||
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
|
||||
srcy = ctx->DrawBuffer->Height - srcy - height;
|
||||
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
||||
srcy = ctx->ReadBuffer->Height - srcy - height;
|
||||
|
||||
if (srcy < 0) {
|
||||
height -= -srcy;
|
||||
@@ -1048,6 +1054,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
|
||||
if (height < 0)
|
||||
return;
|
||||
|
||||
invertTex = !invertTex;
|
||||
}
|
||||
|
||||
/* Need to use POT texture? */
|
||||
@@ -1077,7 +1085,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
if (!pt)
|
||||
return;
|
||||
|
||||
|
||||
/* Make temporary texture which is a copy of the src region.
|
||||
* We'll draw a quad with this texture to draw the dest image.
|
||||
*/
|
||||
if (srcFormat == texFormat) {
|
||||
/* copy source framebuffer surface into mipmap/texture */
|
||||
struct pipe_surface *psRead = screen->get_tex_surface(screen,
|
||||
@@ -1098,6 +1108,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
psRead,
|
||||
srcx, srcy, width, height);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
/* debug */
|
||||
debug_dump_surface("copypixsrcsurf", psRead);
|
||||
debug_dump_surface("copypixtemptex", psTex);
|
||||
}
|
||||
|
||||
pipe_surface_reference(&psRead, NULL);
|
||||
pipe_surface_reference(&psTex, NULL);
|
||||
}
|
||||
@@ -1145,7 +1162,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
/* draw textured quad */
|
||||
draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
|
||||
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
|
||||
pt, stvp, stfp, color, GL_TRUE);
|
||||
pt, stvp, stfp, color, invertTex);
|
||||
|
||||
pipe_texture_reference(&pt, NULL);
|
||||
}
|
||||
|
||||
@@ -420,17 +420,12 @@ st_finish_render_texture(GLcontext *ctx,
|
||||
|
||||
st_flush( ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL );
|
||||
|
||||
if (strb->surface)
|
||||
pipe_surface_reference( &strb->surface, NULL );
|
||||
|
||||
strb->rtt = NULL;
|
||||
|
||||
/*
|
||||
printf("FINISH RENDER TO TEXTURE surf=%p\n", strb->surface);
|
||||
*/
|
||||
|
||||
_mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
|
||||
|
||||
/* restore previous framebuffer state */
|
||||
st_invalidate_state(ctx, _NEW_BUFFERS);
|
||||
}
|
||||
|
||||
@@ -863,6 +863,8 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
|
||||
|
||||
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
|
||||
|
||||
screen->tex_transfer_destroy(tex_xfer);
|
||||
|
||||
/* destroy the temp / dest surface */
|
||||
util_destroy_rgba_surface(dst_texture, dst_surface);
|
||||
}
|
||||
|
||||
@@ -166,35 +166,31 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
|
||||
uint surfIndex, struct pipe_surface *surf)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
static const GLuint invalid_size = 9999999;
|
||||
struct st_renderbuffer *strb;
|
||||
GLuint width, height, i;
|
||||
|
||||
/* sanity checks */
|
||||
assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT);
|
||||
assert(ST_SURFACE_BACK_LEFT == BUFFER_BACK_LEFT);
|
||||
assert(ST_SURFACE_FRONT_RIGHT == BUFFER_FRONT_RIGHT);
|
||||
assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT);
|
||||
/* XXX The current values are wrong but fixing this causes new bugs*/
|
||||
/* assert(ST_SURFACE_DEPTH == BUFFER_DEPTH); */
|
||||
assert(ST_SURFACE_DEPTH == BUFFER_DEPTH);
|
||||
|
||||
assert(surfIndex < BUFFER_COUNT);
|
||||
|
||||
strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
|
||||
|
||||
if (!strb) {
|
||||
if (surfIndex == ST_SURFACE_FRONT_LEFT) {
|
||||
/* Delayed creation when the window system supplies a fake front buffer */
|
||||
struct st_renderbuffer *strb_back
|
||||
= st_renderbuffer(stfb->Base.Attachment[ST_SURFACE_BACK_LEFT].Renderbuffer);
|
||||
struct gl_renderbuffer *rb
|
||||
= st_new_renderbuffer_fb(surf->format, strb_back->Base.NumSamples, FALSE);
|
||||
_mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
|
||||
strb = st_renderbuffer(rb);
|
||||
} else {
|
||||
/* fail */
|
||||
/* create new renderbuffer for this surface now */
|
||||
const GLuint numSamples = stfb->Base.Visual.samples;
|
||||
struct gl_renderbuffer *rb =
|
||||
st_new_renderbuffer_fb(surf->format, numSamples, FALSE);
|
||||
if (!rb) {
|
||||
/* out of memory */
|
||||
_mesa_warning(ctx, "Out of memory allocating renderbuffer");
|
||||
return;
|
||||
}
|
||||
_mesa_add_renderbuffer(&stfb->Base, surfIndex, rb);
|
||||
strb = st_renderbuffer(rb);
|
||||
}
|
||||
|
||||
/* replace the renderbuffer's surface/texture pointers */
|
||||
@@ -206,39 +202,16 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
|
||||
* But when we do, we need to start setting this dirty bit
|
||||
* to ensure the renderbuffer attachements are up-to-date
|
||||
* via update_framebuffer.
|
||||
* Core Mesa's state validation will update the parent framebuffer's
|
||||
* size info, etc.
|
||||
*/
|
||||
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
|
||||
ctx->NewState |= _NEW_BUFFERS;
|
||||
}
|
||||
|
||||
/* update renderbuffer's width/height */
|
||||
strb->Base.Width = surf->width;
|
||||
strb->Base.Height = surf->height;
|
||||
|
||||
/* Try to update the framebuffer's width/height from the renderbuffer
|
||||
* sizes. Before we start drawing, all the rbs _should_ be the same size.
|
||||
*/
|
||||
width = height = invalid_size;
|
||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||
if (stfb->Base.Attachment[i].Renderbuffer) {
|
||||
if (width == invalid_size) {
|
||||
width = stfb->Base.Attachment[i].Renderbuffer->Width;
|
||||
height = stfb->Base.Attachment[i].Renderbuffer->Height;
|
||||
}
|
||||
else if (width != stfb->Base.Attachment[i].Renderbuffer->Width ||
|
||||
height != stfb->Base.Attachment[i].Renderbuffer->Height) {
|
||||
/* inconsistant renderbuffer sizes, bail out */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (width != invalid_size) {
|
||||
/* OK, the renderbuffers are of a consistant size, so update the
|
||||
* parent framebuffer's size.
|
||||
*/
|
||||
stfb->Base.Width = width;
|
||||
stfb->Base.Height = height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
#define ST_SURFACE_BACK_LEFT 1
|
||||
#define ST_SURFACE_FRONT_RIGHT 2
|
||||
#define ST_SURFACE_BACK_RIGHT 3
|
||||
/* XXX This value is wrong but fixing this causes other bugs */
|
||||
#define ST_SURFACE_DEPTH 8
|
||||
#define ST_SURFACE_DEPTH 4
|
||||
|
||||
#define ST_TEXTURE_2D 0x2
|
||||
#define ST_TEXTURE_RECT 0x4
|
||||
|
||||
@@ -196,7 +196,7 @@ flush( struct copy_context *copy )
|
||||
©->dstib,
|
||||
GL_TRUE,
|
||||
0,
|
||||
copy->dstbuf_nr );
|
||||
copy->dstbuf_nr - 1 );
|
||||
|
||||
/* Reset all pointers:
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user