diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-12-01 16:13:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-01 22:55:24 -0500 |
commit | c4c6fa9891f3d1bcaae4f39fb751d5302965b566 (patch) | |
tree | 14952fe84b15a0ebdd1f38ce9e1c8cf237eb6369 /drivers/video | |
parent | b93c35ff39d19f20c47c06c206986afefecc777a (diff) |
radeonfb: fix problem with color expansion & alignment
The engine on some radeon variants locks up if color expansion is called
for non aligned source data. This patch enables a feature of the core
fbdev to request aligned input pixmaps and uses the HW clipping engine to
clip the output to the requested size
Addresses http://bugzilla.kernel.org/show_bug.cgi?id=11875
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: James Cloos <cloos@jhcloos.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/aty/radeon_accel.c | 21 | ||||
-rw-r--r-- | drivers/video/aty/radeon_base.c | 18 |
2 files changed, 30 insertions, 9 deletions
diff --git a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c index 8718f7349d6b..a547e5d4c8bf 100644 --- a/drivers/video/aty/radeon_accel.c +++ b/drivers/video/aty/radeon_accel.c | |||
@@ -174,12 +174,12 @@ static void radeonfb_prim_imageblit(struct radeonfb_info *rinfo, | |||
174 | const struct fb_image *image, | 174 | const struct fb_image *image, |
175 | u32 fg, u32 bg) | 175 | u32 fg, u32 bg) |
176 | { | 176 | { |
177 | unsigned int src_bytes, dwords; | 177 | unsigned int dwords; |
178 | u32 *bits; | 178 | u32 *bits; |
179 | 179 | ||
180 | radeonfb_set_creg(rinfo, DP_GUI_MASTER_CNTL, &rinfo->dp_gui_mc_cache, | 180 | radeonfb_set_creg(rinfo, DP_GUI_MASTER_CNTL, &rinfo->dp_gui_mc_cache, |
181 | rinfo->dp_gui_mc_base | | 181 | rinfo->dp_gui_mc_base | |
182 | GMC_BRUSH_NONE | | 182 | GMC_BRUSH_NONE | GMC_DST_CLIP_LEAVE | |
183 | GMC_SRC_DATATYPE_MONO_FG_BG | | 183 | GMC_SRC_DATATYPE_MONO_FG_BG | |
184 | ROP3_S | | 184 | ROP3_S | |
185 | GMC_BYTE_ORDER_MSB_TO_LSB | | 185 | GMC_BYTE_ORDER_MSB_TO_LSB | |
@@ -189,9 +189,6 @@ static void radeonfb_prim_imageblit(struct radeonfb_info *rinfo, | |||
189 | radeonfb_set_creg(rinfo, DP_SRC_FRGD_CLR, &rinfo->dp_src_fg_cache, fg); | 189 | radeonfb_set_creg(rinfo, DP_SRC_FRGD_CLR, &rinfo->dp_src_fg_cache, fg); |
190 | radeonfb_set_creg(rinfo, DP_SRC_BKGD_CLR, &rinfo->dp_src_bg_cache, bg); | 190 | radeonfb_set_creg(rinfo, DP_SRC_BKGD_CLR, &rinfo->dp_src_bg_cache, bg); |
191 | 191 | ||
192 | radeon_fifo_wait(rinfo, 1); | ||
193 | OUTREG(DST_Y_X, (image->dy << 16) | image->dx); | ||
194 | |||
195 | /* Ensure the dst cache is flushed and the engine idle before | 192 | /* Ensure the dst cache is flushed and the engine idle before |
196 | * issuing the operation. | 193 | * issuing the operation. |
197 | * | 194 | * |
@@ -205,13 +202,19 @@ static void radeonfb_prim_imageblit(struct radeonfb_info *rinfo, | |||
205 | 202 | ||
206 | /* X here pads width to a multiple of 32 and uses the clipper to | 203 | /* X here pads width to a multiple of 32 and uses the clipper to |
207 | * adjust the result. Is that really necessary ? Things seem to | 204 | * adjust the result. Is that really necessary ? Things seem to |
208 | * work ok for me without that and the doco doesn't seem to imply | 205 | * work ok for me without that and the doco doesn't seem to imply] |
209 | * there is such a restriction. | 206 | * there is such a restriction. |
210 | */ | 207 | */ |
211 | OUTREG(DST_WIDTH_HEIGHT, (image->width << 16) | image->height); | 208 | radeon_fifo_wait(rinfo, 4); |
209 | OUTREG(SC_TOP_LEFT, (image->dy << 16) | image->dx); | ||
210 | OUTREG(SC_BOTTOM_RIGHT, ((image->dy + image->height) << 16) | | ||
211 | (image->dx + image->width)); | ||
212 | OUTREG(DST_Y_X, (image->dy << 16) | image->dx); | ||
213 | |||
214 | OUTREG(DST_HEIGHT_WIDTH, (image->height << 16) | ((image->width + 31) & ~31)); | ||
212 | 215 | ||
213 | src_bytes = (((image->width * image->depth) + 7) / 8) * image->height; | 216 | dwords = (image->width + 31) >> 5; |
214 | dwords = (src_bytes + 3) / 4; | 217 | dwords *= image->height; |
215 | bits = (u32*)(image->data); | 218 | bits = (u32*)(image->data); |
216 | 219 | ||
217 | while(dwords >= 8) { | 220 | while(dwords >= 8) { |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 9a5821c65ebf..b3ffe8205d2b 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -1875,6 +1875,7 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) | |||
1875 | info->fbops = &radeonfb_ops; | 1875 | info->fbops = &radeonfb_ops; |
1876 | info->screen_base = rinfo->fb_base; | 1876 | info->screen_base = rinfo->fb_base; |
1877 | info->screen_size = rinfo->mapped_vram; | 1877 | info->screen_size = rinfo->mapped_vram; |
1878 | |||
1878 | /* Fill fix common fields */ | 1879 | /* Fill fix common fields */ |
1879 | strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id)); | 1880 | strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id)); |
1880 | info->fix.smem_start = rinfo->fb_base_phys; | 1881 | info->fix.smem_start = rinfo->fb_base_phys; |
@@ -1889,8 +1890,25 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) | |||
1889 | info->fix.mmio_len = RADEON_REGSIZE; | 1890 | info->fix.mmio_len = RADEON_REGSIZE; |
1890 | info->fix.accel = FB_ACCEL_ATI_RADEON; | 1891 | info->fix.accel = FB_ACCEL_ATI_RADEON; |
1891 | 1892 | ||
1893 | /* Allocate colormap */ | ||
1892 | fb_alloc_cmap(&info->cmap, 256, 0); | 1894 | fb_alloc_cmap(&info->cmap, 256, 0); |
1893 | 1895 | ||
1896 | /* Setup pixmap used for acceleration */ | ||
1897 | #define PIXMAP_SIZE (2048 * 4) | ||
1898 | |||
1899 | info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL); | ||
1900 | if (!info->pixmap.addr) { | ||
1901 | printk(KERN_ERR "radeonfb: Failed to allocate pixmap !\n"); | ||
1902 | noaccel = 1; | ||
1903 | goto bail; | ||
1904 | } | ||
1905 | info->pixmap.size = PIXMAP_SIZE; | ||
1906 | info->pixmap.flags = FB_PIXMAP_SYSTEM; | ||
1907 | info->pixmap.scan_align = 4; | ||
1908 | info->pixmap.buf_align = 4; | ||
1909 | info->pixmap.access_align = 32; | ||
1910 | |||
1911 | bail: | ||
1894 | if (noaccel) | 1912 | if (noaccel) |
1895 | info->flags |= FBINFO_HWACCEL_DISABLED; | 1913 | info->flags |= FBINFO_HWACCEL_DISABLED; |
1896 | 1914 | ||