Merge "Keep ADF device alive for the lifetime of the minui backend"
am: 14352497f0
* commit '14352497f02c38d4f9df46820284c100a1fb58d3':
Keep ADF device alive for the lifetime of the minui backend
Change-Id: I454b5dcae5bd2ee2e17d607ba70c6c020c76f387
This commit is contained in:
@@ -42,6 +42,8 @@ struct adf_pdata {
|
|||||||
adf_id_t eng_id;
|
adf_id_t eng_id;
|
||||||
__u32 format;
|
__u32 format;
|
||||||
|
|
||||||
|
adf_device dev;
|
||||||
|
|
||||||
unsigned int current_surface;
|
unsigned int current_surface;
|
||||||
unsigned int n_surfaces;
|
unsigned int n_surfaces;
|
||||||
adf_surface_pdata surfaces[2];
|
adf_surface_pdata surfaces[2];
|
||||||
@@ -163,21 +165,20 @@ static GRSurface* adf_init(minui_backend *backend)
|
|||||||
pdata->intf_fd = -1;
|
pdata->intf_fd = -1;
|
||||||
|
|
||||||
for (i = 0; i < n_dev_ids && pdata->intf_fd < 0; i++) {
|
for (i = 0; i < n_dev_ids && pdata->intf_fd < 0; i++) {
|
||||||
adf_device dev;
|
|
||||||
|
|
||||||
int err = adf_device_open(dev_ids[i], O_RDWR, &dev);
|
int err = adf_device_open(dev_ids[i], O_RDWR, &pdata->dev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
fprintf(stderr, "opening adf device %u failed: %s\n", dev_ids[i],
|
fprintf(stderr, "opening adf device %u failed: %s\n", dev_ids[i],
|
||||||
strerror(-err));
|
strerror(-err));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = adf_device_init(pdata, &dev);
|
err = adf_device_init(pdata, &pdata->dev);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
fprintf(stderr, "initializing adf device %u failed: %s\n",
|
fprintf(stderr, "initializing adf device %u failed: %s\n",
|
||||||
dev_ids[i], strerror(-err));
|
dev_ids[i], strerror(-err));
|
||||||
|
adf_device_close(&pdata->dev);
|
||||||
adf_device_close(&dev);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dev_ids);
|
free(dev_ids);
|
||||||
@@ -226,6 +227,7 @@ static void adf_exit(minui_backend *backend)
|
|||||||
adf_pdata *pdata = (adf_pdata *)backend;
|
adf_pdata *pdata = (adf_pdata *)backend;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
adf_device_close(&pdata->dev);
|
||||||
for (i = 0; i < pdata->n_surfaces; i++)
|
for (i = 0; i < pdata->n_surfaces; i++)
|
||||||
adf_surface_destroy(&pdata->surfaces[i]);
|
adf_surface_destroy(&pdata->surfaces[i]);
|
||||||
if (pdata->intf_fd >= 0)
|
if (pdata->intf_fd >= 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user