| 1 |
/* |
| 2 |
* Copyright © 2012 Rob Clark <[email protected]> |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
* |
| 5 |
* Authors: |
| 6 |
* Rob Clark <[email protected]> |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "util/u_inlines.h" |
| 10 |
#include "util/u_screen.h" |
| 11 |
|
| 12 |
#include "freedreno_drm_public.h" |
| 13 |
|
| 14 |
#include "freedreno/freedreno_screen.h" |
| 15 |
|
| 16 |
#include "virtio/virtio-gpu/drm_hw.h" |
| 17 |
|
| 18 |
struct pipe_screen * |
| 19 |
fd_drm_screen_create_renderonly(int fd, struct renderonly *ro, |
| 20 |
const struct pipe_screen_config *config) |
| 21 |
{ |
| 22 |
return u_pipe_screen_lookup_or_create(fd, config, ro, fd_screen_create); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Check if the native-context type exposed by virtgpu is one we |
| 27 |
* support, and that we support the underlying device. |
| 28 |
*/ |
| 29 |
bool |
| 30 |
fd_drm_probe_nctx(int fd, const struct virgl_renderer_capset_drm *caps) |
| 31 |
{ |
| 32 |
if (caps->context_type != VIRTGPU_DRM_CONTEXT_MSM) |
| 33 |
return false; |
| 34 |
|
| 35 |
struct fd_dev_id dev_id = { |
| 36 |
.gpu_id = caps->u.msm.gpu_id, |
| 37 |
.chip_id = caps->u.msm.chip_id, |
| 38 |
}; |
| 39 |
const struct fd_dev_info info = fd_dev_info(&dev_id); |
| 40 |
|
| 41 |
return info.chip != 0; |
| 42 |
} |