summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.c19
-rw-r--r--src/gallium/targets/dri-swrast/swrast_drm_api.c4
-rw-r--r--src/gallium/winsys/sw/dri/dri_sw_winsys.c25
3 files changed, 20 insertions, 28 deletions
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
index a75fdf17899..b7eba63bcb9 100644
--- a/src/gallium/state_trackers/dri/sw/drisw.c
+++ b/src/gallium/state_trackers/dri/sw/drisw.c
@@ -48,8 +48,13 @@
* for createImage/destroyImage similar to DRI2 getBuffers. Probably not worth
* it, given the scope of DRISW, unless it falls naturally from properly
* solving the other issues.
+ *
+ * fences:
+ *
+ * No fences are used, are they needed for llvmpipe / cell ?
*/
+#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "pipe/p_context.h"
@@ -75,14 +80,19 @@ get_drawable_info(__DRIdrawable *dPriv, int *w, int *h)
dPriv->loaderPrivate);
}
+/*
+ * Set the width to 'stride / cpp'. PutImage seems to correctly clip the width
+ * to the actual width of the dst drawable. Even if this is not specified but
+ * an implementation detail, it is the correct thing to do, so rely on it. XXX
+ */
static INLINE void
-put_image(__DRIdrawable *dPriv, void *data)
+put_image(__DRIdrawable *dPriv, void *data, unsigned width)
{
__DRIscreen *sPriv = dPriv->driScreenPriv;
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
- 0, 0, dPriv->w, dPriv->h,
+ 0, 0, width, dPriv->h,
data, dPriv->loaderPrivate);
}
@@ -102,6 +112,7 @@ drisw_present_texture(__DRIdrawable *dPriv,
struct pipe_surface *psurf;
struct pipe_transfer *ptrans;
void *pmap;
+ unsigned width;
pipe = dri1_get_pipe_context(screen);
psurf = dri1_get_pipe_surface(drawable, ptex);
@@ -112,11 +123,13 @@ drisw_present_texture(__DRIdrawable *dPriv,
PIPE_TRANSFER_READ,
0, 0, dPriv->w, dPriv->h);
+ width = ptrans->stride / util_format_get_blocksize(ptex->format);
+
pmap = pipe->transfer_map(pipe, ptrans);
assert(pmap);
- put_image(dPriv, pmap);
+ put_image(dPriv, pmap, width);
pipe->transfer_unmap(pipe, ptrans);
diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c
index 1fdfcccf883..1f24d7650d7 100644
--- a/src/gallium/targets/dri-swrast/swrast_drm_api.c
+++ b/src/gallium/targets/dri-swrast/swrast_drm_api.c
@@ -38,8 +38,8 @@
* This function should be put in targets/common or winsys/sw/common and shared
* with targets/libgl-xlib and winsys/sw/drm.
*
- * For targets/common, you get layering violations in the build system unless
- * all of drm_api's are moved under targets.
+ * For targets/common, you get layering violations unless all of drm_api's are
+ * moved under targets.
*/
#ifdef GALLIUM_SOFTPIPE
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index ee8ec91bc52..1c1e5612d28 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -62,15 +62,6 @@ xm_is_displaytarget_format_supported( struct sw_winsys *ws,
return TRUE;
}
-/* see bytes_per_line in libGL */
-static INLINE int
-bytes_per_line(unsigned pitch_bits, unsigned mul)
-{
- unsigned mask = mul - 1;
-
- return ((pitch_bits + mask) & ~mask) / 8;
-}
-
/* pipe_screen::texture_create DISPLAY_TARGET / SCANOUT / SHARED */
static struct sw_displaytarget *
xm_displaytarget_create(struct sw_winsys *winsys,
@@ -81,7 +72,7 @@ xm_displaytarget_create(struct sw_winsys *winsys,
unsigned *stride)
{
struct xm_displaytarget *xm_dt;
- unsigned nblocksy, size, xm_stride, loader_stride, format_stride;
+ unsigned nblocksy, size, xm_stride, format_stride;
xm_dt = CALLOC_STRUCT(xm_displaytarget);
if(!xm_dt)
@@ -89,27 +80,15 @@ xm_displaytarget_create(struct sw_winsys *winsys,
format_stride = util_format_get_stride(format, width);
xm_stride = align(format_stride, alignment);
- loader_stride = bytes_per_line(format_stride * 8, 32);
nblocksy = util_format_get_nblocksy(format, height);
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 = loader_stride;
+ *stride = xm_stride;
return (struct sw_displaytarget *)xm_dt;
no_data: