xwayland/glamor/gbm: simplify render node check
No need to call is_device_path_render_node() on each node, the index is the node type. Saves a couple of open()/close()/IOCTLs. Signed-off-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1237>
This commit is contained in:
parent
5b43fd8393
commit
005912d82f
|
@ -861,21 +861,17 @@ static const char *
|
||||||
get_render_node_path_for_device(const drmDevicePtr drm_device,
|
get_render_node_path_for_device(const drmDevicePtr drm_device,
|
||||||
const char *device_path)
|
const char *device_path)
|
||||||
{
|
{
|
||||||
char *render_node_path = NULL;
|
const char *render_node_path;
|
||||||
char device_found = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!(drm_device->available_nodes & (1 << DRM_NODE_RENDER)))
|
||||||
|
return NULL;
|
||||||
|
render_node_path = drm_device->nodes[DRM_NODE_RENDER];
|
||||||
|
|
||||||
for (i = 0; i < DRM_NODE_MAX; i++) {
|
for (i = 0; i < DRM_NODE_MAX; i++) {
|
||||||
if ((drm_device->available_nodes & (1 << i)) == 0)
|
if (!(drm_device->available_nodes & (1 << i)))
|
||||||
continue;
|
continue;
|
||||||
|
if (strcmp(device_path, drm_device->nodes[i]) == 0)
|
||||||
if (!strcmp (device_path, drm_device->nodes[i]))
|
|
||||||
device_found = 1;
|
|
||||||
|
|
||||||
if (is_device_path_render_node(drm_device->nodes[i]))
|
|
||||||
render_node_path = drm_device->nodes[i];
|
|
||||||
|
|
||||||
if (device_found && render_node_path)
|
|
||||||
return render_node_path;
|
return render_node_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue