[Mesa-dev] [PATCH] kms-swrast: Support Prime fd handling
Emil Velikov
emil.l.velikov at gmail.com
Thu Aug 28 07:01:25 PDT 2014
On 22/08/14 17:41, Andreas Pokorny wrote:
> Allows using prime fds as display target and from display target.
> Test for PRIME capability after initializing kms_swrast screen.
>
Hi Andreas,
I'm hoping that Giovanni will take a look. After all kms-dri is his creation.
>From my POV the patch is good and should be safe to go in 10.3 on the point
that the driver/target was introduced with 10.3. There is a trivial nit-pick
which I'll squash before committing later on this week.
Btw in the future can you please include Cc: "branch number" <mesa-stable...>
[1] in the commit message - it will ease things a bit :)
Cheers,
Emil
[1] Marking a commit as a candidate for a stable branch
http://mesa3d.org/devinfo.html
> Signed-off-by: Andreas Pokorny <andreas.pokorny at canonical.com>
> ---
[snip]
> diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
> index c9934bb..ba0660c 100644
> --- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
> +++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
[snip]
> @@ -231,17 +264,34 @@ kms_sw_displaytarget_from_handle(struct sw_winsys *ws,
> struct kms_sw_winsys *kms_sw = kms_sw_winsys(ws);
> struct kms_sw_displaytarget *kms_sw_dt;
>
> - assert(whandle->type == DRM_API_HANDLE_TYPE_KMS);
> + assert(whandle->type == DRM_API_HANDLE_TYPE_KMS ||
> + whandle->type == DRM_API_HANDLE_TYPE_FD);
>
> - LIST_FOR_EACH_ENTRY(kms_sw_dt, &kms_sw->bo_list, link) {
> - if (kms_sw_dt->handle == whandle->handle) {
> + switch(whandle->type) {
> + case DRM_API_HANDLE_TYPE_FD:
> + kms_sw_dt = kms_sw_displaytarget_add_from_prime(kms_sw, whandle->handle);
> + if (kms_sw_dt) {
> kms_sw_dt->ref_count++;
> + kms_sw_dt->width = templ->width0;
> + kms_sw_dt->height = templ->height0;
> + kms_sw_dt->stride = whandle->stride;
> + if (stride)
Any objections on dropping the above conditional before committing?
> + *stride = kms_sw_dt->stride;
> + }
> + return (struct sw_displaytarget *)kms_sw_dt;
> + case DRM_API_HANDLE_TYPE_KMS:
> + LIST_FOR_EACH_ENTRY(kms_sw_dt, &kms_sw->bo_list, link) {
> + if (kms_sw_dt->handle == whandle->handle) {
> + kms_sw_dt->ref_count++;
>
> - DEBUG("KMS-DEBUG: imported buffer %u (size %u)\n", kms_sw_dt->handle, kms_sw_dt->size);
> + DEBUG("KMS-DEBUG: imported buffer %u (size %u)\n", kms_sw_dt->handle, kms_sw_dt->size);
>
> - *stride = kms_sw_dt->stride;
> - return (struct sw_displaytarget *)kms_sw_dt;
> + *stride = kms_sw_dt->stride;
> + return (struct sw_displaytarget *)kms_sw_dt;
> + }
> }
> + default:
> + break;
> }
More information about the mesa-dev
mailing list