Hey! > >I recently upgraded a PowerPC machine to Debian testing and OpenGL no > >more works. [...] > The problem is actually in Mesa, see > https://bugs.freedesktop.org/show_bug.cgi?id=71789 . Same here; there is a debian bug entry too[1] and there are some patches with rather crude fixes somewhere in the discussion list[2] linked from the freedesktop bugtracker. (I attached the patches I use to rebuild mesa and make Jessie at least kind of useable on older ppc; speedwise my iMac still feels about two times slower than with Wheezy). >From what I have read, there are some architectural changes to support big endian architectures already in the freedesktop git repo, but adapting the drivers (r300) to make use of those is still in the works. So, for sure this will not make it into Jessie. btw. do you also experience issues with iceweasel (and icedove)[3]?
-- Adi [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=746272 [2] http://lists.freedesktop.org/archives/mesa-dev/2013-December/050218.html [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763900
>From b3c5896e87036bdfd744e3b1b768a58c3e38ac2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daen...@amd.com> Date: Mon, 25 Nov 2013 10:13:42 +0900 Subject: [PATCH 1/2] st/dri: Use packed RGB formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michel Dänzer <michel.daen...@amd.com> --- src/gallium/state_trackers/dri/common/dri_drawable.c | 8 ++++---- src/gallium/state_trackers/dri/drm/dri2.c | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) Index: mesa-10.1.1/src/gallium/state_trackers/dri/common/dri_drawable.c =================================================================== --- mesa-10.1.1.orig/src/gallium/state_trackers/dri/common/dri_drawable.c 2014-05-02 10:11:15.327163064 +0200 +++ mesa-10.1.1/src/gallium/state_trackers/dri/common/dri_drawable.c 2014-05-02 10:11:15.305162415 +0200 @@ -231,11 +231,11 @@ if (format == __DRI_TEXTURE_FORMAT_RGB) { /* only need to cover the formats recognized by dri_fill_st_visual */ switch (internal_format) { - case PIPE_FORMAT_B8G8R8A8_UNORM: - internal_format = PIPE_FORMAT_B8G8R8X8_UNORM; + case PIPE_FORMAT_BGRA8888_UNORM: + internal_format = PIPE_FORMAT_BGRX8888_UNORM; break; - case PIPE_FORMAT_A8R8G8B8_UNORM: - internal_format = PIPE_FORMAT_X8R8G8B8_UNORM; + case PIPE_FORMAT_ARGB8888_UNORM: + internal_format = PIPE_FORMAT_XRGB8888_UNORM; break; default: break; Index: mesa-10.1.1/src/gallium/state_trackers/dri/drm/dri2.c =================================================================== --- mesa-10.1.1.orig/src/gallium/state_trackers/dri/drm/dri2.c 2014-05-02 10:11:15.327163064 +0200 +++ mesa-10.1.1/src/gallium/state_trackers/dri/drm/dri2.c 2014-05-02 10:11:15.308162504 +0200 @@ -129,10 +129,10 @@ * may occur as the stvis->color_format. */ switch(format) { - case PIPE_FORMAT_B8G8R8A8_UNORM: + case PIPE_FORMAT_BGRA8888_UNORM: depth = 32; break; - case PIPE_FORMAT_B8G8R8X8_UNORM: + case PIPE_FORMAT_BGRX8888_UNORM: depth = 24; break; case PIPE_FORMAT_B5G6R5_UNORM: @@ -403,10 +403,10 @@ switch (format) { case 32: - pf = PIPE_FORMAT_B8G8R8A8_UNORM; + pf = PIPE_FORMAT_BGRA8888_UNORM; break; case 24: - pf = PIPE_FORMAT_B8G8R8X8_UNORM; + pf = PIPE_FORMAT_BGRX8888_UNORM; break; case 16: pf = PIPE_FORMAT_Z16_UNORM; @@ -549,13 +549,13 @@ pf = PIPE_FORMAT_B5G6R5_UNORM; break; case __DRI_IMAGE_FORMAT_XRGB8888: - pf = PIPE_FORMAT_B8G8R8X8_UNORM; + pf = PIPE_FORMAT_BGRX8888_UNORM; break; case __DRI_IMAGE_FORMAT_ARGB8888: - pf = PIPE_FORMAT_B8G8R8A8_UNORM; + pf = PIPE_FORMAT_BGRA8888_UNORM; break; case __DRI_IMAGE_FORMAT_ABGR8888: - pf = PIPE_FORMAT_R8G8B8A8_UNORM; + pf = PIPE_FORMAT_RGBA8888_UNORM; break; default: pf = PIPE_FORMAT_NONE; @@ -670,13 +670,13 @@ pf = PIPE_FORMAT_B5G6R5_UNORM; break; case __DRI_IMAGE_FORMAT_XRGB8888: - pf = PIPE_FORMAT_B8G8R8X8_UNORM; + pf = PIPE_FORMAT_BGRX8888_UNORM; break; case __DRI_IMAGE_FORMAT_ARGB8888: - pf = PIPE_FORMAT_B8G8R8A8_UNORM; + pf = PIPE_FORMAT_BGRA8888_UNORM; break; case __DRI_IMAGE_FORMAT_ABGR8888: - pf = PIPE_FORMAT_R8G8B8A8_UNORM; + pf = PIPE_FORMAT_RGBA8888_UNORM; break; default: pf = PIPE_FORMAT_NONE;
>From d159715c15cd8ce40bdc1e3386d84cc38576f43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daen...@amd.com> Date: Tue, 26 Nov 2013 19:46:55 +0900 Subject: [PATCH 2/2] r300g: Big endian fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michel Dänzer <michel.daen...@amd.com> --- src/gallium/drivers/r300/r300_blit.c | 4 ++- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_state.c | 20 +++++++++--- src/gallium/drivers/r300/r300_state_derived.c | 15 +++++---- src/gallium/drivers/r300/r300_texture.c | 44 +++++++++++++++++++++++++-- src/gallium/drivers/r300/r300_texture.h | 3 ++ src/gallium/drivers/r300/r300_transfer.c | 6 ++-- 7 files changed, 77 insertions(+), 17 deletions(-) Index: mesa-10.1.1/src/gallium/drivers/r300/r300_blit.c =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_blit.c 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_blit.c 2014-05-02 10:11:15.410165510 +0200 @@ -185,7 +185,9 @@ union util_color uc; memset(&uc, 0, sizeof(uc)); - util_pack_color(color->f, fb->cbufs[0]->format, &uc); + util_pack_color(color->f, + r300_get_hw_format(fb->cbufs[0]->format, PIPE_BIND_RENDER_TARGET), + &uc); if (fb->cbufs[0]->format == PIPE_FORMAT_R16G16B16A16_FLOAT || fb->cbufs[0]->format == PIPE_FORMAT_R16G16B16X16_FLOAT) { Index: mesa-10.1.1/src/gallium/drivers/r300/r300_context.h =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_context.h 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_context.h 2014-05-02 10:11:15.412165568 +0200 @@ -45,6 +45,8 @@ struct r300_stencilref_context; enum colormask_swizzle { + COLORMASK_ARGB, + COLORMASK_XRGB, COLORMASK_BGRA, COLORMASK_RGBA, COLORMASK_RRRR, Index: mesa-10.1.1/src/gallium/drivers/r300/r300_state.c =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_state.c 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_state.c 2014-05-02 10:11:15.417165716 +0200 @@ -225,6 +225,12 @@ /* The hardware colormask is clunky a must be swizzled depending on the format. * This was figured out by trial-and-error. */ +static unsigned argb_cmask(unsigned mask) +{ + return ((mask & (PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B)) << 1) | + ((mask & PIPE_MASK_A) >> 3); +} + static unsigned bgra_cmask(unsigned mask) { return ((mask & PIPE_MASK_R) << 2) | @@ -471,6 +477,8 @@ /* Build a command buffer. */ { unsigned (*func[COLORMASK_NUM_SWIZZLES])(unsigned) = { + argb_cmask, + argb_cmask, bgra_cmask, rgba_cmask, rrrr_cmask, @@ -482,7 +490,8 @@ }; for (i = 0; i < COLORMASK_NUM_SWIZZLES; i++) { - boolean has_alpha = i != COLORMASK_RGBX && i != COLORMASK_BGRX; + boolean has_alpha = i != COLORMASK_RGBX && i != COLORMASK_BGRX && + i != COLORMASK_XRGB; BEGIN_CB(blend->cb_clamp[i], 8); OUT_CB_REG(R300_RB3D_ROPCNTL, rop); @@ -1657,6 +1666,7 @@ boolean dxtc_swizzle = r300_screen(pipe->screen)->caps.dxtc_swizzle; if (view) { + enum pipe_format format = r300_get_hw_format(templ->format, texture->bind); unsigned hwformat; view->base = *templ; @@ -1672,24 +1682,24 @@ view->swizzle[2] = templ->swizzle_b; view->swizzle[3] = templ->swizzle_a; - hwformat = r300_translate_texformat(templ->format, + hwformat = r300_translate_texformat(format, view->swizzle, is_r500, dxtc_swizzle); if (hwformat == ~0) { fprintf(stderr, "r300: Ooops. Got unsupported format %s in %s.\n", - util_format_short_name(templ->format), __func__); + util_format_short_name(format), __func__); } assert(hwformat != ~0); r300_texture_setup_format_state(r300_screen(pipe->screen), tex, - templ->format, 0, + format, 0, width0_override, height0_override, &view->format); view->format.format1 |= hwformat; if (is_r500) { - view->format.format2 |= r500_tx_format_msb_bit(templ->format); + view->format.format2 |= r500_tx_format_msb_bit(format); } } Index: mesa-10.1.1/src/gallium/drivers/r300/r300_state_derived.c =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_state_derived.c 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_state_derived.c 2014-05-02 10:11:15.420165803 +0200 @@ -815,9 +815,12 @@ for (i = 0; i < count; i++) { if (state->sampler_views[i] && state->sampler_states[i]) { + enum pipe_format format; + state->tx_enable |= 1 << i; view = state->sampler_views[i]; + format = r300_get_hw_format(view->base.format, view->base.texture->bind); tex = r300_resource(view->base.texture); sampler = state->sampler_states[i]; @@ -828,7 +831,7 @@ /* Set the border color. */ texstate->border_color = - r300_get_border_color(view->base.format, + r300_get_border_color(format, sampler->state.border_color.f, r300->screen->caps.is_r500); @@ -852,7 +855,7 @@ offset = tex->tex.offset_in_bytes[base_level]; r300_texture_setup_format_state(r300->screen, tex, - view->base.format, + format, base_level, view->width0_override, view->height0_override, @@ -865,11 +868,11 @@ texstate->format.format1 |= view->texcache_region; /* Depth textures are kinda special. */ - if (util_format_is_depth_or_stencil(view->base.format)) { + if (util_format_is_depth_or_stencil(format)) { unsigned char depth_swizzle[4]; if (!r300->screen->caps.is_r500 && - util_format_get_blocksizebits(view->base.format) == 32) { + util_format_get_blocksizebits(format) == 32) { /* X24x8 is sampled as Y16X16 on r3xx-r4xx. * The depth here is at the Y component. */ for (j = 0; j < 4; j++) @@ -894,7 +897,7 @@ } if (r300->screen->caps.dxtc_swizzle && - util_format_is_compressed(view->base.format)) { + util_format_is_compressed(format)) { texstate->filter1 |= R400_DXTC_SWIZZLE_ENABLE; } @@ -940,7 +943,7 @@ } /* Float textures only support nearest and mip-nearest filtering. */ - if (util_format_is_float(view->base.format)) { + if (util_format_is_float(format)) { /* No MAG linear filtering. */ if ((texstate->filter0 & R300_TX_MAG_FILTER_MASK) == R300_TX_MAG_FILTER_LINEAR) { Index: mesa-10.1.1/src/gallium/drivers/r300/r300_texture.c =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_texture.c 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_texture.c 2014-05-02 10:11:15.423165893 +0200 @@ -90,6 +90,25 @@ return result; } + +enum pipe_format r300_get_hw_format(enum pipe_format api_format, + unsigned bind) +{ + if (bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED) && + !(bind & (PIPE_BIND_TRANSFER_READ | PIPE_BIND_TRANSFER_WRITE))) { + switch (api_format) { + case PIPE_FORMAT_A8R8G8B8_UNORM: + return PIPE_FORMAT_B8G8R8A8_UNORM; + case PIPE_FORMAT_X8R8G8B8_UNORM: + return PIPE_FORMAT_B8G8R8X8_UNORM; + default: + break; + } + } + + return api_format; +} + /* Translate a pipe_format into a useful texture format for sampling. * * Some special formats are translated directly using R300_EASY_TX_FORMAT, @@ -444,10 +463,14 @@ return R300_COLOR_FORMAT_ARGB4444; /* 32-bit buffers. */ + case PIPE_FORMAT_A8R8G8B8_UNORM: + /*case PIPE_FORMAT_A8R8G8B8_SNORM:*/ case PIPE_FORMAT_B8G8R8A8_UNORM: /*case PIPE_FORMAT_B8G8R8A8_SNORM:*/ case PIPE_FORMAT_B8G8R8X8_UNORM: /*case PIPE_FORMAT_B8G8R8X8_SNORM:*/ + case PIPE_FORMAT_X8R8G8B8_UNORM: + /*case PIPE_FORMAT_X8R8G8B8_SNORM:*/ case PIPE_FORMAT_R8G8B8A8_UNORM: case PIPE_FORMAT_R8G8B8A8_SNORM: case PIPE_FORMAT_R8G8B8X8_UNORM: @@ -667,6 +690,10 @@ R300_C2_SEL_R | R300_C3_SEL_A; /* ARGB outputs. */ + case PIPE_FORMAT_X8R8G8B8_UNORM: + /*case PIPE_FORMAT_X8R8G8B8_SNORM:*/ + case PIPE_FORMAT_A8R8G8B8_UNORM: + /*case PIPE_FORMAT_A8R8G8B8_SNORM:*/ case PIPE_FORMAT_A16_UNORM: case PIPE_FORMAT_A16_SNORM: case PIPE_FORMAT_A16_FLOAT: @@ -770,6 +797,14 @@ case PIPE_FORMAT_R32G32_FLOAT: return COLORMASK_GRRG; + case PIPE_FORMAT_A8R8G8B8_UNORM: + /*case PIPE_FORMAT_A8R8G8B8_SNORM:*/ + return COLORMASK_ARGB; + + case PIPE_FORMAT_X8R8G8B8_UNORM: + /*case PIPE_FORMAT_X8R8G8B8_SNORM:*/ + return COLORMASK_XRGB; + case PIPE_FORMAT_B5G5R5X1_UNORM: case PIPE_FORMAT_B4G4R4X4_UNORM: case PIPE_FORMAT_B8G8R8X8_UNORM: @@ -936,14 +971,17 @@ surf->pitch_zmask = tex->tex.zmask_stride_in_pixels[level]; surf->pitch_hiz = tex->tex.hiz_stride_in_pixels[level]; } else { + enum pipe_format hwformat = r300_get_hw_format(surf->base.format, + surf->base.texture->bind); + surf->pitch = stride | - r300_translate_colorformat(surf->base.format) | + r300_translate_colorformat(hwformat) | R300_COLOR_TILE(tex->tex.macrotile[level]) | R300_COLOR_MICROTILE(tex->tex.microtile); - surf->format = r300_translate_out_fmt(surf->base.format); + surf->format = r300_translate_out_fmt(hwformat); surf->colormask_swizzle = - r300_translate_colormask_swizzle(surf->base.format); + r300_translate_colormask_swizzle(hwformat); surf->pitch_cmask = tex->tex.cmask_stride_in_pixels; } } Index: mesa-10.1.1/src/gallium/drivers/r300/r300_texture.h =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_texture.h 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_texture.h 2014-05-02 10:11:15.424165922 +0200 @@ -39,6 +39,9 @@ const unsigned char *swizzle_view, boolean dxtc_swizzle); +enum pipe_format r300_get_hw_format(enum pipe_format api_format, + unsigned bind); + uint32_t r300_translate_texformat(enum pipe_format format, const unsigned char *swizzle_view, boolean is_r500, Index: mesa-10.1.1/src/gallium/drivers/r300/r300_transfer.c =================================================================== --- mesa-10.1.1.orig/src/gallium/drivers/r300/r300_transfer.c 2014-05-02 10:11:15.444166511 +0200 +++ mesa-10.1.1/src/gallium/drivers/r300/r300_transfer.c 2014-05-02 10:11:15.425165951 +0200 @@ -22,6 +22,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "r300_transfer.h" +#include "r300_texture.h" #include "r300_texture_desc.h" #include "r300_screen_buffer.h" @@ -110,8 +111,8 @@ struct r300_context *r300 = r300_context(ctx); struct r300_resource *tex = r300_resource(texture); struct r300_transfer *trans; + enum pipe_format format = texture->format; boolean referenced_cs, referenced_hw; - enum pipe_format format = tex->b.b.format; char *map; referenced_cs = @@ -135,8 +136,9 @@ * for this transfer. * Also make write transfers pipelined. */ if (tex->tex.microtile || tex->tex.macrotile[level] || + r300_get_hw_format(format, texture->bind) != format || (referenced_hw && !(usage & PIPE_TRANSFER_READ) && - r300_is_blit_supported(texture->format))) { + r300_is_blit_supported(format))) { struct pipe_resource base; if (r300->blitter->running) {