History

drm/vc4: Add exec flags to allow forcing a specific X/Y tile walk order.

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)

Eric Anholt committed 9 years ago

Commit 3be8edd1 parent fb959924 files · +32 −6Browse files

Unified · Split

4 files
  1. drivers/gpu/drm/vc4/vc4_drv.c +1 −0
  2. drivers/gpu/drm/vc4/vc4_gem.c +4 −1
  3. drivers/gpu/drm/vc4/vc4_render_cl.c +16 −5
  4. include/uapi/drm/vc4_drm.h +11 −0
drivers/gpu/drm/vc4/vc4_drv.c+1−0
@@ -99,6 +99,7 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data, · 98 unmodified lines
9999 case DRM_VC4_PARAM_SUPPORTS_BRANCHES:
100100 case DRM_VC4_PARAM_SUPPORTS_ETC1:
101101 case DRM_VC4_PARAM_SUPPORTS_THREADED_FS:
102+ case DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER:
102103 args->value = true;
103104 break;
104105 default:
drivers/gpu/drm/vc4/vc4_gem.c+4−1
@@ -1007,7 +1007,10 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 1006 unmodified lines
10071007 struct ww_acquire_ctx acquire_ctx;
10081008 int ret = 0;
10091009
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) {
10111014 DRM_DEBUG("Unknown flags: 0x%02x\n", args->flags);
10121015 return -EINVAL;
10131016 }
drivers/gpu/drm/vc4/vc4_render_cl.c+16−5
@@ -261,8 +261,17 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, · 260 unmodified lines
261261 uint8_t max_y_tile = args->max_y_tile;
262262 uint8_t xtiles = max_x_tile - min_x_tile + 1;
263263 uint8_t ytiles = max_y_tile - min_y_tile + 1;
264− uint8_t x, y;
264+ uint8_t xi, yi;
265265 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+ }
266275
267276 size = VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE;
268277 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
354363 rcl_u16(setup, args->height);
355364 rcl_u16(setup, args->color_write.bits);
356365
357− for (y = min_y_tile; y <= max_y_tile; y++) {
358− for (x = min_x_tile; x <= max_x_tile; x++) {
359− bool first = (x == min_x_tile && y == min_y_tile);
360− bool last = (x == max_x_tile && y == max_y_tile);
366+ for (yi = 0; yi < ytiles; yi++) {
367+ int y = positive_y ? min_y_tile + yi : max_y_tile - yi;
368+ for (xi = 0; xi < xtiles; xi++) {
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);
361372
362373 emit_tile(exec, setup, x, y, first, last);
363374 }
include/uapi/drm/vc4_drm.h+11−0
@@ -155,6 +155,16 @@ struct drm_vc4_submit_cl { · 154 unmodified lines
155155 __u32 pad:24;
156156
157157 #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)
158168 __u32 flags;
159169
160170 /* Returned value of the seqno of this render job (for the
@@ -294,6 +304,7 @@ struct drm_vc4_get_hang_state { · 133 unmodified lines
294304 #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3
295305 #define DRM_VC4_PARAM_SUPPORTS_ETC1 4
296306 #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5
307+#define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6
297308
298309 struct drm_vc4_get_param {
299310 __u32 param;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t