diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2011-11-28 07:19:13 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-12-19 09:06:03 -0500 |
commit | 203dc2201326fa64411158c84ab0745546300310 (patch) | |
tree | 3ddb3946c3cbf7ed01aa7f9f0e2d37a66ef4cd7f /drivers/gpu/drm/vmwgfx | |
parent | e7ac9211f29f2fc2e7d11586a33267d2a26d3f2f (diff) |
vmwgfx: Do better culling of presents
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index ac24cfd431b5..d31ae338cfc1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -1098,6 +1098,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, | |||
1098 | size_t fifo_size; | 1098 | size_t fifo_size; |
1099 | int i, k, num_units; | 1099 | int i, k, num_units; |
1100 | int ret = 0; /* silence warning */ | 1100 | int ret = 0; /* silence warning */ |
1101 | int left, right, top, bottom; | ||
1101 | 1102 | ||
1102 | struct { | 1103 | struct { |
1103 | SVGA3dCmdHeader header; | 1104 | SVGA3dCmdHeader header; |
@@ -1122,30 +1123,42 @@ int vmw_kms_present(struct vmw_private *dev_priv, | |||
1122 | return -ENOMEM; | 1123 | return -ENOMEM; |
1123 | } | 1124 | } |
1124 | 1125 | ||
1126 | left = clips->x; | ||
1127 | right = clips->x + clips->w; | ||
1128 | top = clips->y; | ||
1129 | bottom = clips->y + clips->h; | ||
1130 | |||
1131 | for (i = 1; i < num_clips; i++) { | ||
1132 | left = min_t(int, left, (int)clips[i].x); | ||
1133 | right = max_t(int, right, (int)clips[i].x + clips[i].w); | ||
1134 | top = min_t(int, top, (int)clips[i].y); | ||
1135 | bottom = max_t(int, bottom, (int)clips[i].y + clips[i].h); | ||
1136 | } | ||
1137 | |||
1125 | /* only need to do this once */ | 1138 | /* only need to do this once */ |
1126 | memset(cmd, 0, fifo_size); | 1139 | memset(cmd, 0, fifo_size); |
1127 | cmd->header.id = cpu_to_le32(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN); | 1140 | cmd->header.id = cpu_to_le32(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN); |
1128 | cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); | 1141 | cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); |
1129 | 1142 | ||
1130 | cmd->body.srcRect.left = 0; | 1143 | cmd->body.srcRect.left = left; |
1131 | cmd->body.srcRect.right = surface->sizes[0].width; | 1144 | cmd->body.srcRect.right = right; |
1132 | cmd->body.srcRect.top = 0; | 1145 | cmd->body.srcRect.top = top; |
1133 | cmd->body.srcRect.bottom = surface->sizes[0].height; | 1146 | cmd->body.srcRect.bottom = bottom; |
1134 | 1147 | ||
1135 | blits = (SVGASignedRect *)&cmd[1]; | 1148 | blits = (SVGASignedRect *)&cmd[1]; |
1136 | for (i = 0; i < num_clips; i++) { | 1149 | for (i = 0; i < num_clips; i++) { |
1137 | blits[i].left = clips[i].x; | 1150 | blits[i].left = clips[i].x - left; |
1138 | blits[i].right = clips[i].x + clips[i].w; | 1151 | blits[i].right = clips[i].x + clips[i].w - left; |
1139 | blits[i].top = clips[i].y; | 1152 | blits[i].top = clips[i].y - top; |
1140 | blits[i].bottom = clips[i].y + clips[i].h; | 1153 | blits[i].bottom = clips[i].y + clips[i].h - top; |
1141 | } | 1154 | } |
1142 | 1155 | ||
1143 | for (k = 0; k < num_units; k++) { | 1156 | for (k = 0; k < num_units; k++) { |
1144 | struct vmw_display_unit *unit = units[k]; | 1157 | struct vmw_display_unit *unit = units[k]; |
1145 | int clip_x1 = destX - unit->crtc.x; | 1158 | int clip_x1 = left + destX - unit->crtc.x; |
1146 | int clip_y1 = destY - unit->crtc.y; | 1159 | int clip_y1 = top + destY - unit->crtc.y; |
1147 | int clip_x2 = clip_x1 + surface->sizes[0].width; | 1160 | int clip_x2 = right + destX - unit->crtc.x; |
1148 | int clip_y2 = clip_y1 + surface->sizes[0].height; | 1161 | int clip_y2 = bottom + destY - unit->crtc.y; |
1149 | 1162 | ||
1150 | /* skip any crtcs that misses the clip region */ | 1163 | /* skip any crtcs that misses the clip region */ |
1151 | if (clip_x1 >= unit->crtc.mode.hdisplay || | 1164 | if (clip_x1 >= unit->crtc.mode.hdisplay || |