aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>2015-04-27 17:10:13 -0400
committerInki Dae <daeinki@gmail.com>2015-05-19 09:50:51 -0400
commitd10ebb9f136669a1e9fa388fc450bf1822c93dd5 (patch)
tree1134c245efca65f77c1be90059aebfce85fc8793
parent64d237e66d562348f04a9c04a45455c1f3201ced (diff)
drm/exynos: fb: use drm_format_num_planes to get buffer count
The previous code had some special case handling for the buffer count in exynos_drm_format_num_buffers(). This code was incorrect though, since this special case doesn't exist for DRM. It stemmed from the existence of the special NV12M V4L2 format. NV12 is a bi-planar format (separate planes for luma and chroma) and V4L2 differentiates between a NV12 buffer where luma and chroma is contiguous in memory (so no data between luma/chroma), and a NV12 buffer where luma and chroma have two explicit memory locations (which is then called NV12M). This distinction doesn't exist for DRM. A bi-planar format always explicitly comes with the information about its two planes (even if these planes should be contiguous). Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Acked-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fb.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 929cb03a8eab..142eb4e3f59e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -171,43 +171,6 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
171 return &exynos_fb->fb; 171 return &exynos_fb->fb;
172} 172}
173 173
174static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd)
175{
176 unsigned int cnt = 0;
177
178 if (mode_cmd->pixel_format != DRM_FORMAT_NV12)
179 return drm_format_num_planes(mode_cmd->pixel_format);
180
181 while (cnt != MAX_FB_BUFFER) {
182 if (!mode_cmd->handles[cnt])
183 break;
184 cnt++;
185 }
186
187 /*
188 * check if NV12 or NV12M.
189 *
190 * NV12
191 * handles[0] = base1, offsets[0] = 0
192 * handles[1] = base1, offsets[1] = Y_size
193 *
194 * NV12M
195 * handles[0] = base1, offsets[0] = 0
196 * handles[1] = base2, offsets[1] = 0
197 */
198 if (cnt == 2) {
199 /*
200 * in case of NV12 format, offsets[1] is not 0 and
201 * handles[0] is same as handles[1].
202 */
203 if (mode_cmd->offsets[1] &&
204 mode_cmd->handles[0] == mode_cmd->handles[1])
205 cnt = 1;
206 }
207
208 return cnt;
209}
210
211static struct drm_framebuffer * 174static struct drm_framebuffer *
212exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, 175exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
213 struct drm_mode_fb_cmd2 *mode_cmd) 176 struct drm_mode_fb_cmd2 *mode_cmd)
@@ -230,7 +193,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
230 193
231 drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); 194 drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
232 exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); 195 exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj);
233 exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); 196 exynos_fb->buf_cnt = drm_format_num_planes(mode_cmd->pixel_format);
234 197
235 DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); 198 DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
236 199