aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_framebuffer.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2017-03-21 14:12:15 -0400
committerVille Syrjälä <ville.syrjala@linux.intel.com>2017-03-22 13:44:15 -0400
commit33f673aa55e96ee37bb85200a24e4da12ba4d3f2 (patch)
tree86a08eb6df418b21701d82447268100fb4aa5556 /drivers/gpu/drm/drm_framebuffer.c
parent568c5e453666fd8e0a8b11b440291f59e4da28c8 (diff)
drm: Remove fb hsub/vsub alignment requirement
Allow framebuffers dimesions to be misaligned w.r.t. the subsampling factors. No real reason the core should have to enforce this, and it definitely starts to cause us issues with the i915 CCS support. So let's just lift the restriction. Let's start to round up when computing the color plane dimesions so that we'll not end up with too low an estimate for the memory requirements and whatnot. Cc: Ben Widawsky <ben@bwidawsk.net> Cc: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170321181218.10042-3-ville.syrjala@linux.intel.com Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Diffstat (limited to 'drivers/gpu/drm/drm_framebuffer.c')
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 1138f90a7d5d..69e4c1487420 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -132,7 +132,7 @@ static int fb_plane_width(int width,
132 if (plane == 0) 132 if (plane == 0)
133 return width; 133 return width;
134 134
135 return width / format->hsub; 135 return DIV_ROUND_UP(width, format->hsub);
136} 136}
137 137
138static int fb_plane_height(int height, 138static int fb_plane_height(int height,
@@ -141,7 +141,7 @@ static int fb_plane_height(int height,
141 if (plane == 0) 141 if (plane == 0)
142 return height; 142 return height;
143 143
144 return height / format->vsub; 144 return DIV_ROUND_UP(height, format->vsub);
145} 145}
146 146
147static int framebuffer_check(const struct drm_mode_fb_cmd2 *r) 147static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
@@ -158,12 +158,12 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
158 return -EINVAL; 158 return -EINVAL;
159 } 159 }
160 160
161 if (r->width == 0 || r->width % info->hsub) { 161 if (r->width == 0) {
162 DRM_DEBUG_KMS("bad framebuffer width %u\n", r->width); 162 DRM_DEBUG_KMS("bad framebuffer width %u\n", r->width);
163 return -EINVAL; 163 return -EINVAL;
164 } 164 }
165 165
166 if (r->height == 0 || r->height % info->vsub) { 166 if (r->height == 0) {
167 DRM_DEBUG_KMS("bad framebuffer height %u\n", r->height); 167 DRM_DEBUG_KMS("bad framebuffer height %u\n", r->height);
168 return -EINVAL; 168 return -EINVAL;
169 } 169 }