(unknown)
A message that is not in the archive (sent off-list or not yet received): [PATCH xf86-video-amdgpu 0/3] Add non-desktop and leasing support
A message that is not in the archive (sent off-list or not yet received): [PATCH xf86-video-amdgpu 0/3] Add non-desktop and leasing
support
Here are the patches to the modesetting driver amended for the amdgpu driver.
-keith
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180303044931.6902-1-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org
PATCH 1/3 xf86-video-modesetting: Record non-desktop kernel property at PreInit time
Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration.
[Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax]
--- src/drmmode_display.c | 7 +++++++ 1 file changed, 7 insertions(+)
src/drmmode_display.c +7 -0
@@ -1980,6 +1980,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_rdrmModePropertyBlobPtr path_blob =NULL ;char name[32 ];int i; +Bool nonDesktop = FALSE;const char *s; koutput =
@@ -1989,6 +1990,10 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_rreturn 0 ; path_blob =koutput_get_prop_blob (pAMDGPUEnt->fd, koutput,"PATH" ); + i =koutput_get_prop_idx (pAMDGPUEnt->fd, koutput,DRM_MODE_PROP_RANGE ,RR_PROPERTY_NON_DESKTOP ); +if (i >=0 ) + nonDesktop = koutput->prop_values[i] !=0 ; + kencoders =calloc (sizeof (drmModeEncoderPtr), koutput->count_encoders);if (!kencoders) {
@@ -2021,6 +2026,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r drmmode_output = output->driver_private; drmmode_output->output_id = mode_res->connectors[num]; drmmode_output->mode_output = koutput; + output->non_desktop = nonDesktop;for (i =0 ; i < koutput->count_encoders; i++) {drmModeFreeEncoder (kencoders[i]); }
@@ -2064,6 +2070,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r output->interlaceAllowed = TRUE; output->doubleScanAllowed = TRUE; output->driver_private = drmmode_output; + output->non_desktop = nonDesktop; output->possible_crtcs =0xffffffff ;for (i =0 ; i < koutput->count_encoders; i++) {
Signature · 6 lines
2.16.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 xf86-video-modesetting: Create CONNECTOR_ID properties for outputs [v2]
In reply to a message not in the archiveThis lets a DRM client map between X outputs and kernel connectors.
v2:
Change CONNECTOR_ID to enum -- Adam Jackson <[email protected]>
--- src/drmmode_display.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
src/drmmode_display.c +23 -0
@@ -1662,6 +1662,29 @@ static void drmmode_output_create_resources(xf86OutputPtr output) drmmode_output->tear_free = info->tear_free; drmmode_output->num_props++; +/* Create CONNECTOR_ID property */ + { +Atom name =MakeAtom ("CONNECTOR_ID" ,12 , TRUE); +INT32 value = mode_output->connector_id; + +if (name !=BAD_RESOURCE ) { + err =RRConfigureOutputProperty (output->randr_output, name, + FALSE, FALSE, TRUE, +1 , &value); +if (err !=0 ) { +xf86DrvMsg (output->scrn->scrnIndex,X_ERROR , +"RRConfigureOutputProperty error, %d\n" , err); + } + err =RRChangeOutputProperty (output->randr_output, name, +XA_INTEGER ,32 , PropModeReplace,1 , + &value, FALSE, FALSE); +if (err !=0 ) { +xf86DrvMsg (output->scrn->scrnIndex,X_ERROR , +"RRChangeOutputProperty error, %d\n" , err); + } + } + } +for (i =0 ; i < drmmode_output->num_props; i++) {drmmode_prop_ptr p = &drmmode_output->props[i]; drmmode_prop = p->mode_prop;
Signature · 6 lines
2.16.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 Add RandR leases with modesetting driver support [v6]
In reply to a message not in the archiveThis adds support for RandR CRTC/Output leases through the modesetting driver, creating a lease using new kernel infrastructure and returning that to a client through an fd which will have access to only those resources.
v2: Restore CRTC mode when leases terminate
When a lease terminates for a crtc we have saved data for, go ahead and restore the saved mode.
v3: Report RR_Rotate_0 rotations for leased crtcs.
Ignore leased CRTCs when selecting screen size.
Stop leasing encoders, the kernel doesn't do that anymore.
Turn off crtc->enabled while leased so that modesetting ignores them.
Check lease status before calling any driver mode functions
When starting a lease, mark leased CRTCs as disabled and hide their cursors. Also, check to see if there are other non-leased CRTCs which are driving leased Outputs and mark them as disabled as well. Sometimes an application will lease an idle crtc instead of the one already associated with the leased output.
When terminating a lease, reset any CRTCs which are driving outputs that are no longer leased so that they start working again.
This required splitting the DIX level lease termination code into two pieces, one to remove the lease from the system (RRLeaseTerminated) and a new function that frees the lease data structure (RRLeaseFree).
v4: Report RR_Rotate_0 rotation for leased crtcs.
v5: Terminate all leases on server reset.
Leases hang around after the associated client exits so that the client doesn't need to occupy an X server client slot and consume a file descriptor once it has gotten the output resources necessary.
Any leases still hanging around when the X server resets or shuts down need to be cleaned up by calling the kernel to terminate the lease and freeing any DIX structures.
Note that we cannot simply use the existing drmmode_terminate_lease function on each lease as that wants to also reset the video mode, and during server shut down that
modesetting: Validate leases on VT enter
The kernel doesn't allow any master ioctls to run when another VT is active, including simple things like listing the active leases. To deal with that, we check the list of leases whenever the X server VT is activated.
xfree86: hide disabled cursors when resetting after lease termination
The lessee may well have played with cursors and left one active on our screen. Just tell the kernel to turn it off.
v6: Add meson build infrastructure
[Also bumped libdrm requirement - ajax]
--- configure.ac | 12 +++++ src/amdgpu_kms.c | 2 + src/drmmode_display.c | 147 +++++++++++++++++++++++++++++++++++++++++++++++++- src/drmmode_display.h | 5 ++ 4 files changed, 165 insertions(+), 1 deletion(-)
configure.ac +12 -0
@@ -54,6 +54,14 @@ if test "x$GCC" = "xyes"; then CPPFLAGS="$CPPFLAGS -Wall" fi +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <features.h> +#ifndef __GLIBC__ +#error not glibc +#endif +]], [])], [AC_DEFINE(_GNU_SOURCE, 1, + [ Enable GNU and other extensions to the C environment for glibc])]) + AH_TOP([#include "xorg-server.h"]) # Define a configure option for an alternate module directory
@@ -203,6 +211,8 @@ AC_CHECK_HEADERS([dri3.h], [], [], CPPFLAGS="$SAVE_CPPFLAGS" +AC_CHECK_LIB([bsd], [arc4random_buf]) + # Checks for headers/macros for byte swapping # Known variants: # <byteswap.h> bswap_16, bswap_32, bswap_64 (glibc)
@@ -213,6 +223,8 @@ CPPFLAGS="$SAVE_CPPFLAGS" # if <byteswap.h> is found, assume it's the correct version AC_CHECK_HEADERS([byteswap.h]) +AC_REPLACE_FUNCS([reallocarray]) + # if <sys/endian.h> is found, have to check which version AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
src/amdgpu_kms.c +2 -0
@@ -1708,6 +1708,8 @@ static Bool AMDGPUCloseScreen_KMS(ScreenPtr pScreen)/* Clear mask of assigned crtc's in this generation */ pAMDGPUEnt->assigned_crtcs =0 ; +drmmode_terminate_leases (pScrn, &info->drmmode); +drmmode_uevent_fini (pScrn, &info->drmmode);amdgpu_drm_queue_close (pScrn);
src/drmmode_display.c +146 -1
160 lines not on this page · raw message
src/drmmode_display.h +5 -0
@@ -132,6 +132,9 @@ typedef struct {int tear_free; } drmmode_output_private_rec, *drmmode_output_private_ptr; +typedef struct { +uint32_t lessee_id; +}drmmode_lease_private_rec , *drmmode_lease_private_ptr ;enum drmmode_flip_sync {FLIP_VSYNC ,
@@ -220,6 +223,8 @@ PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc,extern void drmmode_uevent_init (ScrnInfoPtr scrn,drmmode_ptr drmmode);extern void drmmode_uevent_fini (ScrnInfoPtr scrn,drmmode_ptr drmmode); +extern void drmmode_terminate_leases (ScrnInfoPtr scrn,drmmode_ptr drmmode); +Bool drmmode_set_mode (xf86CrtcPtr crtc,struct drmmode_fb *fb,DisplayModePtr mode,int x,int y);
Signature · 6 lines
2.16.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re:
In reply to a message not in the archiveQuoted 2 lines · Keith Packard
Here are the patches to the modesetting driver amended for the amdgpu driver.
Thanks for the patches. Unfortunately, since this driver still has to compile and work with xserver >= 1.13, at least patches 1 & 3 cannot be applied as is.
I was going to port these and take care of that anyway, though I might not get around to it before April. If it can't wait that long, I can give you details about what needs to be done.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 82fc592b-f680-c663-1a0f-7b522ca932d2-otUistvHUpPR7s880joybQ@public.gmane.org
Re:
Quoted 11 lines · Michel Dänzer
Quoted 2 lines · Keith Packard
Here are the patches to the modesetting driver amended for the amdgpu driver.
Thanks for the patches. Unfortunately, since this driver still has to compile and work with xserver >= 1.13, at least patches 1 & 3 cannot be applied as is.
I was going to port these and take care of that anyway, though I might not get around to it before April. If it can't wait that long, I can give you details about what needs to be done.
I'm good with that -- I needed this to test amdgpu vs modesetting for some applications, and just having the patches with support is good enough for me.
Signature · 1 line
-keith
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx