vsp1_drm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*
  2. * vsp1_drm.c -- R-Car VSP1 DRM API
  3. *
  4. * Copyright (C) 2015 Renesas Electronics Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include <linux/device.h>
  14. #include <linux/slab.h>
  15. #include <media/media-entity.h>
  16. #include <media/v4l2-subdev.h>
  17. #include <media/vsp1.h>
  18. #include "vsp1.h"
  19. #include "vsp1_bru.h"
  20. #include "vsp1_dl.h"
  21. #include "vsp1_drm.h"
  22. #include "vsp1_lif.h"
  23. #include "vsp1_pipe.h"
  24. #include "vsp1_rwpf.h"
  25. /* -----------------------------------------------------------------------------
  26. * Interrupt Handling
  27. */
  28. void vsp1_drm_display_start(struct vsp1_device *vsp1)
  29. {
  30. vsp1_dlm_irq_display_start(vsp1->drm->pipe.output->dlm);
  31. }
  32. /* -----------------------------------------------------------------------------
  33. * DU Driver API
  34. */
  35. int vsp1_du_init(struct device *dev)
  36. {
  37. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  38. if (!vsp1)
  39. return -EPROBE_DEFER;
  40. return 0;
  41. }
  42. EXPORT_SYMBOL_GPL(vsp1_du_init);
  43. /**
  44. * vsp1_du_setup_lif - Setup the output part of the VSP pipeline
  45. * @dev: the VSP device
  46. * @cfg: the LIF configuration
  47. *
  48. * Configure the output part of VSP DRM pipeline for the given frame @cfg.width
  49. * and @cfg.height. This sets up formats on the BRU source pad, the WPF0 sink
  50. * and source pads, and the LIF sink pad.
  51. *
  52. * As the media bus code on the BRU source pad is conditioned by the
  53. * configuration of the BRU sink 0 pad, we also set up the formats on all BRU
  54. * sinks, even if the configuration will be overwritten later by
  55. * vsp1_du_setup_rpf(). This ensures that the BRU configuration is set to a well
  56. * defined state.
  57. *
  58. * Return 0 on success or a negative error code on failure.
  59. */
  60. int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg)
  61. {
  62. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  63. struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
  64. struct vsp1_bru *bru = vsp1->bru;
  65. struct v4l2_subdev_format format;
  66. unsigned int i;
  67. int ret;
  68. if (!cfg) {
  69. /*
  70. * NULL configuration means the CRTC is being disabled, stop
  71. * the pipeline and turn the light off.
  72. */
  73. ret = vsp1_pipeline_stop(pipe);
  74. if (ret == -ETIMEDOUT)
  75. dev_err(vsp1->dev, "DRM pipeline stop timeout\n");
  76. media_pipeline_stop(&pipe->output->entity.subdev.entity);
  77. for (i = 0; i < bru->entity.source_pad; ++i) {
  78. vsp1->drm->inputs[i].enabled = false;
  79. bru->inputs[i].rpf = NULL;
  80. pipe->inputs[i] = NULL;
  81. }
  82. pipe->num_inputs = 0;
  83. vsp1_dlm_reset(pipe->output->dlm);
  84. vsp1_device_put(vsp1);
  85. dev_dbg(vsp1->dev, "%s: pipeline disabled\n", __func__);
  86. return 0;
  87. }
  88. dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n",
  89. __func__, cfg->width, cfg->height);
  90. /*
  91. * Configure the format at the BRU sinks and propagate it through the
  92. * pipeline.
  93. */
  94. memset(&format, 0, sizeof(format));
  95. format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  96. for (i = 0; i < bru->entity.source_pad; ++i) {
  97. format.pad = i;
  98. format.format.width = cfg->width;
  99. format.format.height = cfg->height;
  100. format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
  101. format.format.field = V4L2_FIELD_NONE;
  102. ret = v4l2_subdev_call(&bru->entity.subdev, pad,
  103. set_fmt, NULL, &format);
  104. if (ret < 0)
  105. return ret;
  106. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n",
  107. __func__, format.format.width, format.format.height,
  108. format.format.code, i);
  109. }
  110. format.pad = bru->entity.source_pad;
  111. format.format.width = cfg->width;
  112. format.format.height = cfg->height;
  113. format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
  114. format.format.field = V4L2_FIELD_NONE;
  115. ret = v4l2_subdev_call(&bru->entity.subdev, pad, set_fmt, NULL,
  116. &format);
  117. if (ret < 0)
  118. return ret;
  119. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n",
  120. __func__, format.format.width, format.format.height,
  121. format.format.code, i);
  122. format.pad = RWPF_PAD_SINK;
  123. ret = v4l2_subdev_call(&vsp1->wpf[0]->entity.subdev, pad, set_fmt, NULL,
  124. &format);
  125. if (ret < 0)
  126. return ret;
  127. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on WPF0 sink\n",
  128. __func__, format.format.width, format.format.height,
  129. format.format.code);
  130. format.pad = RWPF_PAD_SOURCE;
  131. ret = v4l2_subdev_call(&vsp1->wpf[0]->entity.subdev, pad, get_fmt, NULL,
  132. &format);
  133. if (ret < 0)
  134. return ret;
  135. dev_dbg(vsp1->dev, "%s: got format %ux%u (%x) on WPF0 source\n",
  136. __func__, format.format.width, format.format.height,
  137. format.format.code);
  138. format.pad = LIF_PAD_SINK;
  139. ret = v4l2_subdev_call(&vsp1->lif->entity.subdev, pad, set_fmt, NULL,
  140. &format);
  141. if (ret < 0)
  142. return ret;
  143. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on LIF sink\n",
  144. __func__, format.format.width, format.format.height,
  145. format.format.code);
  146. /*
  147. * Verify that the format at the output of the pipeline matches the
  148. * requested frame size and media bus code.
  149. */
  150. if (format.format.width != cfg->width ||
  151. format.format.height != cfg->height ||
  152. format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) {
  153. dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__);
  154. return -EPIPE;
  155. }
  156. /*
  157. * Mark the pipeline as streaming and enable the VSP1. This will store
  158. * the pipeline pointer in all entities, which the s_stream handlers
  159. * will need. We don't start the entities themselves right at this point
  160. * as there's no plane configured yet, so we can't start processing
  161. * buffers.
  162. */
  163. ret = vsp1_device_get(vsp1);
  164. if (ret < 0)
  165. return ret;
  166. ret = media_pipeline_start(&pipe->output->entity.subdev.entity,
  167. &pipe->pipe);
  168. if (ret < 0) {
  169. dev_dbg(vsp1->dev, "%s: pipeline start failed\n", __func__);
  170. vsp1_device_put(vsp1);
  171. return ret;
  172. }
  173. dev_dbg(vsp1->dev, "%s: pipeline enabled\n", __func__);
  174. return 0;
  175. }
  176. EXPORT_SYMBOL_GPL(vsp1_du_setup_lif);
  177. /**
  178. * vsp1_du_atomic_begin - Prepare for an atomic update
  179. * @dev: the VSP device
  180. */
  181. void vsp1_du_atomic_begin(struct device *dev)
  182. {
  183. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  184. struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
  185. vsp1->drm->num_inputs = pipe->num_inputs;
  186. }
  187. EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin);
  188. /**
  189. * vsp1_du_atomic_update - Setup one RPF input of the VSP pipeline
  190. * @dev: the VSP device
  191. * @rpf_index: index of the RPF to setup (0-based)
  192. * @cfg: the RPF configuration
  193. *
  194. * Configure the VSP to perform image composition through RPF @rpf_index as
  195. * described by the @cfg configuration. The image to compose is referenced by
  196. * @cfg.mem and composed using the @cfg.src crop rectangle and the @cfg.dst
  197. * composition rectangle. The Z-order is configurable with higher @zpos values
  198. * displayed on top.
  199. *
  200. * If the @cfg configuration is NULL, the RPF will be disabled. Calling the
  201. * function on a disabled RPF is allowed.
  202. *
  203. * Image format as stored in memory is expressed as a V4L2 @cfg.pixelformat
  204. * value. The memory pitch is configurable to allow for padding at end of lines,
  205. * or simply for images that extend beyond the crop rectangle boundaries. The
  206. * @cfg.pitch value is expressed in bytes and applies to all planes for
  207. * multiplanar formats.
  208. *
  209. * The source memory buffer is referenced by the DMA address of its planes in
  210. * the @cfg.mem array. Up to two planes are supported. The second plane DMA
  211. * address is ignored for formats using a single plane.
  212. *
  213. * This function isn't reentrant, the caller needs to serialize calls.
  214. *
  215. * Return 0 on success or a negative error code on failure.
  216. */
  217. int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
  218. const struct vsp1_du_atomic_config *cfg)
  219. {
  220. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  221. const struct vsp1_format_info *fmtinfo;
  222. struct vsp1_rwpf *rpf;
  223. if (rpf_index >= vsp1->info->rpf_count)
  224. return -EINVAL;
  225. rpf = vsp1->rpf[rpf_index];
  226. if (!cfg) {
  227. dev_dbg(vsp1->dev, "%s: RPF%u: disable requested\n", __func__,
  228. rpf_index);
  229. vsp1->drm->inputs[rpf_index].enabled = false;
  230. return 0;
  231. }
  232. dev_dbg(vsp1->dev,
  233. "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad, %pad } zpos %u\n",
  234. __func__, rpf_index,
  235. cfg->src.left, cfg->src.top, cfg->src.width, cfg->src.height,
  236. cfg->dst.left, cfg->dst.top, cfg->dst.width, cfg->dst.height,
  237. cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1],
  238. &cfg->mem[2], cfg->zpos);
  239. /*
  240. * Store the format, stride, memory buffer address, crop and compose
  241. * rectangles and Z-order position and for the input.
  242. */
  243. fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat);
  244. if (!fmtinfo) {
  245. dev_dbg(vsp1->dev, "Unsupport pixel format %08x for RPF\n",
  246. cfg->pixelformat);
  247. return -EINVAL;
  248. }
  249. rpf->fmtinfo = fmtinfo;
  250. rpf->format.num_planes = fmtinfo->planes;
  251. rpf->format.plane_fmt[0].bytesperline = cfg->pitch;
  252. rpf->format.plane_fmt[1].bytesperline = cfg->pitch;
  253. rpf->alpha = cfg->alpha;
  254. rpf->mem.addr[0] = cfg->mem[0];
  255. rpf->mem.addr[1] = cfg->mem[1];
  256. rpf->mem.addr[2] = cfg->mem[2];
  257. vsp1->drm->inputs[rpf_index].crop = cfg->src;
  258. vsp1->drm->inputs[rpf_index].compose = cfg->dst;
  259. vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
  260. vsp1->drm->inputs[rpf_index].enabled = true;
  261. return 0;
  262. }
  263. EXPORT_SYMBOL_GPL(vsp1_du_atomic_update);
  264. static int vsp1_du_setup_rpf_pipe(struct vsp1_device *vsp1,
  265. struct vsp1_rwpf *rpf, unsigned int bru_input)
  266. {
  267. struct v4l2_subdev_selection sel;
  268. struct v4l2_subdev_format format;
  269. const struct v4l2_rect *crop;
  270. int ret;
  271. /*
  272. * Configure the format on the RPF sink pad and propagate it up to the
  273. * BRU sink pad.
  274. */
  275. crop = &vsp1->drm->inputs[rpf->entity.index].crop;
  276. memset(&format, 0, sizeof(format));
  277. format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  278. format.pad = RWPF_PAD_SINK;
  279. format.format.width = crop->width + crop->left;
  280. format.format.height = crop->height + crop->top;
  281. format.format.code = rpf->fmtinfo->mbus;
  282. format.format.field = V4L2_FIELD_NONE;
  283. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL,
  284. &format);
  285. if (ret < 0)
  286. return ret;
  287. dev_dbg(vsp1->dev,
  288. "%s: set format %ux%u (%x) on RPF%u sink\n",
  289. __func__, format.format.width, format.format.height,
  290. format.format.code, rpf->entity.index);
  291. memset(&sel, 0, sizeof(sel));
  292. sel.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  293. sel.pad = RWPF_PAD_SINK;
  294. sel.target = V4L2_SEL_TGT_CROP;
  295. sel.r = *crop;
  296. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_selection, NULL,
  297. &sel);
  298. if (ret < 0)
  299. return ret;
  300. dev_dbg(vsp1->dev,
  301. "%s: set selection (%u,%u)/%ux%u on RPF%u sink\n",
  302. __func__, sel.r.left, sel.r.top, sel.r.width, sel.r.height,
  303. rpf->entity.index);
  304. /*
  305. * RPF source, hardcode the format to ARGB8888 to turn on format
  306. * conversion if needed.
  307. */
  308. format.pad = RWPF_PAD_SOURCE;
  309. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, get_fmt, NULL,
  310. &format);
  311. if (ret < 0)
  312. return ret;
  313. dev_dbg(vsp1->dev,
  314. "%s: got format %ux%u (%x) on RPF%u source\n",
  315. __func__, format.format.width, format.format.height,
  316. format.format.code, rpf->entity.index);
  317. format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
  318. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL,
  319. &format);
  320. if (ret < 0)
  321. return ret;
  322. /* BRU sink, propagate the format from the RPF source. */
  323. format.pad = bru_input;
  324. ret = v4l2_subdev_call(&vsp1->bru->entity.subdev, pad, set_fmt, NULL,
  325. &format);
  326. if (ret < 0)
  327. return ret;
  328. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n",
  329. __func__, format.format.width, format.format.height,
  330. format.format.code, format.pad);
  331. sel.pad = bru_input;
  332. sel.target = V4L2_SEL_TGT_COMPOSE;
  333. sel.r = vsp1->drm->inputs[rpf->entity.index].compose;
  334. ret = v4l2_subdev_call(&vsp1->bru->entity.subdev, pad, set_selection,
  335. NULL, &sel);
  336. if (ret < 0)
  337. return ret;
  338. dev_dbg(vsp1->dev,
  339. "%s: set selection (%u,%u)/%ux%u on BRU pad %u\n",
  340. __func__, sel.r.left, sel.r.top, sel.r.width, sel.r.height,
  341. sel.pad);
  342. return 0;
  343. }
  344. static unsigned int rpf_zpos(struct vsp1_device *vsp1, struct vsp1_rwpf *rpf)
  345. {
  346. return vsp1->drm->inputs[rpf->entity.index].zpos;
  347. }
  348. /**
  349. * vsp1_du_atomic_flush - Commit an atomic update
  350. * @dev: the VSP device
  351. */
  352. void vsp1_du_atomic_flush(struct device *dev)
  353. {
  354. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  355. struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
  356. struct vsp1_rwpf *inputs[VSP1_MAX_RPF] = { NULL, };
  357. struct vsp1_entity *entity;
  358. struct vsp1_dl_list *dl;
  359. unsigned long flags;
  360. unsigned int i;
  361. int ret;
  362. /* Prepare the display list. */
  363. dl = vsp1_dl_list_get(pipe->output->dlm);
  364. /* Count the number of enabled inputs and sort them by Z-order. */
  365. pipe->num_inputs = 0;
  366. for (i = 0; i < vsp1->info->rpf_count; ++i) {
  367. struct vsp1_rwpf *rpf = vsp1->rpf[i];
  368. unsigned int j;
  369. if (!vsp1->drm->inputs[i].enabled) {
  370. pipe->inputs[i] = NULL;
  371. continue;
  372. }
  373. pipe->inputs[i] = rpf;
  374. /* Insert the RPF in the sorted RPFs array. */
  375. for (j = pipe->num_inputs++; j > 0; --j) {
  376. if (rpf_zpos(vsp1, inputs[j-1]) <= rpf_zpos(vsp1, rpf))
  377. break;
  378. inputs[j] = inputs[j-1];
  379. }
  380. inputs[j] = rpf;
  381. }
  382. /* Setup the RPF input pipeline for every enabled input. */
  383. for (i = 0; i < vsp1->info->num_bru_inputs; ++i) {
  384. struct vsp1_rwpf *rpf = inputs[i];
  385. if (!rpf) {
  386. vsp1->bru->inputs[i].rpf = NULL;
  387. continue;
  388. }
  389. vsp1->bru->inputs[i].rpf = rpf;
  390. rpf->bru_input = i;
  391. rpf->entity.sink_pad = i;
  392. dev_dbg(vsp1->dev, "%s: connecting RPF.%u to BRU:%u\n",
  393. __func__, rpf->entity.index, i);
  394. ret = vsp1_du_setup_rpf_pipe(vsp1, rpf, i);
  395. if (ret < 0)
  396. dev_err(vsp1->dev,
  397. "%s: failed to setup RPF.%u\n",
  398. __func__, rpf->entity.index);
  399. }
  400. /* Configure all entities in the pipeline. */
  401. list_for_each_entry(entity, &pipe->entities, list_pipe) {
  402. /* Disconnect unused RPFs from the pipeline. */
  403. if (entity->type == VSP1_ENTITY_RPF) {
  404. struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
  405. if (!pipe->inputs[rpf->entity.index]) {
  406. vsp1_dl_list_write(dl, entity->route->reg,
  407. VI6_DPR_NODE_UNUSED);
  408. continue;
  409. }
  410. }
  411. vsp1_entity_route_setup(entity, pipe, dl);
  412. if (entity->ops->configure) {
  413. entity->ops->configure(entity, pipe, dl,
  414. VSP1_ENTITY_PARAMS_INIT);
  415. entity->ops->configure(entity, pipe, dl,
  416. VSP1_ENTITY_PARAMS_RUNTIME);
  417. entity->ops->configure(entity, pipe, dl,
  418. VSP1_ENTITY_PARAMS_PARTITION);
  419. }
  420. }
  421. vsp1_dl_list_commit(dl);
  422. /* Start or stop the pipeline if needed. */
  423. if (!vsp1->drm->num_inputs && pipe->num_inputs) {
  424. vsp1_write(vsp1, VI6_DISP_IRQ_STA, 0);
  425. vsp1_write(vsp1, VI6_DISP_IRQ_ENB, VI6_DISP_IRQ_ENB_DSTE);
  426. spin_lock_irqsave(&pipe->irqlock, flags);
  427. vsp1_pipeline_run(pipe);
  428. spin_unlock_irqrestore(&pipe->irqlock, flags);
  429. } else if (vsp1->drm->num_inputs && !pipe->num_inputs) {
  430. vsp1_write(vsp1, VI6_DISP_IRQ_ENB, 0);
  431. vsp1_pipeline_stop(pipe);
  432. }
  433. }
  434. EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush);
  435. /* -----------------------------------------------------------------------------
  436. * Initialization
  437. */
  438. int vsp1_drm_create_links(struct vsp1_device *vsp1)
  439. {
  440. const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
  441. unsigned int i;
  442. int ret;
  443. /*
  444. * VSPD instances require a BRU to perform composition and a LIF to
  445. * output to the DU.
  446. */
  447. if (!vsp1->bru || !vsp1->lif)
  448. return -ENXIO;
  449. for (i = 0; i < vsp1->info->rpf_count; ++i) {
  450. struct vsp1_rwpf *rpf = vsp1->rpf[i];
  451. ret = media_create_pad_link(&rpf->entity.subdev.entity,
  452. RWPF_PAD_SOURCE,
  453. &vsp1->bru->entity.subdev.entity,
  454. i, flags);
  455. if (ret < 0)
  456. return ret;
  457. rpf->entity.sink = &vsp1->bru->entity.subdev.entity;
  458. rpf->entity.sink_pad = i;
  459. }
  460. ret = media_create_pad_link(&vsp1->bru->entity.subdev.entity,
  461. vsp1->bru->entity.source_pad,
  462. &vsp1->wpf[0]->entity.subdev.entity,
  463. RWPF_PAD_SINK, flags);
  464. if (ret < 0)
  465. return ret;
  466. vsp1->bru->entity.sink = &vsp1->wpf[0]->entity.subdev.entity;
  467. vsp1->bru->entity.sink_pad = RWPF_PAD_SINK;
  468. ret = media_create_pad_link(&vsp1->wpf[0]->entity.subdev.entity,
  469. RWPF_PAD_SOURCE,
  470. &vsp1->lif->entity.subdev.entity,
  471. LIF_PAD_SINK, flags);
  472. if (ret < 0)
  473. return ret;
  474. return 0;
  475. }
  476. int vsp1_drm_init(struct vsp1_device *vsp1)
  477. {
  478. struct vsp1_pipeline *pipe;
  479. unsigned int i;
  480. vsp1->drm = devm_kzalloc(vsp1->dev, sizeof(*vsp1->drm), GFP_KERNEL);
  481. if (!vsp1->drm)
  482. return -ENOMEM;
  483. pipe = &vsp1->drm->pipe;
  484. vsp1_pipeline_init(pipe);
  485. /* The DRM pipeline is static, add entities manually. */
  486. for (i = 0; i < vsp1->info->rpf_count; ++i) {
  487. struct vsp1_rwpf *input = vsp1->rpf[i];
  488. list_add_tail(&input->entity.list_pipe, &pipe->entities);
  489. }
  490. list_add_tail(&vsp1->bru->entity.list_pipe, &pipe->entities);
  491. list_add_tail(&vsp1->wpf[0]->entity.list_pipe, &pipe->entities);
  492. list_add_tail(&vsp1->lif->entity.list_pipe, &pipe->entities);
  493. pipe->bru = &vsp1->bru->entity;
  494. pipe->lif = &vsp1->lif->entity;
  495. pipe->output = vsp1->wpf[0];
  496. pipe->output->pipe = pipe;
  497. return 0;
  498. }
  499. void vsp1_drm_cleanup(struct vsp1_device *vsp1)
  500. {
  501. }