On 05/31/2012 08:11 PM, Sascha Hauer wrote:
On Thu, May 31, 2012 at 11:34:37AM +0200, Lars-Peter Clausen wrote:
- drm_helper_mode_fill_fb_struct(&fb_cma->fb, mode_cmd);
- for (i = 0; i < num_planes; i++)
fb_cma->obj[i] = obj[i];
Check for valid num_planes before this loop?
Hm, I think the callers already take care of this. drm_format_num_planes will always return a valid number and the other caller passes 1 unconditionally.
As long as the array always is big enough to hold the maximum number of planes I think it's fine. However, if there is some format with 5 planes (don't know if there is, I only know yuv with multiple planes) it's not obvious that this code does not support this.
The DRM ABI limits the number of planes to 4. But adding a global DRM_MAX_PLANES is probably a good idea to avoid surprises if this ever changes.