summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-05-21 20:02:22 +0200
committerRoland Scheidegger <[email protected]>2010-05-21 20:02:22 +0200
commit3293bcdc80cdfa20a2381aae2b94505bdf95d857 (patch)
tree16ab1ae66010f6d8b1325dbfa9006126a8e95771 /src/gallium/state_trackers/dri
parent8504c5d931e47765a15fdaec2df2cb6502a1bd5c (diff)
parentce65caba846b03b5ef4144e311b85cfd48ab9bbb (diff)
Merge branch 'gallium-msaa'
Conflicts: src/mesa/state_tracker/st_gen_mipmap.c src/mesa/state_tracker/st_texture.c
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r--src/gallium/state_trackers/dri/common/dri1_helper.c2
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c65
-rw-r--r--src/gallium/state_trackers/dri/drm/dri1.c26
3 files changed, 61 insertions, 32 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri1_helper.c b/src/gallium/state_trackers/dri/common/dri1_helper.c
index f641b41ff8b..ad6c7d37504 100644
--- a/src/gallium/state_trackers/dri/common/dri1_helper.c
+++ b/src/gallium/state_trackers/dri/common/dri1_helper.c
@@ -93,7 +93,7 @@ dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex)
pipe_surface_reference(&drawable->dri1_surface, NULL);
drawable->dri1_surface = pipe_screen->get_tex_surface(pipe_screen,
- ptex, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
+ ptex, 0, 0, 0, 0/* no bind flag???*/);
psurf = drawable->dri1_surface;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 064c73f54c2..81523b82ba9 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -72,13 +72,13 @@ dri_fill_in_modes(struct dri_screen *screen,
__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];
- uint8_t msaa_samples_array[2];
+ uint8_t msaa_samples_array[5];
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
unsigned msaa_samples_factor;
+ unsigned i;
struct pipe_screen *p_screen = screen->base.screen;
boolean pf_r5g6b5, pf_a8r8g8b8, pf_x8r8g8b8;
boolean pf_z16, pf_x8z24, pf_z24x8, pf_s8z24, pf_z24s8, pf_z32;
@@ -92,34 +92,34 @@ dri_fill_in_modes(struct dri_screen *screen,
depth_buffer_factor = 1;
pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0);
pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0);
pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0);
pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0);
pf_a8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET, 0);
pf_x8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET, 0);
pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET, 0);
/* We can only get a 16 or 32 bit depth buffer with getBuffersWithFormat */
if (dri_with_format(screen->sPriv)) {
pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0);
pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0);
} else {
pf_z16 = FALSE;
@@ -146,22 +146,39 @@ dri_fill_in_modes(struct dri_screen *screen,
}
msaa_samples_array[0] = 0;
- msaa_samples_array[1] = 4;
back_buffer_factor = 3;
- msaa_samples_factor = 2;
- num_modes =
- depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
+ /* also test color for msaa 2/4/6/8 - just assume it'll work for all depth buffers */
+ if (pf_r5g6b5) {
+ msaa_samples_factor = 1;
+ for (i = 1; i < 5; i++) {
+ if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_TEXTURE_2D, i*2,
+ PIPE_BIND_RENDER_TARGET, 0)) {
+ msaa_samples_array[msaa_samples_factor] = i * 2;
+ msaa_samples_factor++;
+ }
+ }
- 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, msaa_samples_factor,
GL_TRUE);
+ }
+
+ if (pf_a8r8g8b8) {
+ msaa_samples_factor = 1;
+ for (i = 1; i < 5; i++) {
+ if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_TEXTURE_2D, i*2,
+ PIPE_BIND_RENDER_TARGET, 0)) {
+ msaa_samples_array[msaa_samples_factor] = i * 2;
+ msaa_samples_factor++;
+ }
+ }
- if (pf_a8r8g8b8)
configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array,
stencil_bits_array,
@@ -171,8 +188,19 @@ dri_fill_in_modes(struct dri_screen *screen,
msaa_samples_array,
msaa_samples_factor,
GL_TRUE);
+ }
+
+ if (pf_x8r8g8b8) {
+ msaa_samples_factor = 1;
+ for (i = 1; i < 5; i++) {
+ if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM,
+ PIPE_TEXTURE_2D, i*2,
+ PIPE_BIND_RENDER_TARGET, 0)) {
+ msaa_samples_array[msaa_samples_factor] = i * 2;
+ msaa_samples_factor++;
+ }
+ }
- if (pf_x8r8g8b8)
configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array,
stencil_bits_array,
@@ -182,6 +210,7 @@ dri_fill_in_modes(struct dri_screen *screen,
msaa_samples_array,
msaa_samples_factor,
GL_TRUE);
+ }
if (pixel_bits == 16) {
configs = configs_r5g6b5;
diff --git a/src/gallium/state_trackers/dri/drm/dri1.c b/src/gallium/state_trackers/dri/drm/dri1.c
index 326ff8bcada..9f0b9257312 100644
--- a/src/gallium/state_trackers/dri/drm/dri1.c
+++ b/src/gallium/state_trackers/dri/drm/dri1.c
@@ -156,24 +156,22 @@ dri1_swap_copy(struct pipe_context *pipe,
struct drm_clip_rect clip;
struct drm_clip_rect *cur;
int i;
+ struct pipe_subresource subdst, subsrc;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ subdst.face = 0;
+ subdst.level = 0;
cur = dPriv->pClipRects;
for (i = 0; i < dPriv->numClipRects; ++i) {
if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) {
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
- src,
- (int)clip.x1 - dPriv->x,
- (int)clip.y1 - dPriv->y,
- clip.x2 - clip.x1, clip.y2 - clip.y1);
- } else {
- util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1,
- src,
- (int)clip.x1 - dPriv->x,
- (int)clip.y1 - dPriv->y,
- clip.x2 - clip.x1, clip.y2 - clip.y1);
- }
+ pipe->resource_copy_region(pipe, dst->texture, subdst,
+ clip.x1, clip.y1, 0,
+ src->texture, subsrc,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y, 0,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
}
}
}
@@ -204,6 +202,8 @@ dri1_present_texture_locked(__DRIdrawable * dPriv,
return;
pipe = dri1_get_pipe_context(screen);
+ /* XXX should probably use resources instead of surfaces in the api
+ - we get surface but only use the texture from it it seems... */
psurf = dri1_get_pipe_surface(drawable, ptex);
if (!pipe || !psurf)
return;