nvidiafb: Maximize blit buffer capacity

Started by Antonino A. Daplas on Mar 13, 2005

Subsystems (2)

Maintainers (2)

DORMANTno replies

open the first message on its own page

Message details and related content
  Currently, nvidiafb blit expands a rectangle a scanline at a time.
  This is very inefficient because the graphics pipeline is not
  maximized. It may also crash if the scanline is > 4096 (should
  not happen with fbcon though).

  Instead of blitting a scanline at a time, attempt to fill up buffer
  to maximum capacity.

Signed-off-by: Antonino Daplas <redacted>
---

 nv_accel.c |   20 +++++++++++++++++---
 nv_local.h |    3 +--
 2 files changed, 18 insertions(+), 5 deletions(-)

diff -Nru a/drivers/video/nvidia/nv_accel.c b/drivers/video/nvidia/nv_accel.c
--- a/drivers/video/nvidia/nv_accel.c	2005-03-12 23:25:08 +08:00
+++ b/drivers/video/nvidia/nv_accel.c	2005-03-11 13:32:06 +08:00
@@ -359,10 +359,10 @@
 	struct nvidia_par *par = info->par;
 	u32 fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel));
 	u32 dsize, width, *data = (u32 *) image->data, tmp;
-	int i, j, k = 0;
+	int j, k = 0;
 
 	width = (image->width + 31) & ~31;
-	dsize = width >> 5;
+	dsize = (width * image->height) >> 5;
 
 	if (info->var.bits_per_pixel == 8) {
 		fg = image->fg_color | mask;
@@ -382,8 +382,22 @@
 	NVDmaNext(par, (image->height << 16) | width);
 	NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff));
 
-	for (i = image->height; i--;) {
+	while (dsize >= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS) {
+		NVDmaStart(par, RECT_EXPAND_TWO_COLOR_DATA(0),
+			   RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS);
+
+		for (j = RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS; j--;) {
+			tmp = data[k++];
+			reverse_order(&tmp);
+			NVDmaNext(par, tmp);
+		}
+
+		dsize -= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS;
+	}
+
+	if (dsize) {
 		NVDmaStart(par, RECT_EXPAND_TWO_COLOR_DATA(0), dsize);
+
 		for (j = dsize; j--;) {
 			tmp = data[k++];
 			reverse_order(&tmp);
diff -Nru a/drivers/video/nvidia/nv_local.h b/drivers/video/nvidia/nv_local.h
--- a/drivers/video/nvidia/nv_local.h	2005-03-12 23:25:10 +08:00
+++ b/drivers/video/nvidia/nv_local.h	2005-03-11 13:32:06 +08:00
@@ -87,9 +87,8 @@
 #endif
 
 #define WRITE_PUT(par, data) {                   \
-  volatile u8 scratch;                           \
   _NV_FENCE()                                    \
-  scratch = NV_RD08((par)->FbStart, 0);          \
+  NV_RD08((par)->FbStart, 0);                    \
   NV_WR32(&(par)->FIFO[0x0010], 0, (data) << 2); \
   mb();                                          \
 }




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help