Lines Matching refs:pdata
53 static int adf_surface_init(adf_pdata *pdata, drm_mode_modeinfo *mode, adf_surface_pdata *surf) {
56 surf->fd = adf_interface_simple_buffer_alloc(pdata->intf_fd, mode->hdisplay,
57 mode->vdisplay, pdata->format, &surf->offset, &surf->pitch);
64 surf->base.pixel_bytes = (pdata->format == DRM_FORMAT_RGB565) ? 2 : 4;
77 static int adf_interface_init(adf_pdata *pdata)
83 err = adf_get_interface_data(pdata->intf_fd, &intf_data);
87 err = adf_surface_init(pdata, &intf_data.current_mode, &pdata->surfaces[0]);
94 err = adf_surface_init(pdata, &intf_data.current_mode,
95 &pdata->surfaces[1]);
98 memset(&pdata->surfaces[1], 0, sizeof(pdata->surfaces[1]));
99 pdata->n_surfaces = 1;
101 pdata->n_surfaces = 2;
109 static int adf_device_init(adf_pdata *pdata, adf_device *dev)
115 err = adf_find_simple_post_configuration(dev, &pdata->format, 1, &intf_id,
116 &pdata->eng_id);
120 err = adf_device_attach(dev, pdata->eng_id, intf_id);
124 pdata->intf_fd = adf_interface_open(dev, intf_id, O_RDWR);
125 if (pdata->intf_fd < 0)
126 return pdata->intf_fd;
128 err = adf_interface_init(pdata);
130 close(pdata->intf_fd);
131 pdata->intf_fd = -1;
139 adf_pdata *pdata = (adf_pdata *)backend;
145 pdata->format = DRM_FORMAT_ABGR8888;
147 pdata->format = DRM_FORMAT_BGRA8888;
149 pdata->format = DRM_FORMAT_RGBX8888;
151 pdata->format = DRM_FORMAT_RGB565;
163 pdata->intf_fd = -1;
165 for (i = 0; i < n_dev_ids && pdata->intf_fd < 0; i++) {
175 err = adf_device_init(pdata, &dev);
185 if (pdata->intf_fd < 0)
198 adf_pdata *pdata = (adf_pdata *)backend;
199 adf_surface_pdata *surf = &pdata->surfaces[pdata->current_surface];
201 int fence_fd = adf_interface_simple_post(pdata->intf_fd, pdata->eng_id,
202 surf->base.width, surf->base.height, pdata->format, surf->fd,
207 pdata->current_surface = (pdata->current_surface + 1) % pdata->n_surfaces;
208 return &pdata->surfaces[pdata->current_surface].base;
213 adf_pdata *pdata = (adf_pdata *)backend;
214 adf_interface_blank(pdata->intf_fd,
226 adf_pdata *pdata = (adf_pdata *)backend;
229 for (i = 0; i < pdata->n_surfaces; i++)
230 adf_surface_destroy(&pdata->surfaces[i]);
231 if (pdata->intf_fd >= 0)
232 close(pdata->intf_fd);
233 free(pdata);
238 adf_pdata* pdata = reinterpret_cast<adf_pdata*>(calloc(1, sizeof(*pdata)));
239 if (!pdata) {
244 pdata->base.init = adf_init;
245 pdata->base.flip = adf_flip;
246 pdata->base.blank = adf_blank;
247 pdata->base.exit = adf_exit;
248 return &pdata->base;