mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
pvr: Rename primary_{device,fd,path} to display_*
This makes it explicit that primary_fd is NOT just a handle to the primary node on render_fd - rather it's a handle to the primary node on a separate display device. Signed-off-by: Matt Coster <matt.coster@imgtec.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
This commit is contained in:
parent
157499bd05
commit
31e98d3783
11 changed files with 47 additions and 47 deletions
|
|
@ -251,7 +251,7 @@ static void pvr_physical_device_finish(struct pvr_physical_device *pdevice)
|
|||
pvr_winsys_destroy(pdevice->ws);
|
||||
|
||||
vk_free(&pdevice->vk.instance->alloc, pdevice->render_path);
|
||||
vk_free(&pdevice->vk.instance->alloc, pdevice->primary_path);
|
||||
vk_free(&pdevice->vk.instance->alloc, pdevice->display_path);
|
||||
|
||||
vk_physical_device_finish(&pdevice->vk);
|
||||
}
|
||||
|
|
@ -329,12 +329,12 @@ static uint64_t pvr_compute_heap_size(void)
|
|||
static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice,
|
||||
struct pvr_instance *instance,
|
||||
drmDevicePtr drm_render_device,
|
||||
drmDevicePtr drm_primary_device)
|
||||
drmDevicePtr drm_display_device)
|
||||
{
|
||||
struct vk_physical_device_dispatch_table dispatch_table;
|
||||
struct vk_device_extension_table supported_extensions;
|
||||
struct pvr_winsys *ws;
|
||||
char *primary_path;
|
||||
char *display_path;
|
||||
char *render_path;
|
||||
VkResult result;
|
||||
|
||||
|
|
@ -356,21 +356,21 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice,
|
|||
}
|
||||
|
||||
if (instance->vk.enabled_extensions.KHR_display) {
|
||||
primary_path = vk_strdup(&instance->vk.alloc,
|
||||
drm_primary_device->nodes[DRM_NODE_PRIMARY],
|
||||
display_path = vk_strdup(&instance->vk.alloc,
|
||||
drm_display_device->nodes[DRM_NODE_PRIMARY],
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
if (!primary_path) {
|
||||
if (!display_path) {
|
||||
result = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto err_vk_free_render_path;
|
||||
}
|
||||
} else {
|
||||
primary_path = NULL;
|
||||
display_path = NULL;
|
||||
}
|
||||
|
||||
result =
|
||||
pvr_winsys_create(render_path, primary_path, &instance->vk.alloc, &ws);
|
||||
pvr_winsys_create(render_path, display_path, &instance->vk.alloc, &ws);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_vk_free_primary_path;
|
||||
goto err_vk_free_display_path;
|
||||
|
||||
pvr_physical_device_get_supported_extensions(&supported_extensions);
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice,
|
|||
|
||||
pdevice->instance = instance;
|
||||
pdevice->render_path = render_path;
|
||||
pdevice->primary_path = primary_path;
|
||||
pdevice->display_path = display_path;
|
||||
pdevice->ws = ws;
|
||||
pdevice->vk.supported_sync_types = ws->sync_types;
|
||||
|
||||
|
|
@ -458,8 +458,8 @@ err_vk_physical_device_finish:
|
|||
err_pvr_winsys_destroy:
|
||||
pvr_winsys_destroy(ws);
|
||||
|
||||
err_vk_free_primary_path:
|
||||
vk_free(&instance->vk.alloc, primary_path);
|
||||
err_vk_free_display_path:
|
||||
vk_free(&instance->vk.alloc, display_path);
|
||||
|
||||
err_vk_free_render_path:
|
||||
vk_free(&instance->vk.alloc, render_path);
|
||||
|
|
@ -518,7 +518,7 @@ static VkResult pvr_enumerate_devices(struct pvr_instance *instance)
|
|||
* 8cb12a2528d795c45bba5f03b3486b4040fb0f45, so, until this is fixed in
|
||||
* upstream, hard-code the maximum number of devices.
|
||||
*/
|
||||
drmDevicePtr drm_primary_device = NULL;
|
||||
drmDevicePtr drm_display_device = NULL;
|
||||
drmDevicePtr drm_render_device = NULL;
|
||||
drmDevicePtr drm_devices[8];
|
||||
int max_drm_devices;
|
||||
|
|
@ -541,18 +541,18 @@ static VkResult pvr_enumerate_devices(struct pvr_instance *instance)
|
|||
drm_render_device->nodes[DRM_NODE_RENDER]);
|
||||
} else if (pvr_drm_device_is_supported(drm_devices[i],
|
||||
DRM_NODE_PRIMARY)) {
|
||||
drm_primary_device = drm_devices[i];
|
||||
drm_display_device = drm_devices[i];
|
||||
|
||||
mesa_logd("Found compatible primary device '%s'.",
|
||||
drm_primary_device->nodes[DRM_NODE_PRIMARY]);
|
||||
mesa_logd("Found compatible display device '%s'.",
|
||||
drm_display_device->nodes[DRM_NODE_PRIMARY]);
|
||||
}
|
||||
}
|
||||
|
||||
if (drm_render_device && drm_primary_device) {
|
||||
if (drm_render_device && drm_display_device) {
|
||||
result = pvr_physical_device_init(&instance->physical_device,
|
||||
instance,
|
||||
drm_render_device,
|
||||
drm_primary_device);
|
||||
drm_display_device);
|
||||
if (result == VK_SUCCESS)
|
||||
instance->physical_devices_count = 1;
|
||||
else if (result == VK_ERROR_INCOMPATIBLE_DRIVER)
|
||||
|
|
@ -1714,7 +1714,7 @@ VkResult pvr_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO);
|
||||
|
||||
result = pvr_winsys_create(pdevice->render_path,
|
||||
pdevice->primary_path,
|
||||
pdevice->display_path,
|
||||
pAllocator ? pAllocator : &instance->vk.alloc,
|
||||
&ws);
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ struct pvr_physical_device {
|
|||
|
||||
char *name;
|
||||
char *render_path;
|
||||
char *primary_path;
|
||||
char *display_path;
|
||||
|
||||
struct pvr_winsys *ws;
|
||||
struct pvr_device_info dev_info;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ VkResult pvr_wsi_init(struct pvr_physical_device *pdevice)
|
|||
pvr_physical_device_to_handle(pdevice),
|
||||
pvr_wsi_proc_addr,
|
||||
&pdevice->vk.instance->alloc,
|
||||
pdevice->ws->primary_fd,
|
||||
pdevice->ws->display_fd,
|
||||
NULL,
|
||||
&(struct wsi_device_options){ .sw_device = false });
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "pvr_winsys.h"
|
||||
|
||||
VkResult pvr_drm_winsys_create(const int render_fd,
|
||||
const int primary_fd,
|
||||
const int display_fd,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct pvr_winsys **const ws_out)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "pvr_winsys.h"
|
||||
|
||||
VkResult pvr_drm_winsys_create(int render_fd,
|
||||
int primary_fd,
|
||||
int display_fd,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct pvr_winsys **ws_out);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ void pvr_winsys_destroy(struct pvr_winsys *ws)
|
|||
}
|
||||
|
||||
VkResult pvr_winsys_create(const char *render_path,
|
||||
const char *primary_path,
|
||||
const char *display_path,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct pvr_winsys **const ws_out)
|
||||
{
|
||||
drmVersionPtr version;
|
||||
VkResult result;
|
||||
int primary_fd;
|
||||
int display_fd;
|
||||
int render_fd;
|
||||
|
||||
render_fd = open(render_path, O_RDWR | O_CLOEXEC);
|
||||
|
|
@ -68,17 +68,17 @@ VkResult pvr_winsys_create(const char *render_path,
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
if (primary_path) {
|
||||
primary_fd = open(primary_path, O_RDWR | O_CLOEXEC);
|
||||
if (primary_fd < 0) {
|
||||
if (display_path) {
|
||||
display_fd = open(display_path, O_RDWR | O_CLOEXEC);
|
||||
if (display_fd < 0) {
|
||||
result = vk_errorf(NULL,
|
||||
VK_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to open primary device %s",
|
||||
primary_path);
|
||||
"Failed to open display device %s",
|
||||
display_path);
|
||||
goto err_close_render_fd;
|
||||
}
|
||||
} else {
|
||||
primary_fd = -1;
|
||||
display_fd = -1;
|
||||
}
|
||||
|
||||
version = drmGetVersion(render_fd);
|
||||
|
|
@ -86,14 +86,14 @@ VkResult pvr_winsys_create(const char *render_path,
|
|||
result = vk_errorf(NULL,
|
||||
VK_ERROR_INCOMPATIBLE_DRIVER,
|
||||
"Failed to query kernel driver version for device.");
|
||||
goto err_close_primary_fd;
|
||||
goto err_close_display_fd;
|
||||
}
|
||||
|
||||
if (strcmp(version->name, "powervr") == 0) {
|
||||
result = pvr_drm_winsys_create(render_fd, primary_fd, alloc, ws_out);
|
||||
result = pvr_drm_winsys_create(render_fd, display_fd, alloc, ws_out);
|
||||
#if defined(PVR_SUPPORT_SERVICES_DRIVER)
|
||||
} else if (strcmp(version->name, "pvr") == 0) {
|
||||
result = pvr_srv_winsys_create(render_fd, primary_fd, alloc, ws_out);
|
||||
result = pvr_srv_winsys_create(render_fd, display_fd, alloc, ws_out);
|
||||
#endif
|
||||
} else {
|
||||
result = vk_errorf(
|
||||
|
|
@ -105,13 +105,13 @@ VkResult pvr_winsys_create(const char *render_path,
|
|||
drmFreeVersion(version);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_close_primary_fd;
|
||||
goto err_close_display_fd;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
err_close_primary_fd:
|
||||
if (primary_fd >= 0)
|
||||
close(primary_fd);
|
||||
err_close_display_fd:
|
||||
if (display_fd >= 0)
|
||||
close(display_fd);
|
||||
|
||||
err_close_render_fd:
|
||||
close(render_fd);
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ struct pvr_winsys {
|
|||
struct vk_sync_timeline_type timeline_syncobj_type;
|
||||
|
||||
int render_fd;
|
||||
int primary_fd;
|
||||
int display_fd;
|
||||
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
|
|
@ -504,7 +504,7 @@ struct pvr_winsys {
|
|||
|
||||
void pvr_winsys_destroy(struct pvr_winsys *ws);
|
||||
VkResult pvr_winsys_create(const char *render_path,
|
||||
const char *primary_path,
|
||||
const char *display_path,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct pvr_winsys **ws_out);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ VkResult pvr_winsys_helper_display_buffer_create(struct pvr_winsys *const ws,
|
|||
};
|
||||
VkResult result;
|
||||
|
||||
result = pvr_ioctl(ws->primary_fd,
|
||||
result = pvr_ioctl(ws->display_fd,
|
||||
DRM_IOCTL_MODE_CREATE_DUMB,
|
||||
&args,
|
||||
VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
|
|
@ -64,7 +64,7 @@ VkResult pvr_winsys_helper_display_buffer_destroy(struct pvr_winsys *ws,
|
|||
.handle = handle,
|
||||
};
|
||||
|
||||
return pvr_ioctl(ws->primary_fd,
|
||||
return pvr_ioctl(ws->display_fd,
|
||||
DRM_IOCTL_MODE_DESTROY_DUMB,
|
||||
&args,
|
||||
VK_ERROR_UNKNOWN);
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ static bool pvr_is_driver_compatible(int render_fd)
|
|||
}
|
||||
|
||||
VkResult pvr_srv_winsys_create(const int render_fd,
|
||||
const int primary_fd,
|
||||
const int display_fd,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct pvr_winsys **const ws_out)
|
||||
{
|
||||
|
|
@ -713,7 +713,7 @@ VkResult pvr_srv_winsys_create(const int render_fd,
|
|||
|
||||
srv_ws->base.ops = &srv_winsys_ops;
|
||||
srv_ws->base.render_fd = render_fd;
|
||||
srv_ws->base.primary_fd = primary_fd;
|
||||
srv_ws->base.display_fd = display_fd;
|
||||
srv_ws->base.alloc = alloc;
|
||||
|
||||
srv_ws->bvnc = bvnc;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static VkResult pvr_srv_alloc_display_pmr(struct pvr_srv_winsys *srv_ws,
|
|||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
ret = drmPrimeHandleToFD(srv_ws->base.primary_fd, handle, O_CLOEXEC, &fd);
|
||||
ret = drmPrimeHandleToFD(srv_ws->base.display_fd, handle, O_CLOEXEC, &fd);
|
||||
if (ret) {
|
||||
result = vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
goto err_display_buffer_destroy;
|
||||
|
|
@ -292,7 +292,7 @@ VkResult pvr_srv_winsys_buffer_get_fd(struct pvr_winsys_bo *bo,
|
|||
return pvr_srv_physmem_export_dmabuf(ws->render_fd, srv_bo->pmr, fd_out);
|
||||
|
||||
/* For display buffers, export using saved buffer handle */
|
||||
ret = drmPrimeHandleToFD(ws->primary_fd, srv_bo->handle, O_CLOEXEC, fd_out);
|
||||
ret = drmPrimeHandleToFD(ws->display_fd, srv_bo->handle, O_CLOEXEC, fd_out);
|
||||
if (ret)
|
||||
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "pvr_winsys.h"
|
||||
|
||||
VkResult pvr_srv_winsys_create(int render_fd,
|
||||
int primary_fd,
|
||||
int display_fd,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct pvr_winsys **ws_out);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue