[PATCH v3 00/24] i.MX Media Driver

From
Steve Longerbeam <slongerbeam@gmail.com>
Date
2017-02-03 18:49:49
Also in
linux-devicetree, linux-media, lkml
Reply to
Russell King - ARM Linux, 2017-02-02

On 02/02/2017 02:29 PM, Russell King - ARM Linux wrote:
On Thu, Feb 02, 2017 at 11:12:41AM -0800, Steve Longerbeam wrote:
quoted
Here is the current .queue_setup() op in imx-media-capture.c:

static int capture_queue_setup(struct vb2_queue *vq,
                                unsigned int *nbuffers,
                                unsigned int *nplanes,
                                unsigned int sizes[],
                                struct device *alloc_devs[])
{
         struct capture_priv *priv = vb2_get_drv_priv(vq);
         struct v4l2_pix_format *pix = &priv->vdev.fmt.fmt.pix;
         unsigned int count = *nbuffers;

         if (vq->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                 return -EINVAL;

         if (*nplanes) {
                 if (*nplanes != 1 || sizes[0] < pix->sizeimage)
                         return -EINVAL;
                 count += vq->num_buffers;
         }

         while (pix->sizeimage * count > VID_MEM_LIMIT)
                 count--;
That's a weird way of writing:

	unsigned int max_num = VID_MEM_LIMIT / pix->sizeimage;
	count = max(count, max_num);
I think you mean min() there, but yes thanks, fixed.

Steve
Thread (168 messages) 168 messages, 12 authors, last reply 2017-02-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help