This is useful to allow GL to provide defined results for overlapping glBlitFramebuffer, which X11 in turn uses to accelerate uncomposited window movement without first blitting to a temporary. x11perf -copywinwin100 goes from 1850/sec to 4850/sec. v2: Default to the same behavior as before when the flags aren't passed. (suggested by Boris)
Unified · Split
| @@ -99,6 +99,7 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data, · 98 unmodified lines | |||
| 99 | case DRM_VC4_PARAM_SUPPORTS_BRANCHES: | 99 | case DRM_VC4_PARAM_SUPPORTS_BRANCHES: |
| 100 | case DRM_VC4_PARAM_SUPPORTS_ETC1: | 100 | case DRM_VC4_PARAM_SUPPORTS_ETC1: |
| 101 | case DRM_VC4_PARAM_SUPPORTS_THREADED_FS: | 101 | case DRM_VC4_PARAM_SUPPORTS_THREADED_FS: |
| 102 | case DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER: | ||
| 102 | args->value = true; | 103 | args->value = true; |
| 103 | break; | 104 | break; |
| 104 | default: | 105 | default: |
| @@ -1007,7 +1007,10 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 1006 unmodified lines | |||
| 1007 | struct ww_acquire_ctx acquire_ctx; | 1007 | struct ww_acquire_ctx acquire_ctx; |
| 1008 | int ret = 0; | 1008 | int ret = 0; |
| 1009 | 1009 | ||
| 1010 | if ((args->flags & ~VC4_SUBMIT_CL_USE_CLEAR_COLOR) != 0) { | 1010 | if ((args->flags & ~(VC4_SUBMIT_CL_USE_CLEAR_COLOR | |
| 1011 | VC4_SUBMIT_CL_FIXED_RCL_ORDER | | ||
| 1012 | VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X | | ||
| 1013 | VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y)) != 0) { | ||
| 1011 | DRM_DEBUG("Unknown flags: 0x%02x\n", args->flags); | 1014 | DRM_DEBUG("Unknown flags: 0x%02x\n", args->flags); |
| 1012 | return -EINVAL; | 1015 | return -EINVAL; |
| 1013 | } | 1016 | } |
| @@ -261,8 +261,17 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, · 260 unmodified lines | |||
| 261 | uint8_t max_y_tile = args->max_y_tile; | 261 | uint8_t max_y_tile = args->max_y_tile; |
| 262 | uint8_t xtiles = max_x_tile - min_x_tile + 1; | 262 | uint8_t xtiles = max_x_tile - min_x_tile + 1; |
| 263 | uint8_t ytiles = max_y_tile - min_y_tile + 1; | 263 | uint8_t ytiles = max_y_tile - min_y_tile + 1; |
| 264 | uint8_t x, y; | 264 | uint8_t xi, yi; |
| 265 | uint32_t size, loop_body_size; | 265 | uint32_t size, loop_body_size; |
| 266 | bool positive_x = true; | ||
| 267 | bool positive_y = true; | ||
| 268 | |||
| 269 | if (args->flags & VC4_SUBMIT_CL_FIXED_RCL_ORDER) { | ||
| 270 | if (!(args->flags & VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X)) | ||
| 271 | positive_x = false; | ||
| 272 | if (!(args->flags & VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y)) | ||
| 273 | positive_y = false; | ||
| 274 | } | ||
| 266 | 275 | ||
| 267 | size = VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE; | 276 | size = VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE; |
| 268 | loop_body_size = VC4_PACKET_TILE_COORDINATES_SIZE; | 277 | loop_body_size = VC4_PACKET_TILE_COORDINATES_SIZE; |
| @@ -354,10 +363,12 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, · 85 unmodified lines | |||
| 354 | rcl_u16(setup, args->height); | 363 | rcl_u16(setup, args->height); |
| 355 | rcl_u16(setup, args->color_write.bits); | 364 | rcl_u16(setup, args->color_write.bits); |
| 356 | 365 | ||
| 357 | for (y = min_y_tile; y <= max_y_tile; y++) { | 366 | for (yi = 0; yi < ytiles; yi++) { |
| 358 | for (x = min_x_tile; x <= max_x_tile; x++) { | 367 | int y = positive_y ? min_y_tile + yi : max_y_tile - yi; |
| 359 | bool first = (x == min_x_tile && y == min_y_tile); | 368 | for (xi = 0; xi < xtiles; xi++) { |
| 360 | bool last = (x == max_x_tile && y == max_y_tile); | 369 | int x = positive_x ? min_x_tile + xi : max_x_tile - xi; |
| 370 | bool first = (xi == 0 && yi == 0); | ||
| 371 | bool last = (xi == xtiles - 1 && yi == ytiles - 1); | ||
| 361 | 372 | ||
| 362 | emit_tile(exec, setup, x, y, first, last); | 373 | emit_tile(exec, setup, x, y, first, last); |
| 363 | } | 374 | } |
| @@ -155,6 +155,16 @@ struct drm_vc4_submit_cl { · 154 unmodified lines | |||
| 155 | __u32 pad:24; | 155 | __u32 pad:24; |
| 156 | 156 | ||
| 157 | #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) | 157 | #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) |
| 158 | /* By default, the kernel gets to choose the order that the tiles are | ||
| 159 | * rendered in. If this is set, then the tiles will be rendered in a | ||
| 160 | * raster order, with the right-to-left vs left-to-right and | ||
| 161 | * top-to-bottom vs bottom-to-top dictated by | ||
| 162 | * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping | ||
| 163 | * blits to be implemented using the 3D engine. | ||
| 164 | */ | ||
| 165 | #define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1) | ||
| 166 | #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2) | ||
| 167 | #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3) | ||
| 158 | __u32 flags; | 168 | __u32 flags; |
| 159 | 169 | ||
| 160 | /* Returned value of the seqno of this render job (for the | 170 | /* Returned value of the seqno of this render job (for the |
| @@ -294,6 +304,7 @@ struct drm_vc4_get_hang_state { · 133 unmodified lines | |||
| 294 | #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 | 304 | #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 |
| 295 | #define DRM_VC4_PARAM_SUPPORTS_ETC1 4 | 305 | #define DRM_VC4_PARAM_SUPPORTS_ETC1 4 |
| 296 | #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 | 306 | #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 |
| 307 | #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6 | ||
| 297 | 308 | ||
| 298 | struct drm_vc4_get_param { | 309 | struct drm_vc4_get_param { |
| 299 | __u32 param; | 310 | __u32 param; |