summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/radeon
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_pixel_read.c42
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_queryobj.c2
4 files changed, 36 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index 19df62742e..93219e40af 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -14,6 +14,7 @@ endif
RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
+ radeon_buffer_objects.c \
radeon_common_context.c \
radeon_common.c \
radeon_cs_legacy.c \
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 07f7cba354..b0340cee21 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -363,6 +363,9 @@ GLboolean radeonUnbindContext(__DRIcontext * driContextPriv)
fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
radeon->glCtx);
+ /* Unset current context and dispath table */
+ _mesa_make_current(NULL, NULL, NULL);
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
index fb741173ca..216eb932db 100644
--- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
+++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
@@ -32,6 +32,7 @@
#include "main/state.h"
#include "swrast/swrast.h"
+#include "radeon_buffer_objects.h"
#include "radeon_common_context.h"
#include "radeon_debug.h"
#include "radeon_mipmap_tree.h"
@@ -96,6 +97,7 @@ do_blit_readpixels(GLcontext * ctx,
unsigned dst_rowstride, dst_imagesize, aligned_rowstride, flip_y;
struct radeon_bo *dst_buffer;
GLint dst_x = 0, dst_y = 0;
+ intptr_t dst_offset;
/* It's not worth if number of pixels to copy is really small */
if (width * height < 100) {
@@ -127,10 +129,23 @@ do_blit_readpixels(GLcontext * ctx,
assert(x >= 0 && y >= 0);
aligned_rowstride = get_texture_image_row_stride(radeon, dst_format, dst_rowstride, 0);
+ dst_rowstride *= _mesa_get_format_bytes(dst_format);
+ if (_mesa_is_bufferobj(pack->BufferObj) && aligned_rowstride != dst_rowstride)
+ return GL_FALSE;
dst_imagesize = get_texture_image_size(dst_format,
aligned_rowstride,
height, 1, 0);
- dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
+
+ if (!_mesa_is_bufferobj(pack->BufferObj))
+ {
+ dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
+ dst_offset = 0;
+ }
+ else
+ {
+ dst_buffer = get_radeon_buffer_object(pack->BufferObj)->bo;
+ dst_offset = (intptr_t)pixels;
+ }
/* Disable source Y flipping for FBOs */
flip_y = (ctx->ReadBuffer->Name == 0);
@@ -149,7 +164,7 @@ do_blit_readpixels(GLcontext * ctx,
x,
y,
dst_buffer,
- 0, /* dst_offset */
+ dst_offset,
dst_format,
aligned_rowstride / _mesa_get_format_bytes(dst_format),
width,
@@ -160,17 +175,22 @@ do_blit_readpixels(GLcontext * ctx,
height,
flip_y))
{
- radeon_bo_map(dst_buffer, 0);
- dst_rowstride *= _mesa_get_format_bytes(dst_format);
- copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
- aligned_rowstride, height, dst_rowstride);
- radeon_bo_unmap(dst_buffer);
- radeon_bo_unref(dst_buffer);
+ if (!_mesa_is_bufferobj(pack->BufferObj))
+ {
+ radeon_bo_map(dst_buffer, 0);
+ copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
+ aligned_rowstride, height, dst_rowstride);
+ radeon_bo_unmap(dst_buffer);
+ radeon_bo_unref(dst_buffer);
+ }
+
return GL_TRUE;
- } else {
- radeon_bo_unref(dst_buffer);
- return GL_FALSE;
}
+
+ if (!_mesa_is_bufferobj(pack->BufferObj))
+ radeon_bo_unref(dst_buffer);
+
+ return GL_FALSE;
}
void
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index ab6d02e56b..5b7178bcca 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -56,7 +56,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
* hw writes zpass end counts to qwords 1, 3, 5, 7.
* then we substract. MSB is the valid bit.
*/
- for (i = 0; i < 16; i += 4) {
+ for (i = 0; i < 32; i += 4) {
uint64_t start = (uint64_t)LE32_TO_CPU(result[i]) |
(uint64_t)LE32_TO_CPU(result[i + 1]) << 32;
uint64_t end = (uint64_t)LE32_TO_CPU(result[i + 2]) |