freedreno/drm: Add fd_device_open() helper
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14900>
This commit is contained in:
parent
2bc815878c
commit
9ea36968d3
|
@ -236,11 +236,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
int fd = drmOpenWithType("msm", NULL, DRM_NODE_RENDER);
|
||||
if (fd < 0)
|
||||
err(1, "could not open drm device");
|
||||
|
||||
struct fd_device *dev = fd_device_new(fd);
|
||||
struct fd_device *dev = fd_device_open();
|
||||
struct fd_pipe *pipe = fd_pipe_new(dev, FD_PIPE_3D);
|
||||
|
||||
const struct fd_dev_id *dev_id = fd_pipe_dev_id(pipe);
|
||||
|
|
|
@ -106,6 +106,20 @@ fd_device_new_dup(int fd)
|
|||
return dev;
|
||||
}
|
||||
|
||||
/* Convenience helper to open the drm device and return new fd_device:
|
||||
*/
|
||||
struct fd_device *
|
||||
fd_device_open(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = drmOpenWithType("msm", NULL, DRM_NODE_RENDER);
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
|
||||
return fd_device_new(fd);
|
||||
}
|
||||
|
||||
struct fd_device *
|
||||
fd_device_ref(struct fd_device *dev)
|
||||
{
|
||||
|
|
|
@ -115,6 +115,7 @@ struct fd_fence {
|
|||
|
||||
struct fd_device *fd_device_new(int fd);
|
||||
struct fd_device *fd_device_new_dup(int fd);
|
||||
struct fd_device *fd_device_open(void);
|
||||
struct fd_device *fd_device_ref(struct fd_device *dev);
|
||||
void fd_device_purge(struct fd_device *dev);
|
||||
void fd_device_del(struct fd_device *dev);
|
||||
|
|
|
@ -118,13 +118,12 @@ delta(uint32_t a, uint32_t b)
|
|||
static void
|
||||
find_device(void)
|
||||
{
|
||||
int ret, fd;
|
||||
int ret;
|
||||
|
||||
fd = drmOpenWithType("msm", NULL, DRM_NODE_RENDER);
|
||||
if (fd < 0)
|
||||
dev.dev = fd_device_open();
|
||||
if (!dev.dev)
|
||||
err(1, "could not open drm device");
|
||||
|
||||
dev.dev = fd_device_new(fd);
|
||||
dev.pipe = fd_pipe_new(dev.dev, FD_PIPE_3D);
|
||||
|
||||
uint64_t val;
|
||||
|
|
Loading…
Reference in New Issue