diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv04_fbcon.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_fbcon.c | 68 |
1 files changed, 23 insertions, 45 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c index 33e4c9388bc..a32804e7d20 100644 --- a/drivers/gpu/drm/nouveau/nv04_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c | |||
@@ -28,52 +28,39 @@ | |||
28 | #include "nouveau_ramht.h" | 28 | #include "nouveau_ramht.h" |
29 | #include "nouveau_fbcon.h" | 29 | #include "nouveau_fbcon.h" |
30 | 30 | ||
31 | void | 31 | int |
32 | nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 32 | nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
33 | { | 33 | { |
34 | struct nouveau_fbdev *nfbdev = info->par; | 34 | struct nouveau_fbdev *nfbdev = info->par; |
35 | struct drm_device *dev = nfbdev->dev; | 35 | struct drm_device *dev = nfbdev->dev; |
36 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 36 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
37 | struct nouveau_channel *chan = dev_priv->channel; | 37 | struct nouveau_channel *chan = dev_priv->channel; |
38 | int ret; | ||
38 | 39 | ||
39 | if (info->state != FBINFO_STATE_RUNNING) | 40 | ret = RING_SPACE(chan, 4); |
40 | return; | 41 | if (ret) |
41 | 42 | return ret; | |
42 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) { | ||
43 | nouveau_fbcon_gpu_lockup(info); | ||
44 | } | ||
45 | |||
46 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | ||
47 | cfb_copyarea(info, region); | ||
48 | return; | ||
49 | } | ||
50 | 43 | ||
51 | BEGIN_RING(chan, NvSubImageBlit, 0x0300, 3); | 44 | BEGIN_RING(chan, NvSubImageBlit, 0x0300, 3); |
52 | OUT_RING(chan, (region->sy << 16) | region->sx); | 45 | OUT_RING(chan, (region->sy << 16) | region->sx); |
53 | OUT_RING(chan, (region->dy << 16) | region->dx); | 46 | OUT_RING(chan, (region->dy << 16) | region->dx); |
54 | OUT_RING(chan, (region->height << 16) | region->width); | 47 | OUT_RING(chan, (region->height << 16) | region->width); |
55 | FIRE_RING(chan); | 48 | FIRE_RING(chan); |
49 | return 0; | ||
56 | } | 50 | } |
57 | 51 | ||
58 | void | 52 | int |
59 | nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 53 | nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
60 | { | 54 | { |
61 | struct nouveau_fbdev *nfbdev = info->par; | 55 | struct nouveau_fbdev *nfbdev = info->par; |
62 | struct drm_device *dev = nfbdev->dev; | 56 | struct drm_device *dev = nfbdev->dev; |
63 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 57 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
64 | struct nouveau_channel *chan = dev_priv->channel; | 58 | struct nouveau_channel *chan = dev_priv->channel; |
59 | int ret; | ||
65 | 60 | ||
66 | if (info->state != FBINFO_STATE_RUNNING) | 61 | ret = RING_SPACE(chan, 7); |
67 | return; | 62 | if (ret) |
68 | 63 | return ret; | |
69 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) { | ||
70 | nouveau_fbcon_gpu_lockup(info); | ||
71 | } | ||
72 | |||
73 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | ||
74 | cfb_fillrect(info, rect); | ||
75 | return; | ||
76 | } | ||
77 | 64 | ||
78 | BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); | 65 | BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); |
79 | OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); | 66 | OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); |
@@ -87,9 +74,10 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
87 | OUT_RING(chan, (rect->dx << 16) | rect->dy); | 74 | OUT_RING(chan, (rect->dx << 16) | rect->dy); |
88 | OUT_RING(chan, (rect->width << 16) | rect->height); | 75 | OUT_RING(chan, (rect->width << 16) | rect->height); |
89 | FIRE_RING(chan); | 76 | FIRE_RING(chan); |
77 | return 0; | ||
90 | } | 78 | } |
91 | 79 | ||
92 | void | 80 | int |
93 | nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | 81 | nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) |
94 | { | 82 | { |
95 | struct nouveau_fbdev *nfbdev = info->par; | 83 | struct nouveau_fbdev *nfbdev = info->par; |
@@ -101,23 +89,14 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
101 | uint32_t dsize; | 89 | uint32_t dsize; |
102 | uint32_t width; | 90 | uint32_t width; |
103 | uint32_t *data = (uint32_t *)image->data; | 91 | uint32_t *data = (uint32_t *)image->data; |
92 | int ret; | ||
104 | 93 | ||
105 | if (info->state != FBINFO_STATE_RUNNING) | 94 | if (image->depth != 1) |
106 | return; | 95 | return -ENODEV; |
107 | |||
108 | if (image->depth != 1) { | ||
109 | cfb_imageblit(info, image); | ||
110 | return; | ||
111 | } | ||
112 | |||
113 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) { | ||
114 | nouveau_fbcon_gpu_lockup(info); | ||
115 | } | ||
116 | 96 | ||
117 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 97 | ret = RING_SPACE(chan, 8); |
118 | cfb_imageblit(info, image); | 98 | if (ret) |
119 | return; | 99 | return ret; |
120 | } | ||
121 | 100 | ||
122 | width = ALIGN(image->width, 8); | 101 | width = ALIGN(image->width, 8); |
123 | dsize = ALIGN(width * image->height, 32) >> 5; | 102 | dsize = ALIGN(width * image->height, 32) >> 5; |
@@ -144,11 +123,9 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
144 | while (dsize) { | 123 | while (dsize) { |
145 | int iter_len = dsize > 128 ? 128 : dsize; | 124 | int iter_len = dsize > 128 ? 128 : dsize; |
146 | 125 | ||
147 | if (RING_SPACE(chan, iter_len + 1)) { | 126 | ret = RING_SPACE(chan, iter_len + 1); |
148 | nouveau_fbcon_gpu_lockup(info); | 127 | if (ret) |
149 | cfb_imageblit(info, image); | 128 | return ret; |
150 | return; | ||
151 | } | ||
152 | 129 | ||
153 | BEGIN_RING(chan, NvSubGdiRect, 0x0c00, iter_len); | 130 | BEGIN_RING(chan, NvSubGdiRect, 0x0c00, iter_len); |
154 | OUT_RINGp(chan, data, iter_len); | 131 | OUT_RINGp(chan, data, iter_len); |
@@ -157,6 +134,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
157 | } | 134 | } |
158 | 135 | ||
159 | FIRE_RING(chan); | 136 | FIRE_RING(chan); |
137 | return 0; | ||
160 | } | 138 | } |
161 | 139 | ||
162 | static int | 140 | static int |