Ville Syrjälä
272725c7db
drm: Nuke fb->bits_per_pixel
...
Replace uses of fb->bits_per_pixel with fb->format->cpp[0]*8.
Less duplicated information is a good thing.
Note that I didn't put parens around the cpp*8 in the below cocci script,
on account of not wanting spurious parens all over the place. Instead I
did the unsafe way, and tried to look over the entire diff to spot if
any dangerous expressions were produced. I didn't see any.
There are some cases where previously the code did X*bpp/8, so the
division happened after the multiplication. Those are now just X*cpp
so the division effectively happens before the multiplication,
but that is perfectly fine since bpp is always a multiple of 8.
@@
struct drm_framebuffer *FB;
expression E;
@@
drm_helper_mode_fill_fb_struct(...) {
...
- FB->bits_per_pixel = E;
...
}
@@
struct drm_framebuffer *FB;
expression E;
@@
i9xx_get_initial_plane_config(...) {
...
- FB->bits_per_pixel = E;
...
}
@@
struct drm_framebuffer *FB;
expression E;
@@
ironlake_get_initial_plane_config(...) {
...
- FB->bits_per_pixel = E;
...
}
@@
struct drm_framebuffer *FB;
expression E;
@@
skylake_get_initial_plane_config(...) {
...
- FB->bits_per_pixel = E;
...
}
@@
struct drm_framebuffer FB;
expression E;
@@
(
- E * FB.bits_per_pixel / 8
+ E * FB.format->cpp[0]
|
- FB.bits_per_pixel / 8
+ FB.format->cpp[0]
|
- E * FB.bits_per_pixel >> 3
+ E * FB.format->cpp[0]
|
- FB.bits_per_pixel >> 3
+ FB.format->cpp[0]
|
- (FB.bits_per_pixel + 7) / 8
+ FB.format->cpp[0]
|
- FB.bits_per_pixel
+ FB.format->cpp[0] * 8
|
- FB.format->cpp[0] * 8 != 8
+ FB.format->cpp[0] != 1
)
@@
struct drm_framebuffer *FB;
expression E;
@@
(
- E * FB->bits_per_pixel / 8
+ E * FB->format->cpp[0]
|
- FB->bits_per_pixel / 8
+ FB->format->cpp[0]
|
- E * FB->bits_per_pixel >> 3
+ E * FB->format->cpp[0]
|
- FB->bits_per_pixel >> 3
+ FB->format->cpp[0]
|
- (FB->bits_per_pixel + 7) / 8
+ FB->format->cpp[0]
|
- FB->bits_per_pixel
+ FB->format->cpp[0] * 8
|
- FB->format->cpp[0] * 8 != 8
+ FB->format->cpp[0] != 1
)
@@
struct drm_plane_state *state;
expression E;
@@
(
- E * state->fb->bits_per_pixel / 8
+ E * state->fb->format->cpp[0]
|
- state->fb->bits_per_pixel / 8
+ state->fb->format->cpp[0]
|
- E * state->fb->bits_per_pixel >> 3
+ E * state->fb->format->cpp[0]
|
- state->fb->bits_per_pixel >> 3
+ state->fb->format->cpp[0]
|
- (state->fb->bits_per_pixel + 7) / 8
+ state->fb->format->cpp[0]
|
- state->fb->bits_per_pixel
+ state->fb->format->cpp[0] * 8
|
- state->fb->format->cpp[0] * 8 != 8
+ state->fb->format->cpp[0] != 1
)
@@
@@
- (8 * 8)
+ 8 * 8
@@
struct drm_framebuffer FB;
@@
- (FB.format->cpp[0])
+ FB.format->cpp[0]
@@
struct drm_framebuffer *FB;
@@
- (FB->format->cpp[0])
+ FB->format->cpp[0]
@@
@@
struct drm_framebuffer {
...
- int bits_per_pixel;
...
};
v2: Clean up the 'cpp*8 != 8' and '(8 * 8)' cases (Laurent)
v3: Adjusted the semantic patch a bit and regenerated due to code
changes
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1481751140-18352-1-git-send-email-ville.syrjala@linux.intel.com
2016-12-15 14:55:34 +02:00
..
2016-12-13 10:36:39 +01:00
2016-10-24 19:37:48 +02:00
2016-12-13 10:36:39 +01:00
2016-09-15 19:15:55 -04:00
2016-10-06 17:03:41 +02:00
2016-11-30 14:18:51 +10:00
2016-09-09 12:00:37 +03:00
2016-11-30 16:32:52 -08:00
2016-10-20 10:14:49 +02:00
2016-10-17 13:46:09 -07:00
2016-12-13 10:36:39 +01:00
2016-11-30 15:15:49 -08:00
2016-10-20 21:58:58 +02:00
2016-10-29 01:29:17 +02:00
2016-10-15 09:26:12 -07:00
2016-11-17 22:14:21 +08:00
2016-11-16 09:00:38 -08:00
2016-10-11 00:01:20 +02:00
2016-11-17 16:09:23 +05:30
2016-12-13 17:54:28 +05:30
2016-10-04 12:06:26 -07:00
2016-10-26 16:04:29 +09:00
2016-11-03 14:46:39 +01:00
2016-10-19 14:49:44 +02:00
2016-09-08 17:31:44 +02:00
2016-11-16 20:46:32 +01:00
2016-12-15 14:55:34 +02:00
2016-11-23 17:54:58 +01:00
2016-11-01 09:07:13 -06:00
2016-10-24 06:05:13 -07:00
2016-09-09 13:53:00 +02:00
2016-11-29 20:04:21 +01:00
2016-10-07 18:46:30 -07:00
2016-11-13 10:08:32 +01:00
2016-11-17 13:53:02 -08:00
2016-12-01 10:29:41 -08:00
2016-11-27 08:24:46 -08:00
2016-10-27 18:43:43 -07:00
2016-10-21 21:40:29 +02:00
2016-09-20 10:22:10 +02:00
2016-10-07 14:42:05 -07:00
2016-09-20 20:57:12 +10:00
2016-11-14 22:07:38 +01:00
2016-09-27 12:33:47 +02:00
2016-11-05 11:34:07 -07:00
2016-11-23 21:04:26 -02:00
2016-10-07 21:23:40 -07:00
2016-10-17 15:43:05 +02:00
2016-09-14 14:26:19 -04:00
2016-11-25 11:10:55 +00:00
2016-10-31 10:25:22 -06:00
2016-11-21 11:08:28 +01:00
2016-11-05 10:52:29 -07:00
2016-12-13 10:36:39 +01:00
2016-10-31 10:25:22 -06:00
2016-11-13 16:48:30 -05:00
2016-11-18 16:13:41 -07:00
2016-11-16 12:39:57 -07:00
2016-10-07 21:23:40 -07:00
2016-11-29 23:17:02 -05:00
2016-10-10 20:16:43 -07:00
2016-12-01 16:44:42 -08:00
2016-11-11 08:45:08 -08:00
2016-10-17 15:50:07 +01:00
2016-11-17 16:25:40 +01:00
2016-11-07 10:31:33 +01:00
2016-11-11 17:02:01 -08:00
2016-10-06 18:21:15 -07:00
2016-09-08 08:13:08 +02:00
2016-10-11 15:06:32 -07:00
2016-09-20 20:57:12 +10:00
2016-10-13 10:20:06 -04:00
2016-11-29 16:43:24 +01:00
2016-10-19 08:11:43 -07:00
2016-10-28 18:22:40 +01:00
2016-10-06 17:03:49 -07:00
2016-10-22 18:31:42 +09:00
2016-09-12 07:05:13 -07:00
2016-11-04 23:11:39 +01:00
2016-10-27 14:16:30 -07:00
2016-11-29 11:15:37 -08:00
2016-10-14 11:07:42 -07:00
2016-10-29 12:51:55 -06:00
2016-09-27 12:43:34 +02:00
2016-12-13 10:36:39 +01:00
2016-10-21 01:19:44 -07:00
2016-11-21 20:54:40 +08:00
2016-10-28 08:13:07 -04:00
2016-11-18 15:49:31 +01:00
2016-11-01 09:04:04 -06:00
2016-10-26 13:49:29 -06:00
2016-09-05 08:04:07 +02:00
2016-12-13 10:36:39 +01:00
2016-10-19 08:11:43 -07:00
2016-11-18 16:13:41 -07:00
2016-10-28 08:25:18 -04:00
2016-11-25 22:24:07 +01:00
2016-10-24 19:52:24 -07:00
2016-10-23 15:56:23 -07:00