diff options
author | George Sapountzis <gsapountzis@gmail.com> | 2010-03-25 17:01:54 +0200 |
---|---|---|
committer | George Sapountzis <gsapountzis@gmail.com> | 2010-03-25 17:01:54 +0200 |
commit | bb289a8a7019cc0b40121e91fe5cd404a76b1fb5 (patch) | |
tree | 2028d74f91d57b870dd8acb371fcbf24e7f71208 /src/gallium/winsys | |
parent | 007e0e3ef90d73f232c463e353da13378ffcef63 (diff) |
swrastg_dri: hack for loader hardcoded stride
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/sw/dri/dri_sw_winsys.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c index abf92b86b0..5549e152ee 100644 --- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c +++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c @@ -62,6 +62,14 @@ xm_is_displaytarget_format_supported( struct sw_winsys *ws, return TRUE; } +static INLINE int +bytes_per_line(unsigned stride, unsigned mul) +{ + unsigned mask = mul - 1; + + return ((stride * 8 + mask) & ~mask) / 8; +} + /* pipe_screen::texture_create DISPLAY_TARGET / SCANOUT / SHARED */ static struct sw_displaytarget * xm_displaytarget_create(struct sw_winsys *winsys, @@ -72,21 +80,35 @@ xm_displaytarget_create(struct sw_winsys *winsys, unsigned *stride) { struct xm_displaytarget *xm_dt; - unsigned nblocksy, size, xm_stride; + unsigned nblocksy, size, xm_stride, loader_stride, format_stride; xm_dt = CALLOC_STRUCT(xm_displaytarget); if(!xm_dt) goto no_xm_dt; + format_stride = util_format_get_stride(format, width); + xm_stride = align(format_stride, alignment); + loader_stride = bytes_per_line(format_stride, 32); + nblocksy = util_format_get_nblocksy(format, height); - xm_stride = align(util_format_get_stride(format, width), alignment); size = xm_stride * nblocksy; +#ifdef DEBUG + debug_printf("swrast format stride: %8d\n", format_stride); + debug_printf("swrast pipe stride : %8d\n", xm_stride); + debug_printf("swrast loader stride: %8d\n", loader_stride); +#endif + + /* + * Allocate with the aligned stride required by the pipe but set the stride + * to the one hardcoded in the loaders XXX + */ + xm_dt->data = align_malloc(size, alignment); if(!xm_dt->data) goto no_data; - *stride = xm_stride; + *stride = loader_stride; return (struct sw_displaytarget *)xm_dt; no_data: |